QMacCGContext::initialize: Handle QPixmap without platform pixmap

Regression after 585150e3d947d0ee30489f275e7fc39bce4fe059.

(cherry picked from commit 195c893424a386d66cbec01c777e08c54d6af49a)
Change-Id: Ie728904736dd41fb8dfa6ecc9f843beea95b4604
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen 2023-05-26 10:27:10 +02:00
parent ad330d9f61
commit e6b1d99ff2

View File

@ -386,11 +386,14 @@ void QMacCGContext::initialize(QPaintDevice *paintDevice)
// Find the underlying QImage of the paint device
switch (int deviceType = paintDevice->devType()) {
case QInternal::Pixmap: {
auto *platformPixmap = static_cast<QPixmap*>(paintDevice)->handle();
if (platformPixmap && platformPixmap->classId() == QPlatformPixmap::RasterClass)
if (auto *platformPixmap = static_cast<QPixmap*>(paintDevice)->handle()) {
if (platformPixmap->classId() == QPlatformPixmap::RasterClass)
initialize(platformPixmap->buffer());
else
qWarning() << "QMacCGContext: Unsupported pixmap class" << platformPixmap->classId();
} else {
qWarning() << "QMacCGContext: Empty platformPixmap";
}
break;
}
case QInternal::Image: