diff options
Diffstat (limited to 'src/plugins/imageformats/icns/qicnshandler.cpp')
-rw-r--r-- | src/plugins/imageformats/icns/qicnshandler.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/imageformats/icns/qicnshandler.cpp b/src/plugins/imageformats/icns/qicnshandler.cpp index 05b8f5b..b098d13 100644 --- a/src/plugins/imageformats/icns/qicnshandler.cpp +++ b/src/plugins/imageformats/icns/qicnshandler.cpp @@ -534,7 +534,9 @@ static QImage readMask(const ICNSEntry &mask, QDataStream &stream) const qint64 oldPos = stream.device()->pos(); if (!stream.device()->seek(pos)) return QImage(); - QImage img(mask.width, mask.height, QImage::Format_RGB32); + QImage img; + if (!QImageIOHandler::allocateImage(QSize(mask.width, mask.height), QImage::Format_RGB32, &img)) + return QImage(); quint8 byte = 0; quint32 pixel = 0; for (quint32 y = 0; y < mask.height; y++) { @@ -564,7 +566,9 @@ static QImage readLowDepthIcon(const ICNSEntry &icon, QDataStream &stream) const QList<QRgb> colortable = getColorTable(depth); if (colortable.isEmpty()) return QImage(); - QImage img(icon.width, icon.height, format); + QImage img; + if (!QImageIOHandler::allocateImage(QSize(icon.width, icon.height), format, &img)) + return QImage(); img.setColorTable(colortable); quint32 pixel = 0; quint8 byte = 0; @@ -595,7 +599,9 @@ static QImage readLowDepthIcon(const ICNSEntry &icon, QDataStream &stream) static QImage read32bitIcon(const ICNSEntry &icon, QDataStream &stream) { - QImage img = QImage(icon.width, icon.height, QImage::Format_RGB32); + QImage img; + if (!QImageIOHandler::allocateImage(QSize(icon.width, icon.height), QImage::Format_RGB32, &img)) + return QImage(); if (icon.dataFormat != ICNSEntry::RLE24) { for (quint32 y = 0; y < icon.height; y++) { QRgb *line = reinterpret_cast<QRgb *>(img.scanLine(y)); |