X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5b31f4e11c860fa5d9949c8694a7499793c3b98..576bdf856573db9e0b8f614d9bf0cbf80e2b001e:/src/dfb/wrapdfb.cpp diff --git a/src/dfb/wrapdfb.cpp b/src/dfb/wrapdfb.cpp index 873f040cde..afd6ee064b 100644 --- a/src/dfb/wrapdfb.cpp +++ b/src/dfb/wrapdfb.cpp @@ -116,7 +116,8 @@ int wxIDirectFBSurface::GetDepth() 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 ) @@ -135,6 +136,17 @@ wxIDirectFBSurfacePtr wxIDirectFBSurface::CreateCompatible(const wxSize& sz) 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; @@ -166,3 +178,17 @@ wxIDirectFBSurfacePtr wxIDirectFBSurface::Clone() 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); +}