macOS: Apply alpha channel to surface format even when non-default

Relying on QSurfaceFormat() to check whether or not we should set
the alpha channel size makes it impossible to tweak other properties
of the surface format without also having to set the alpha. There's
no need to do such as broad comparison, we can check the alpha channel
size for its default value instead.

Change-Id: Iac31d37c9460eb3e7ec5ee15902f7e5addb48178
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-01-28 15:18:48 +01:00
parent 5d181961ea
commit cf53ed97a1

View File

@ -227,8 +227,9 @@ QSurfaceFormat QCocoaWindow::format() const
// Upgrade the default surface format to include an alpha channel. The default RGB format // Upgrade the default surface format to include an alpha channel. The default RGB format
// causes Cocoa to spend an unreasonable amount of time converting it to RGBA internally. // causes Cocoa to spend an unreasonable amount of time converting it to RGBA internally.
if (format == QSurfaceFormat()) if (format.alphaBufferSize() < 0)
format.setAlphaBufferSize(8); format.setAlphaBufferSize(8);
return format; return format;
} }