X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/906c935a80b10d53cecf57f71ab5f3f4f1d529ec..4a699e3a59b19c21b6faae714b56cac5a75df2e2:/src/common/image.cpp?ds=sidebyside diff --git a/src/common/image.cpp b/src/common/image.cpp index 0cb1adf788..ef7fb58dd9 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -142,6 +142,7 @@ bool wxImage::Create(const char* const* xpmData) (*this) = decoder.ReadData(xpmData); return IsOk(); #else + wxUnusedVar(xpmData); return false; #endif } @@ -2450,7 +2451,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 @@ -2565,6 +2576,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const if ( !handler ) { wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() ); + return false; } return DoSave(*handler, stream);