summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-01-28 15:18:48 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-01-29 11:12:41 +0000
commitcf53ed97a113751f3130543e3a1e853d45817dd9 (patch)
tree670eee78cf564afcfc20a5e692653509e61a81bc /src/plugins/platforms/cocoa/qcocoawindow.mm
parent5d181961ea28da07128384aa5144c67d07f87a3e (diff)
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>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index df1ad82592..b0f0d51ecb 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -227,8 +227,9 @@ QSurfaceFormat QCocoaWindow::format() const
// 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.
- if (format == QSurfaceFormat())
+ if (format.alphaBufferSize() < 0)
format.setAlphaBufferSize(8);
+
return format;
}