summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2017-09-04 14:54:18 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2017-09-05 09:32:35 +0000
commit4250993c4280b80f472af77efa6cf77410b383c1 (patch)
tree6431a7a474784b68749a1009c4b9f8f6773ddbfe /src
parenta2a5b7a697a90c5821ee675c943481bf0631aeba (diff)
macOS: Don’t color convert the backing store
The backing store was assigned the sRGB color profile as an unintended side effect of the QImage -> CGImage conversion function refactoring in ac899f6d. This caused Core Graphics to add a color convert step, which in some cases caused performance issues. Restore fast, previous behavior by assigning the target display color profile to the backing store image. Color correctness is still a goal, but we’ll add API for it and make it opt-in. Task-number: QTBUG-61384 Change-Id: Ia36d29404c64d8030a100f6a71816d84e484308b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 972bfc46cb..1f39d787be 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -79,7 +79,15 @@ void QCocoaBackingStore::beginPaint(const QRegion &region)
void QCocoaBackingStore::endPaint()
{
QRasterBackingStore::endPaint();
- m_cgImage = m_image.toCGImage();
+
+ // Prevent potentially costly color conversion by assiging the display
+ // color space to the backingstore image.
+ NSView *view = static_cast<QCocoaWindow *>(window()->handle())->view();
+ CGColorSpaceRef displayColorSpace = view.window.screen.colorSpace.CGColorSpace;
+ QCFType<CGImageRef> displayColorSpaceImage =
+ CGImageCreateCopyWithColorSpace(m_image.toCGImage(), displayColorSpace);
+
+ m_cgImage = displayColorSpaceImage;
}
#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12)