summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpnghandler.cpp
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2019-06-24 17:43:16 +0200
committerAleix Pol <aleixpol@kde.org>2019-06-26 16:21:45 +0200
commitcc13b99781b0bbf5f9d09b2c5b081a085762cd0c (patch)
tree6a55db99e34bf2ded6deeca80b6cc3b2e980fb9d /src/gui/image/qpnghandler.cpp
parent89655525ae56dd9662f1873efdce72cbff7bb932 (diff)
Do not downscale png when the size is exactly right
Don't go through the doScaledRead path (i.e. calling read_image_scaled) when reading an image that the target size is the image of the file we are opening. This makes the loading of the file much faster while keeping the output correct. [ChangeLog][QtGui][QImage] Improve loading time when loading png files that have the same size as the target. Change-Id: I2a33c49fe1ce52ec296c2175ee542b5bcdec2c4b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image/qpnghandler.cpp')
-rw-r--r--src/gui/image/qpnghandler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 801b30881d..e7e998efd1 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -394,7 +394,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
}
QSize outSize(width,height);
if (!scaledSize.isEmpty() && quint32(scaledSize.width()) <= width &&
- quint32(scaledSize.height()) <= height && interlace_method == PNG_INTERLACE_NONE) {
+ quint32(scaledSize.height()) <= height && scaledSize != outSize && interlace_method == PNG_INTERLACE_NONE) {
// Do inline downscaling
outSize = scaledSize;
if (doScaledRead)