diff options
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qbmphandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qbmphandler_p.h | 3 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 13 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qpnghandler_p.h | 2 | ||||
-rw-r--r-- | src/gui/image/qppmhandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qppmhandler_p.h | 2 | ||||
-rw-r--r-- | src/gui/image/qxbmhandler.cpp | 6 | ||||
-rw-r--r-- | src/gui/image/qxbmhandler_p.h | 2 | ||||
-rw-r--r-- | src/gui/image/qxpmhandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qxpmhandler_p.h | 2 |
13 files changed, 40 insertions, 10 deletions
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 7257853c3e..7f8e072322 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -866,10 +866,12 @@ void QBmpHandler::setOption(ImageOption option, const QVariant &value) Q_UNUSED(value); } +#if QT_DEPRECATED_SINCE(5, 13) QByteArray QBmpHandler::name() const { return formatName(); } +#endif QT_END_NAMESPACE diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h index 56b39dd0f0..33b5b9c501 100644 --- a/src/gui/image/qbmphandler_p.h +++ b/src/gui/image/qbmphandler_p.h @@ -113,8 +113,9 @@ public: bool read(QImage *image) override; bool write(const QImage &image) override; +#if QT_DEPRECATED_SINCE(5, 13) QByteArray name() const override; - +#endif static bool canRead(QIODevice *device); QVariant option(ImageOption option) const override; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 204729b551..e508cc9413 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1454,6 +1454,7 @@ void QImage::setDevicePixelRatio(qreal scaleFactor) d->devicePixelRatio = scaleFactor; } +#if QT_DEPRECATED_SINCE(5, 10) /*! \since 4.6 \obsolete @@ -1470,6 +1471,7 @@ int QImage::byteCount() const Q_ASSERT(!d || d->nbytes < std::numeric_limits<int>::max()); return d ? int(d->nbytes) : 0; } +#endif /*! \since 5.10 diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 6e57f679d8..56b82abcfa 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1866,7 +1866,7 @@ QList<QByteArray> QPictureIO::outputFormats() bool QPictureIO::read() { QFile file; - const char *picture_format; + QByteArray picture_format; QPictureHandler *h; if (d->iodev) { // read from io device @@ -1882,7 +1882,7 @@ bool QPictureIO::read() if (d->frmt.isEmpty()) { // Try to guess format picture_format = pictureFormat(d->iodev); // get picture format - if (!picture_format) { + if (picture_format.isEmpty()) { if (file.isOpen()) { // unknown format file.close(); d->iodev = 0; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 091095f3fc..2ef1d09422 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -714,8 +714,8 @@ QBitmap QPixmap::createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) control the conversion. Note that QPixmaps are automatically added to the QPixmapCache - when loaded from a file; the key used is internal and can not - be acquired. + when loaded from a file in main thread; the key used is internal + and cannot be acquired. \sa loadFromData(), {QPixmap#Reading and Writing Image Files}{Reading and Writing Image Files} @@ -729,6 +729,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers // Note: If no extension is provided, we try to match the // file against known plugin extensions if (info.completeSuffix().isEmpty() || info.exists()) { + const bool inGuiThread = qApp->thread() == QThread::currentThread(); QString key = QLatin1String("qt_pixmap") % info.absoluteFilePath() @@ -736,13 +737,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers % HexString<quint64>(info.size()) % HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType); - if (QPixmapCache::find(key, this)) + if (inGuiThread && QPixmapCache::find(key, this)) return true; data = QPlatformPixmap::create(0, 0, data ? data->pixelType() : QPlatformPixmap::PixmapType); if (data->fromFile(fileName, format, flags)) { - QPixmapCache::insert(key, *this); + if (inGuiThread) + QPixmapCache::insert(key, *this); return true; } } @@ -994,7 +996,10 @@ QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rectangle) */ QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h) { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED return grabWidget(widget, QRect(x, y, w, h)); +QT_WARNING_POP } #endif diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 066261620b..93635a051d 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -244,8 +244,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal { png_uint_32 width; png_uint_32 height; - int bit_depth; - int color_type; + int bit_depth = 0; + int color_type = 0; png_bytep trans_alpha = 0; png_color_16p trans_color_p = 0; int num_trans; @@ -750,7 +750,7 @@ QImage::Format QPngHandlerPrivate::readImageFormat() { QImage::Format format = QImage::Format_Invalid; png_uint_32 width, height; - int bit_depth, color_type; + int bit_depth = 0, color_type = 0; png_colorp palette; int num_palette; png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); @@ -1257,10 +1257,12 @@ void QPngHandler::setOption(ImageOption option, const QVariant &value) d->scaledSize = value.toSize(); } +#if QT_DEPRECATED_SINCE(5, 13) QByteArray QPngHandler::name() const { return "png"; } +#endif QT_END_NAMESPACE diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h index 4ca716e7c2..5d4da97395 100644 --- a/src/gui/image/qpnghandler_p.h +++ b/src/gui/image/qpnghandler_p.h @@ -69,7 +69,9 @@ public: bool read(QImage *image) override; bool write(const QImage &image) override; +#if QT_DEPRECATED_SINCE(5, 13) QByteArray name() const override; +#endif QVariant option(ImageOption option) const override; void setOption(ImageOption option, const QVariant &value) override; diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index bfde0aa76e..13ee2eadd2 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -576,10 +576,12 @@ void QPpmHandler::setOption(ImageOption option, const QVariant &value) subType = value.toByteArray().toLower(); } +#if QT_DEPRECATED_SINCE(5, 13) QByteArray QPpmHandler::name() const { return subType.isEmpty() ? QByteArray("ppm") : subType; } +#endif QT_END_NAMESPACE diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h index 1c6fbd6869..f3c9d0f139 100644 --- a/src/gui/image/qppmhandler_p.h +++ b/src/gui/image/qppmhandler_p.h @@ -67,7 +67,9 @@ public: bool read(QImage *image) override; bool write(const QImage &image) override; +#if QT_DEPRECATED_SINCE(5, 13) QByteArray name() const override; +#endif static bool canRead(QIODevice *device, QByteArray *subType = 0); diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index 24d86e116d..65a5b63bc7 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -97,6 +97,8 @@ static bool read_xbm_header(QIODevice *device, int& w, int& h) if (r1.indexIn(sbuf) == 0 && r2.indexIn(sbuf, r1.matchedLength()) == r1.matchedLength()) w = QByteArray(&buf[r1.matchedLength()]).trimmed().toInt(); + else + return false; // "#define .._height <num>" readBytes = device->readLine(buf, buflen); @@ -109,6 +111,8 @@ static bool read_xbm_header(QIODevice *device, int& w, int& h) if (r1.indexIn(sbuf) == 0 && r2.indexIn(sbuf, r1.matchedLength()) == r1.matchedLength()) h = QByteArray(&buf[r1.matchedLength()]).trimmed().toInt(); + else + return false; // format error if (w <= 0 || w > 32767 || h <= 0 || h > 32767) @@ -352,10 +356,12 @@ void QXbmHandler::setOption(ImageOption option, const QVariant &value) fileName = value.toString(); } +#if QT_DEPRECATED_SINCE(5, 13) QByteArray QXbmHandler::name() const { return "xbm"; } +#endif QT_END_NAMESPACE diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h index 26439af527..ae590a1944 100644 --- a/src/gui/image/qxbmhandler_p.h +++ b/src/gui/image/qxbmhandler_p.h @@ -66,7 +66,9 @@ public: bool read(QImage *image) override; bool write(const QImage &image) override; +#if QT_DEPRECATED_SINCE(5, 13) QByteArray name() const override; +#endif static bool canRead(QIODevice *device); diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index 17272ffe69..a32dfda96d 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -1287,10 +1287,12 @@ void QXpmHandler::setOption(ImageOption option, const QVariant &value) fileName = value.toString(); } +#if QT_DEPRECATED_SINCE(5, 13) QByteArray QXpmHandler::name() const { return "xpm"; } +#endif QT_END_NAMESPACE diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h index f118bf2309..a4dd88cd17 100644 --- a/src/gui/image/qxpmhandler_p.h +++ b/src/gui/image/qxpmhandler_p.h @@ -68,7 +68,9 @@ public: static bool canRead(QIODevice *device); +#if QT_DEPRECATED_SINCE(5, 13) QByteArray name() const override; +#endif QVariant option(ImageOption option) const override; void setOption(ImageOption option, const QVariant &value) override; |