diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2017-09-04 12:55:19 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2017-09-05 09:32:32 +0000 |
commit | 0adc14d8dbdd9e28ccb72c49d865009dd8df1b1c (patch) | |
tree | 58984874def0812457a51ef219bd7530b0d0e0d0 | |
parent | c7766a41e3dc71b86fbff424735457388e4e4f73 (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: I107f06a881a34fa711b386265d8dc2edfb246624
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index ba5c0ea25d..04e02a274a 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -516,7 +516,13 @@ static bool _q_dontOverrideCtrlLMB = false; dirtyBackingRect.size.height ); CGImageRef bsCGImage = qt_mac_toCGImage(m_backingStore->toImage()); - CGImageRef cleanImg = CGImageCreateWithImageInRect(bsCGImage, backingStoreRect); + + // Prevent potentially costly color conversion by assiging the display + // color space to the backingstore image. + CGImageRef displayColorSpaceImage = CGImageCreateCopyWithColorSpace(bsCGImage, + self.window.screen.colorSpace.CGColorSpace); + + CGImageRef cleanImg = CGImageCreateWithImageInRect(displayColorSpaceImage, backingStoreRect); // Optimization: Copy frame buffer content instead of blending for // top-level windows where Qt fills the entire window content area. @@ -531,6 +537,7 @@ static bool _q_dontOverrideCtrlLMB = false; CGImageRelease(cleanImg); CGImageRelease(subMask); CGImageRelease(bsCGImage); + CGImageRelease(displayColorSpaceImage); } - (BOOL) isFlipped |