#pragma hdrstop
#endif
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/log.h"
+#endif
+
#include "wx/dfb/wrapdfb.h"
//-----------------------------------------------------------------------------
wxIDirectFBSurfacePtr wxIDirectFB::GetPrimarySurface()
{
- wxIDirectFBDisplayLayerPtr layer(GetDisplayLayer());
- return layer ? layer->GetSurface() : NULL;
+ DFBSurfaceDescription desc;
+ desc.flags = DSDESC_CAPS;
+ desc.caps = DSCAPS_PRIMARY;
+ return CreateSurface(&desc);
}
//-----------------------------------------------------------------------------
// wxIDirectFBSurface
//-----------------------------------------------------------------------------
+DFBSurfacePixelFormat wxIDirectFBSurface::GetPixelFormat()
+{
+ DFBSurfacePixelFormat format = DSPF_UNKNOWN;
+ GetPixelFormat(&format);
+ return format;
+}
+
int wxIDirectFBSurface::GetDepth()
{
DFBSurfacePixelFormat format = DSPF_UNKNOWN;
return DFB_BITS_PER_PIXEL(format);
}
-wxIDirectFBSurfacePtr wxIDirectFBSurface::CreateCompatible(const wxSize& sz)
+wxIDirectFBSurfacePtr
+wxIDirectFBSurface::CreateCompatible(const wxSize& sz, int flags)
{
wxSize size(sz);
if ( size == wxDefaultSize )
desc.width = size.x;
desc.height = size.y;
+ // filter out caps that don't make sense for a new compatible surface:
+ int caps = desc.caps;
+ caps &= ~DSCAPS_PRIMARY;
+ caps &= ~DSCAPS_SUBSURFACE;
+ if ( flags & CreateCompatible_NoBackBuffer )
+ {
+ caps &= ~DSCAPS_DOUBLE;
+ caps &= ~DSCAPS_TRIPLE;
+ }
+ desc.caps = (DFBSurfaceCapabilities)caps;
+
wxIDirectFBSurfacePtr snew(wxIDirectFB::Get()->CreateSurface(&desc));
if ( !snew )
return NULL;
return snew;
}
+
+bool wxIDirectFBSurface::Flip(const DFBRegion *region, int flags)
+{
+ return Check(m_ptr->Flip(m_ptr, region, (DFBSurfaceFlipFlags)flags));
+}
+
+bool wxIDirectFBSurface::FlipToFront(const DFBRegion *region)
+{
+ // Blit to the front buffer instead of exchanging front and back ones.
+ // Always doing this ensures that back and front buffer have same content
+ // and so painting to the back buffer will never lose any previous
+ // drawings:
+ return Flip(region, DSFLIP_BLIT);
+}
+
+//-----------------------------------------------------------------------------
+// wxIDirectFBDisplayLayer
+//-----------------------------------------------------------------------------
+
+wxVideoMode wxIDirectFBDisplayLayer::GetVideoMode()
+{
+ DFBDisplayLayerConfig cfg;
+ if ( !GetConfiguration(&cfg) )
+ return wxVideoMode(); // invalid
+
+ if ( !((cfg.flags & DLCONF_WIDTH) &&
+ (cfg.flags & DLCONF_HEIGHT) &&
+ (cfg.flags & DLCONF_PIXELFORMAT)) )
+ return wxVideoMode(); // invalid
+
+ return wxVideoMode
+ (
+ cfg.width,
+ cfg.height,
+ DFB_BITS_PER_PIXEL(cfg.pixelformat)
+ );
+}