From: Václav Slavík Date: Sun, 16 Dec 2007 18:10:48 +0000 (+0000) Subject: convert wxImage's mask into alpha channel in wxDFB's wxBitmap for now, until full... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/82452a17ff46c4d6769601000189ef9fcd0a7dd9 convert wxImage's mask into alpha channel in wxDFB's wxBitmap for now, until full wxMask support is implemented git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/dfb/bitmap.cpp b/src/dfb/bitmap.cpp index 26b3ada098..483183e4f8 100644 --- a/src/dfb/bitmap.cpp +++ b/src/dfb/bitmap.cpp @@ -325,9 +325,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() ) @@ -362,9 +369,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