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>
This commit is contained in:
Ulf Hermann 2015-04-08 14:46:32 +02:00 committed by Ulf Hermann
parent cf5e557073
commit 2ca1253b13

View File

@ -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)