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>
bb10
parent
a2a5b7a697
commit
4250993c42
|
|
@ -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<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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue