+
+ DFBSurfacePixelFormat format = DepthToFormat(depth);
+ if ( format == DSPF_UNKNOWN && image.HasAlpha() )
+ format = DSPF_ARGB;
+
+ // create surface in screen's format (unless we need alpha channel,
+ // in which case use ARGB):
+ if ( !CreateWithFormat(image.GetWidth(), image.GetHeight(), format) )
+ return;
+
+ // then copy the image to it:
+ wxIDirectFBSurfacePtr dst = M_BITMAP->m_surface;
+
+ switch ( dst->GetPixelFormat() )
+ {
+ case DSPF_RGB24:
+ case DSPF_RGB32:
+ case DSPF_ARGB:
+ CopyImageToSurface(image, dst);
+ break;
+
+ default:
+ {
+ // wxBitmap uses different pixel format, so we have to use a
+ // temporary surface and blit to the bitmap via it:
+ wxIDirectFBSurfacePtr src(CreateSurfaceForImage(image));
+ CopyImageToSurface(image, src);
+
+ if ( !dst->SetBlittingFlags(DSBLIT_NOFX) )
+ return;
+ if ( !dst->Blit(src->GetRaw(), NULL, 0, 0) )
+ return;
+ }
+ }
+
+ // FIXME: implement mask creation from image's mask (or alpha channel?)
+ wxASSERT_MSG( !image.HasMask(), "image masks are ignored for now" );