Fix loading of top to bottom BMP files in wxMSW wxBitmap.

The native LoadImage() function used by wxBMPFileHandler only supports the
standard bottom to top BMPs, fall back to our own implementation in wxImage
wxBMPHandler if it fails to also support the top to bottom ones.

Closes #13650.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76041 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-02 13:06:08 +00:00
parent aa8b1fe82f
commit 49761cd251
2 changed files with 18 additions and 4 deletions

View File

@@ -635,6 +635,7 @@ wxMSW:
- Fix crash when adding/removing the same path to/from wxFileSystemWatcher.
- Draw "classic" disabled owner drawn buttons better (Artur Wieczorek).
- Fix width of the vertical toolbars (Artur Wieczorek).
- Fix loading of top to bottom BMP files in wxBitmap (Artur Wieczorek).
wxOSX:

View File

@@ -393,15 +393,28 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap,
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
#if wxUSE_WXDIB
wxCHECK_MSG( bitmap, false, wxT("NULL bitmap in LoadFile") );
#if wxUSE_WXDIB
// Try loading using native Windows LoadImage() first.
wxDIB dib(name);
if ( dib.IsOk() )
return bitmap->CopyFromDIB(dib);
#endif // wxUSE_WXDIB
// Some valid bitmap files are not supported by LoadImage(), e.g. those
// with negative height. Try to use our own bitmap loading code which does
// support them.
#if wxUSE_IMAGE
wxImage img(name, wxBITMAP_TYPE_BMP);
if ( img.IsOk() )
{
*bitmap = wxBitmap(img);
return true;
}
#endif // wxUSE_IMAGE
return dib.IsOk() && bitmap->CopyFromDIB(dib);
#else
return false;
#endif
}
bool wxBMPFileHandler::SaveFile(const wxBitmap *bitmap,