X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5001e9361fe01a134b45fa5caf55477e8368d26..89edb75e59ec9793aa75e9bac2ff4f7f10748f77:/src/dfb/bitmap.cpp diff --git a/src/dfb/bitmap.cpp b/src/dfb/bitmap.cpp index 0c245df509..91684bdad3 100644 --- a/src/dfb/bitmap.cpp +++ b/src/dfb/bitmap.cpp @@ -246,7 +246,7 @@ static DFBSurfacePixelFormat DepthToFormat(int depth) // wxBitmapRefData //----------------------------------------------------------------------------- -class wxBitmapRefData: public wxObjectRefData +class wxBitmapRefData: public wxGDIRefData { public: wxBitmapRefData() @@ -275,6 +275,8 @@ public: #endif } + virtual bool IsOk() const { return m_surface; } + wxIDirectFBSurfacePtr m_surface; wxMask *m_mask; #if wxUSE_PALETTE @@ -288,7 +290,6 @@ public: // wxBitmap //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxBitmapBase) wxBitmap::wxBitmap(int width, int height, int depth) @@ -323,9 +324,16 @@ bool wxBitmap::CreateWithFormat(int width, int height, int dfbFormat) } #if wxUSE_IMAGE -wxBitmap::wxBitmap(const wxImage& image, int depth) +wxBitmap::wxBitmap(const wxImage& imageOrig, int depth) { - wxCHECK_RET( image.Ok(), wxT("invalid image") ); + wxCHECK_RET( imageOrig.Ok(), wxT("invalid image") ); + + wxImage image(imageOrig); + + // convert mask to alpha channel, because wxMask isn't implemented yet + // FIXME: don't do this, implement proper wxMask support + if ( image.HasMask() ) + image.InitAlpha(); DFBSurfacePixelFormat format = DepthToFormat(depth); if ( format == DSPF_UNKNOWN && image.HasAlpha() ) @@ -360,9 +368,6 @@ wxBitmap::wxBitmap(const wxImage& image, int depth) return; } } - - // FIXME: implement mask creation from image's mask (or alpha channel?) - wxASSERT_MSG( !image.HasMask(), "image masks are ignored for now" ); } wxImage wxBitmap::ConvertToImage() const @@ -458,11 +463,6 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) wxFAIL_MSG( "not implemented" ); } -bool wxBitmap::IsOk() const -{ - return (m_refData != NULL && M_BITMAP->m_surface); -} - int wxBitmap::GetHeight() const { wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") ); @@ -644,12 +644,12 @@ wxIDirectFBSurfacePtr wxBitmap::GetDirectFBSurface() const return M_BITMAP->m_surface; } -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 { return new wxBitmapRefData(*(wxBitmapRefData *)data); }