diff options
Diffstat (limited to 'src/plugins/imageformats/ico')
-rw-r--r-- | src/plugins/imageformats/ico/qicohandler.cpp | 5 | ||||
-rw-r--r-- | src/plugins/imageformats/ico/qicohandler.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index 3bcf30bfc6..18b39766f5 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -499,7 +499,7 @@ QImage ICOReader::iconAt(int index) if (!image.isNull()) { readBMP(image); if (!image.isNull()) { - if (icoAttrib.depth == 32) { + if (icoAttrib.nbits == 32) { img = std::move(image).convertToFormat(QImage::Format_ARGB32_Premultiplied); } else { QImage mask(image.width(), image.height(), QImage::Format_Mono); @@ -735,6 +735,8 @@ bool QtIcoHandler::supportsOption(ImageOption option) const */ bool QtIcoHandler::canRead() const { + if (knownCanRead) + return true; bool bCanRead = false; QIODevice *device = QImageIOHandler::device(); if (device) { @@ -744,6 +746,7 @@ bool QtIcoHandler::canRead() const } else { qCWarning(lcIco, "QtIcoHandler::canRead() called with no device"); } + knownCanRead = bCanRead; return bCanRead; } diff --git a/src/plugins/imageformats/ico/qicohandler.h b/src/plugins/imageformats/ico/qicohandler.h index 0fe251ab60..61c3eea465 100644 --- a/src/plugins/imageformats/ico/qicohandler.h +++ b/src/plugins/imageformats/ico/qicohandler.h @@ -30,7 +30,7 @@ public: private: int m_currentIconIndex; ICOReader *m_pICOReader; - + mutable bool knownCanRead = false; }; QT_END_NAMESPACE |