From cc13b99781b0bbf5f9d09b2c5b081a085762cd0c Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 24 Jun 2019 17:43:16 +0200 Subject: 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 --- src/gui/image/qpnghandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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) -- cgit v1.2.3