OSDN Git Service

move variables closer to the scope they are used in QImage::transformed()
authorIvailo Monev <xakepa10@gmail.com>
Mon, 29 Nov 2021 17:46:21 +0000 (19:46 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 29 Nov 2021 17:46:21 +0000 (19:46 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/image/qimage.cpp

index e69b412..49c64fe 100644 (file)
@@ -4567,10 +4567,6 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
     int ws = width();
     int hs = height();
 
-    // target image data
-    int wd;
-    int hd;
-
     // compute size of target image
     QTransform mat = trueMatrix(matrix, ws, hs);
 
@@ -4588,6 +4584,9 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
             return rotated180(*this);
     }
 
+    // target image data
+    int wd;
+    int hd;
     bool complex_xform = false;
     if (mat.type() == QTransform::TxScale) {
         if (mode == Qt::FastTransformation) {
@@ -4609,8 +4608,6 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
     if (wd == 0 || hd == 0)
         return QImage();
 
-    const int bpp = depth();
-
     QImage::Format target_format = d->format;
 
     if (complex_xform || mode == Qt::SmoothTransformation) {
@@ -4632,6 +4629,7 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
     dImage.d->dpmx = dotsPerMeterX();
     dImage.d->dpmy = dotsPerMeterY();
 
+    const int bpp = depth();
     switch (bpp) {
         // initizialize the data
         case 8: