X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0521644101bb0047ba8099c71842c37249be662..05e0b047d879cdbfade7f2ab346c0acdf3e29f96:/src/gtk/bitmap.cpp?ds=inline diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index e5f2b669d1..0f7ab2e9ef 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -181,12 +181,14 @@ GdkBitmap *wxMask::GetBitmap() const // wxBitmap //----------------------------------------------------------------------------- -class wxBitmapRefData: public wxObjectRefData +class wxBitmapRefData: public wxGDIRefData { public: wxBitmapRefData(); virtual ~wxBitmapRefData(); + virtual bool IsOk() const { return m_pixmap || m_pixbuf; } + GdkPixmap *m_pixmap; GdkPixbuf *m_pixbuf; wxMask *m_mask; @@ -597,15 +599,6 @@ wxImage wxBitmap::ConvertToImage() const #endif // wxUSE_IMAGE -bool wxBitmap::IsOk() const -{ - return (m_refData != NULL) && - ( - M_BMPDATA->m_pixbuf || - M_BMPDATA->m_pixmap - ); -} - int wxBitmap::GetHeight() const { wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") ); @@ -701,6 +694,9 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalett wxImage image = ConvertToImage(); return image.Ok() && image.SaveFile(name, type); #else // !wxUSE_IMAGE + wxUnusedVar(name); + wxUnusedVar(type); + return false; #endif // wxUSE_IMAGE } @@ -905,9 +901,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) GdkPixbuf *pixbuf = GetPixbuf(); const bool hasAlpha = HasAlpha(); // allow access if bpp is valid and matches existence of alpha - if (pixbuf != NULL && ( - bpp == 24 && !hasAlpha || - bpp == 32 && hasAlpha)) + if ( pixbuf && ((bpp == 24 && !hasAlpha) || (bpp == 32 && hasAlpha)) ) { data.m_height = gdk_pixbuf_get_height( pixbuf ); data.m_width = gdk_pixbuf_get_width( pixbuf ); @@ -927,12 +921,12 @@ bool wxBitmap::HasAlpha() const gdk_pixbuf_get_has_alpha(M_BMPDATA->m_pixbuf); } -wxObjectRefData* wxBitmap::CreateRefData() const +wxGDIRefData* wxBitmap::CreateGDIRefData() const { return new wxBitmapRefData; } -wxObjectRefData* wxBitmap::CloneRefData(const wxObjectRefData* data) const +wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const { const wxBitmapRefData* oldRef = wx_static_cast(const wxBitmapRefData*, data); wxBitmapRefData* newRef = new wxBitmapRefData; @@ -972,12 +966,6 @@ wxObjectRefData* wxBitmap::CloneRefData(const wxObjectRefData* data) const return newRef; } -//----------------------------------------------------------------------------- -// wxBitmapHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) - /* static */ void wxBitmap::InitStandardHandlers() { // TODO: Insert handler based on GdkPixbufs handler later