]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
Added wxIMAGE_OPTION_ORIGINAL_{WIDTH,HEIGHT} wxImage options.
[wxWidgets.git] / src / common / image.cpp
index 0cb1adf7886f143d508fd58617e1b0260fbb89fa..ebb8931854b6ee6b068e76cd696ab786efcd9ef2 100644 (file)
@@ -2450,7 +2450,17 @@ bool wxImage::DoLoad(wxImageHandler& handler, wxInputStream& stream, int index)
         }
 
         if ( width != widthOrig || height != heightOrig )
+        {
+            // get the original size if it was set by the image handler
+            // but also in order to restore it after Rescale
+            int widthOrigOption = GetOptionInt(wxIMAGE_OPTION_ORIGINAL_WIDTH),
+                heightOrigOption = GetOptionInt(wxIMAGE_OPTION_ORIGINAL_HEIGHT);
+
             Rescale(width, height, wxIMAGE_QUALITY_HIGH);
+
+            SetOption(wxIMAGE_OPTION_ORIGINAL_WIDTH, widthOrigOption ? widthOrigOption : widthOrig);
+            SetOption(wxIMAGE_OPTION_ORIGINAL_HEIGHT, heightOrigOption ? heightOrigOption : heightOrig);
+        }
     }
 
     // Set this after Rescale, which currently does not preserve it