summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-12-22 23:16:41 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-12-22 23:16:41 (GMT)
commitbe2acbcd6cfbaa75b502157061c385129e8f0b35 (patch)
tree5b6f36690c5cb357e816c51387aa4d795528ec9d /src
parent0eabf288f6b05c788f547f761c6e7874856d2703 (diff)
downloadQt-be2acbcd6cfbaa75b502157061c385129e8f0b35.zip
Qt-be2acbcd6cfbaa75b502157061c385129e8f0b35.tar.gz
Qt-be2acbcd6cfbaa75b502157061c385129e8f0b35.tar.bz2
Use libjpeg's builtin scaler for implementing setScaledSize()
The libjpeg library has builtin support for scaling to 1/2, 1/4, and 1/8 the original size very quickly. Use this in the implementation of setScaledSize() to get close to the desired size and then scale with QImageSmoothScaler the rest of the way. Task-number: QT-2023 Reviewed-by: Daniel Pope
Diffstat (limited to 'src')
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index aa239ec..8da6610 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -758,10 +758,9 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
quality = 75;
#ifndef QT_NO_IMAGE_SMOOTHSCALE
- // If high quality not required, shrink image during decompression
- if (scaledSize.isValid() && !scaledSize.isEmpty() && quality < HIGH_QUALITY_THRESHOLD) {
+ if (!scaledSize.isEmpty()) {
cinfo.scale_denom = qMin(cinfo.image_width / scaledSize.width(),
- cinfo.image_width / scaledSize.height());
+ cinfo.image_height / scaledSize.height());
if (cinfo.scale_denom < 2) {
cinfo.scale_denom = 1;
} else if (cinfo.scale_denom < 4) {