wxUSE_IMAGE cleanup, fix warning

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton
2005-03-01 10:16:28 +00:00
parent e3e34b267b
commit d45318b8b6

View File

@@ -51,6 +51,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject )
// we don't dare premultiplied alpha yet // we don't dare premultiplied alpha yet
#define wxMAC_USE_PREMULTIPLIED_ALPHA 0 #define wxMAC_USE_PREMULTIPLIED_ALPHA 0
#if wxUSE_BMPBUTTON
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType ) void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType )
{ {
memset( info , 0 , sizeof(ControlButtonContentInfo) ) ; memset( info , 0 , sizeof(ControlButtonContentInfo) ) ;
@@ -122,6 +124,8 @@ void wxMacReleaseBitmapButton( ControlButtonContentInfo*info )
} }
} }
#endif //wxUSE_BMPBUTTON
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData) #define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
void wxBitmapRefData::Init() void wxBitmapRefData::Init()
@@ -369,7 +373,10 @@ IconRef wxBitmapRefData::GetIconRef()
// transform into IconRef // transform into IconRef
static int iconCounter = 2 ; static int iconCounter = 2 ;
OSStatus err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) iconCounter, iconFamily, &m_iconRef ) ; #ifdef __WXDEBUG__
OSStatus err =
#endif
RegisterIconRefFromIconFamily( 'WXNG' , (OSType) iconCounter, iconFamily, &m_iconRef ) ;
wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ; wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ;
// we have to retain a reference, as Unregister will decrement it // we have to retain a reference, as Unregister will decrement it
AcquireIconRef( m_iconRef ) ; AcquireIconRef( m_iconRef ) ;
@@ -809,12 +816,16 @@ void wxBitmap::EndRawAccess()
bool wxBitmap::CreateFromXpm(const char **bits) bool wxBitmap::CreateFromXpm(const char **bits)
{ {
#if wxUSE_IMAGE
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") ) wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )
wxXPMDecoder decoder; wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits); wxImage img = decoder.ReadData(bits);
wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") ) wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") )
*this = wxBitmap(img); *this = wxBitmap(img);
return TRUE; return TRUE;
#else
return FALSE;
#endif
} }
#ifdef __WXMAC_OSX__ #ifdef __WXMAC_OSX__
@@ -907,11 +918,13 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
} }
else else
{ {
#if wxUSE_IMAGE
wxImage loadimage(filename, type); wxImage loadimage(filename, type);
if (loadimage.Ok()) { if (loadimage.Ok()) {
*this = loadimage; *this = loadimage;
return true; return true;
} }
#endif
} }
wxLogWarning(wxT("no bitmap handler for type %d defined."), type); wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
return false; return false;
@@ -934,6 +947,8 @@ bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int
return handler->Create(this, data, type, width, height, depth); return handler->Create(this, data, type, width, height, depth);
} }
#if wxUSE_IMAGE
wxBitmap::wxBitmap(const wxImage& image, int depth) wxBitmap::wxBitmap(const wxImage& image, int depth)
{ {
wxCHECK_RET( image.Ok(), wxT("invalid image") ) wxCHECK_RET( image.Ok(), wxT("invalid image") )
@@ -1085,6 +1100,7 @@ wxImage wxBitmap::ConvertToImage() const
return image; return image;
} }
#endif //wxUSE_IMAGE
bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type,
const wxPalette *palette) const const wxPalette *palette) const
@@ -1097,9 +1113,10 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type,
} }
else else
{ {
#if wxUSE_IMAGE
wxImage image = ConvertToImage(); wxImage image = ConvertToImage();
return image.SaveFile(filename, type); return image.SaveFile(filename, type);
#endif
} }
wxLogWarning(wxT("no bitmap handler for type %d defined."), type); wxLogWarning(wxT("no bitmap handler for type %d defined."), type);