X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1f8fd3b411a0e36407ea6d2218a61e5a262f309..0bbe61b8c18a1795189f0cf73cc61c14a0fb846d:/src/common/imagjpeg.cpp?ds=sidebyside diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 86dfa2da77..f279fed885 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -57,10 +57,6 @@ typedef boolean wxjpeg_boolean; // For JPEG library error handling #include -#ifdef __SALFORDC__ -#undef FAR -#endif - // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- @@ -310,6 +306,17 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos } } + // set up resolution if available: it's part of optional JFIF APP0 chunk + if ( cinfo.saw_JFIF_marker ) + { + image->SetOption(wxIMAGE_OPTION_RESOLUTIONX, cinfo.X_density); + image->SetOption(wxIMAGE_OPTION_RESOLUTIONY, cinfo.Y_density); + + // we use the same values for this option as libjpeg so we don't need + // any conversion here + image->SetOption(wxIMAGE_OPTION_RESOLUTIONUNIT, cinfo.density_unit); + } + jpeg_finish_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo ); return true;