+ if ( !handler.LoadFile(this, stream, true/*verbose*/, index) )
+ return false;
+
+ M_IMGDATA->m_type = handler.GetType();
+
+ // rescale the image to the specified size if needed
+ if ( maxWidth || maxHeight )
+ {
+ const unsigned widthOrig = GetWidth(),
+ heightOrig = GetHeight();
+
+ // this uses the same (trivial) algorithm as the JPEG handler
+ unsigned width = widthOrig,
+ height = heightOrig;
+ while ( (maxWidth && width > maxWidth) ||
+ (maxHeight && height > maxHeight) )
+ {
+ width /= 2;
+ height /= 2;
+ }
+
+ if ( width != widthOrig || height != heightOrig )
+ Rescale(width, height, wxIMAGE_QUALITY_HIGH);
+ }
+
+ return true;
+}
+
+bool wxImage::LoadFile( wxInputStream& stream, wxBitmapType type, int index )
+{
+ AllocExclusive();