macOS: Handle missing color space information in IOSurface backingstore

Fixes: QTBUG-80972
Change-Id: Iab3f1a9cf03251340e5f32bcc73103428e93282d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-01-02 13:21:58 +01:00
parent 240a8514f8
commit 105e662221

View File

@ -89,9 +89,16 @@ QIOSurfaceGraphicsBuffer::~QIOSurfaceGraphicsBuffer()
void QIOSurfaceGraphicsBuffer::setColorSpace(QCFType<CGColorSpaceRef> colorSpace)
{
Q_ASSERT(colorSpace);
IOSurfaceSetValue(m_surface, CFSTR("IOSurfaceColorSpace"),
QCFType<CFPropertyListRef>(CGColorSpaceCopyPropertyList(colorSpace)));
static const auto kIOSurfaceColorSpace = CFSTR("IOSurfaceColorSpace");
qCDebug(lcQpaIOSurface) << "Tagging" << this << "with color space" << colorSpace;
if (colorSpace) {
IOSurfaceSetValue(m_surface, kIOSurfaceColorSpace,
QCFType<CFPropertyListRef>(CGColorSpaceCopyPropertyList(colorSpace)));
} else {
IOSurfaceRemoveValue(m_surface, kIOSurfaceColorSpace);
}
}
const uchar *QIOSurfaceGraphicsBuffer::data() const