wxBitmap::LoadFile and SaveFile now uses wxImage's methods in case there is no wxBitmap handler for given type

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4604 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
1999-11-17 22:33:52 +00:00
parent 169ee06c44
commit b75dd496d2
5 changed files with 49 additions and 39 deletions

View File

@@ -44,6 +44,7 @@
#include "wx/log.h"
#include "wx/msw/dib.h"
#include "wx/image.h"
// ----------------------------------------------------------------------------
// macros
@@ -278,9 +279,14 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
wxBitmapHandler *handler = FindHandler(type);
if ( handler == NULL ) {
wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
return FALSE;
wxImage image;
if (!image.LoadFile( filename, type )) return FALSE;
if (image.Ok())
{
*this = image.ConvertToBitmap();
return TRUE;
}
else return FALSE;
}
return handler->LoadFile(this, filename, type, -1, -1);
@@ -307,10 +313,10 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal
{
wxBitmapHandler *handler = FindHandler(type);
if ( handler == NULL ) {
wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
return FALSE;
if ( handler == NULL ) { // try wxImage
wxImage image( *this );
if (image.Ok()) return image.SaveFile( filename, type );
else return FALSE;
}
return handler->SaveFile(this, filename, type, palette);