]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagjpeg.cpp
wxDL_XXX macros and dynamic loading cleanup:
[wxWidgets.git] / src / common / imagjpeg.cpp
index 86dfa2da770a10349398879cb5c857a902dcb081..d045596065270a56b7da4401918e00eb83abd49c 100644 (file)
@@ -310,6 +310,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;