-//-----------------------------------------------------------------------------
-// surface manipulation helpers
-//-----------------------------------------------------------------------------
-
-wxIDirectFBSurfacePtr wxDfbCloneSurface(const wxIDirectFBSurfacePtr& s,
- wxDfbCloneSurfaceMode mode)
-{
- if ( !s )
- return NULL;
-
- DFBSurfaceDescription desc;
- desc.flags = (DFBSurfaceDescriptionFlags)(
- DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT);
- s->GetCapabilities(&desc.caps);
- s->GetSize(&desc.width, &desc.height);
- s->GetPixelFormat(&desc.pixelformat);
-
- wxIDirectFBSurfacePtr snew(wxIDirectFB::Get()->CreateSurface(&desc));
- if ( !snew )
- return NULL;
-
- if ( desc.pixelformat == DSPF_LUT8 )
- {
- wxIDirectFBPalettePtr pal(s->GetPalette());
- if ( s )
- {
- if ( !snew->SetPalette(pal) )
- return NULL;
- }
- }
-
- if ( mode == wxDfbCloneSurface_CopyPixels )
- {
- if ( !snew->SetBlittingFlags(DSBLIT_NOFX) )
- return NULL;
- if ( !snew->Blit(s, NULL, 0, 0) )
- return NULL;
- }
-
- return snew;
-}
-
-int wxDfbGetSurfaceDepth(const wxIDirectFBSurfacePtr& s)
-{
- wxCHECK_MSG( s, -1, _T("invalid surface") );
-
- DFBSurfacePixelFormat format = DSPF_UNKNOWN;
-
- if ( !s->GetPixelFormat(&format) )
- return -1;
-
- return DFB_BITS_PER_PIXEL(format);
-}
-
-wxIDirectFBDisplayLayerPtr wxDfbGetDisplayLayer()
-{
- return wxIDirectFB::Get()->GetDisplayLayer(DLID_PRIMARY);
-}
-
-wxIDirectFBSurfacePtr wxDfbGetPrimarySurface()
-{
- wxIDirectFBDisplayLayerPtr layer(wxDfbGetDisplayLayer());
- return layer ? layer->GetSurface() : NULL;
-}
-