diff options
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index a9f9a98c2c..42c6a3fc0b 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -35,8 +35,9 @@ #include <private/qfont_p.h> #if QT_CONFIG(thread) -#include "qsemaphore.h" -#include "qthreadpool.h" +#include <qsemaphore.h> +#include <qthreadpool.h> +#include <private/qthreadpool_p.h> #endif #include <qtgui_tracepoints_p.h> @@ -1487,12 +1488,14 @@ void QImage::setDevicePixelRatio(qreal scaleFactor) } /*! - Returns the size of the pixmap in device independent pixels. + Returns the size of the image in device independent pixels. - This value should be used when using the pixmap size in user interface + This value should be used when using the image size in user interface size calculations. - The return value is equivalent to pixmap.size() / pixmap.devicePixelRatio(), + The return value is equivalent to image.size() / image.devicePixelRatio(). + + \since 6.2 */ QSizeF QImage::deviceIndependentSize() const { @@ -4672,6 +4675,8 @@ QImage QImage::smoothScaled(int w, int h) const static QImage rotated90(const QImage &image) { QImage out(image.height(), image.width(), image.format()); + if (out.isNull()) + return out; copyMetadata(&out, image); if (image.colorCount() > 0) out.setColorTable(image.colorTable()); @@ -4700,6 +4705,8 @@ static QImage rotated180(const QImage &image) return image.mirrored(true, true); QImage out(image.width(), image.height(), image.format()); + if (out.isNull()) + return out; copyMetadata(&out, image); if (image.colorCount() > 0) out.setColorTable(image.colorTable()); @@ -4712,6 +4719,8 @@ static QImage rotated180(const QImage &image) static QImage rotated270(const QImage &image) { QImage out(image.height(), image.width(), image.format()); + if (out.isNull()) + return out; copyMetadata(&out, image); if (image.colorCount() > 0) out.setColorTable(image.colorTable()); @@ -5097,7 +5106,7 @@ void QImage::applyColorTransform(const QColorTransform &transform) #if QT_CONFIG(thread) && !defined(Q_OS_WASM) int segments = (qsizetype(width()) * height()) >> 16; segments = std::min(segments, height()); - QThreadPool *threadPool = QThreadPool::globalInstance(); + QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance(); if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) { QSemaphore semaphore; int y = 0; |