From 4250993c4280b80f472af77efa6cf77410b383c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 4 Sep 2017 14:54:18 +0200 Subject: =?UTF-8?q?macOS:=20Don=E2=80=99t=20color=20convert=20the=20backin?= =?UTF-8?q?g=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins') 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 ®ion) 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(window()->handle())->view(); + CGColorSpaceRef displayColorSpace = view.window.screen.colorSpace.CGColorSpace; + QCFType displayColorSpaceImage = + CGImageCreateCopyWithColorSpace(m_image.toCGImage(), displayColorSpace); + + m_cgImage = displayColorSpaceImage; } #if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) -- cgit v1.2.3