diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-22 14:28:15 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-23 07:56:40 (GMT) |
commit | 24071323009135108023698ef2f8b266f5437f5c (patch) | |
tree | 874cbe5caf0ec2b60399557db44e389a0ef63bcd /src/plugins/imageformats/jpeg | |
parent | 369afa4bcee7addbf1a7e8556cf0b521bb75c57d (diff) | |
download | Qt-24071323009135108023698ef2f8b266f5437f5c.zip Qt-24071323009135108023698ef2f8b266f5437f5c.tar.gz Qt-24071323009135108023698ef2f8b266f5437f5c.tar.bz2 |
QJpegImageHandle: Avoid smooth scalling when it should not.
Task-number: QTBUG-3211
Task-number: 236875
Reviewed-by: Alex
Diffstat (limited to 'src/plugins/imageformats/jpeg')
-rw-r--r-- | src/plugins/imageformats/jpeg/qjpeghandler.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 5fcbb5f..3b23e56 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -895,7 +895,8 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, (void) jpeg_finish_decompress(&cinfo); } #ifndef QT_NO_IMAGE_SMOOTHSCALE - } else if (scaledSize.isValid()) { + } else if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height) + && quality >= HIGH_QUALITY_THRESHOLD) { jpegSmoothScaler scaler(&cinfo, QString().sprintf("Scale( %d, %d, ScaleFree )", scaledSize.width(), @@ -946,6 +947,9 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, outImage->setDotsPerMeterX(int(100. * cinfo.X_density)); outImage->setDotsPerMeterY(int(100. * cinfo.Y_density)); } + + if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height)) + *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation); } } |