X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b3c861501a451503b31c075ccb59d16b0ae01e99..4a9eae369e6f1908be8c757cb82e022171dff03d:/src/dfb/utils.cpp diff --git a/src/dfb/utils.cpp b/src/dfb/utils.cpp index e9e8d8ebbe..87700dbbb9 100644 --- a/src/dfb/utils.cpp +++ b/src/dfb/utils.cpp @@ -83,78 +83,6 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) wxDisplaySize(width, height); } -//----------------------------------------------------------------------------- -// surface manipulation helpers -//----------------------------------------------------------------------------- - -IDirectFBSurfacePtr wxDfbCloneSurface(const IDirectFBSurfacePtr& s, - wxDfbCloneSurfaceMode mode) -{ - if ( !s ) - return NULL; - - DFBSurfaceDescription desc; - desc.flags = (DFBSurfaceDescriptionFlags)( - DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT); - s->GetCapabilities(s, &desc.caps); - s->GetSize(s, &desc.width, &desc.height); - s->GetPixelFormat(s, &desc.pixelformat); - - IDirectFBPtr dfb(wxTheApp->GetDirectFBInterface()); - - IDirectFBSurfacePtr snew; - if ( !DFB_CALL( dfb->CreateSurface(dfb, &desc, &snew) ) ) - return NULL; - - IDirectFBPalettePtr pal; - if ( s->GetPalette(s, &pal) == DFB_OK ) - { - if ( !DFB_CALL( snew->SetPalette(snew, pal) ) ) - return NULL; - } - - if ( mode == wxDfbCloneSurface_CopyPixels ) - { - if ( !DFB_CALL( snew->SetBlittingFlags(snew, DSBLIT_NOFX) ) ) - return NULL; - if ( !DFB_CALL( snew->Blit(snew, s, NULL, 0, 0) ) ) - return NULL; - } - - return snew; -} - -int wxDfbGetSurfaceDepth(const IDirectFBSurfacePtr& s) -{ - wxCHECK_MSG( s, -1, _T("invalid surface") ); - - DFBSurfacePixelFormat format = DSPF_UNKNOWN; - - if ( !DFB_CALL( s->GetPixelFormat(s, &format) ) ) - return -1; - - return DFB_BITS_PER_PIXEL(format); -} - -IDirectFBDisplayLayerPtr wxDfbGetDisplayLayer() -{ - IDirectFBPtr dfb(wxTheApp->GetDirectFBInterface()); - - IDirectFBDisplayLayerPtr layer; - if ( !DFB_CALL( dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer) ) ) - return NULL; - - return layer; -} - -IDirectFBSurfacePtr wxDfbGetPrimarySurface() -{ - IDirectFBDisplayLayerPtr layer(wxDfbGetDisplayLayer()); - IDirectFBSurfacePtr surface; - DFB_CALL( layer->GetSurface(layer, &surface) ); - return surface; -} - //----------------------------------------------------------------------------- // mouse @@ -162,8 +90,9 @@ IDirectFBSurfacePtr wxDfbGetPrimarySurface() void wxGetMousePosition(int *x, int *y) { - IDirectFBDisplayLayerPtr layer(wxDfbGetDisplayLayer()); - DFB_CALL( layer->GetCursorPosition(layer, x, y) ); + wxIDirectFBDisplayLayerPtr layer(wxIDirectFB::Get()->GetDisplayLayer()); + if ( layer ) + layer->GetCursorPosition(x, y); } wxPoint wxGetMousePosition()