]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagjpeg.cpp
Fix AdjustForOverflow to use item->CalcMin, not item->GetSize
[wxWidgets.git] / src / common / imagjpeg.cpp
index 86dfa2da770a10349398879cb5c857a902dcb081..f279fed885a5631f2b4e31444ca88faaa6a13158 100644 (file)
@@ -57,10 +57,6 @@ typedef boolean wxjpeg_boolean;
 // For JPEG library error handling
 #include <setjmp.h>
 
-#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;