summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2015-04-08 14:46:32 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-05-13 09:04:33 +0000
commit2ca1253b13e77643b3d2dd993a038ae2df882311 (patch)
treedcc2fea4c520c67a03e1d3cb34cd321ebb58a504
parentcf5e55707365ce0da33a2602191cb0f95bd12eff (diff)
Cocoa: Upgrade default surface format to include an alpha channel
The default surface format on OS X is changed to RGBA since this is most performant. You can request a different surface format to change this. You can not request the default format without alpha channel, though. Change-Id: I4f44d0abe01515c98ba699c76a0dd5e37b873766 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 739a2b105a..3db3fc3547 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -451,7 +451,13 @@ QCocoaWindow::~QCocoaWindow()
QSurfaceFormat QCocoaWindow::format() const
{
- return window()->requestedFormat();
+ QSurfaceFormat format = window()->requestedFormat();
+
+ // 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())
+ format.setAlphaBufferSize(8);
+ return format;
}
void QCocoaWindow::setGeometry(const QRect &rectIn)