Fix workaround for image readers that can scale but not clip
authoraavit <qt_aavit@ovi.com>
Wed, 18 Apr 2012 14:15:41 +0000 (16:15 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 27 Apr 2012 08:37:02 +0000 (10:37 +0200)
If both scaling and clipping was requested from an image reader that
only supports scaling, the code failed to apply the intended
workaround (i.e. read normal and do clipping and scaling afterwards).
Ref. the comment just above about "Only enable the ScaledSize option if
..."

Change-Id: I273edba60bf9f785f2082aa8f236505ec3ce0776
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/gui/image/qimagereader.cpp

index 870784f..fe14a45 100644 (file)
@@ -1197,11 +1197,7 @@ bool QImageReader::read(QImage *image)
             }
         }
     } else {
-        if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid()) {
-            // in this case, there's nothing we can do. if the
-            // plugin supports scaled size but not ClipRect, then
-            // we have to ignore ClipRect."
-
+        if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid() && d->clipRect.isNull()) {
             if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) {
                 // nothing to do (ClipRect is ignored!)
             } else {