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>
This commit is contained in:
Morten Johan Sørvig 2017-09-04 12:55:19 +02:00
parent c7766a41e3
commit 0adc14d8db
1 changed files with 8 additions and 1 deletions

View File

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