From 2ca1253b13e77643b3d2dd993a038ae2df882311 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 8 Apr 2015 14:46:32 +0200 Subject: Cocoa: Upgrade default surface format to include an alpha channel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3