X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a624f6ed375e4dbf126743ff1068486cb5241a2..85f622694cf6024a6a2108b134249468770a530d:/src/dfb/dc.cpp diff --git a/src/dfb/dc.cpp b/src/dfb/dc.cpp index 16257ca195..c4006994df 100644 --- a/src/dfb/dc.cpp +++ b/src/dfb/dc.cpp @@ -95,10 +95,19 @@ void wxDFBDCImpl::DoSetClippingRegion(wxCoord cx, wxCoord cy, wxCoord cw, wxCoor m_clipping = true; } -void wxDFBDCImpl::DoSetClippingRegionAsRegion(const wxRegion& region) +void wxDFBDCImpl::DoSetDeviceClippingRegion(const wxRegion& region) { // NB: this can be done because wxDFB only supports rectangular regions - GetOwner()->SetClippingRegion(region.AsRect()); + wxRect rect = region.AsRect(); + + // our parameter is in physical coordinates while DoSetClippingRegion() + // takes logical ones + rect.x = XDEV2LOG(rect.x); + rect.y = YDEV2LOG(rect.y); + rect.width = XDEV2LOG(rect.width); + rect.height = YDEV2LOG(rect.height); + + DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } void wxDFBDCImpl::DestroyClippingRegion() @@ -139,10 +148,10 @@ void wxDFBDCImpl::Clear() } extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y, - const wxColour & col, int style); + const wxColour & col, wxFloodFillStyle style); bool wxDFBDCImpl::DoFloodFill(wxCoord x, wxCoord y, - const wxColour& col, int style) + const wxColour& col, wxFloodFillStyle style) { return wxDoFloodFill(GetOwner(), x, y, col, style); } @@ -232,7 +241,7 @@ void wxDFBDCImpl::DoDrawPoint(wxCoord x, wxCoord y) void wxDFBDCImpl::DoDrawPolygon(int WXUNUSED(n), wxPoint WXUNUSED(points)[], wxCoord WXUNUSED(xoffset), wxCoord WXUNUSED(yoffset), - int WXUNUSED(fillStyle)) + wxPolygonFillMode WXUNUSED(fillStyle)) { wxCHECK_RET( IsOk(), wxT("invalid dc") ); @@ -337,7 +346,7 @@ void wxDFBDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) // if background mode is solid, DrawText must paint text's background: if ( m_backgroundMode == wxSOLID ) { - wxCHECK_RET( m_textBackgroundColour.Ok(), + wxCHECK_RET( m_textBackgroundColour.IsOk(), wxT("invalid background color") ); SelectColour(m_textBackgroundColour); @@ -345,7 +354,7 @@ void wxDFBDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) } // finally draw the text itself: - wxCHECK_RET( m_textForegroundColour.Ok(), + wxCHECK_RET( m_textForegroundColour.IsOk(), wxT("invalid foreground color") ); SelectColour(m_textForegroundColour); m_surface->DrawString(text.utf8_str(), -1, xx, yy, DSTF_LEFT | DSTF_TOP); @@ -370,14 +379,14 @@ void wxDFBDCImpl::DoDrawRotatedText(const wxString& WXUNUSED(text), void wxDFBDCImpl::SetPen(const wxPen& pen) { - m_pen = pen.Ok() ? pen : DEFAULT_PEN; + m_pen = pen.IsOk() ? pen : DEFAULT_PEN; SelectColour(m_pen.GetColour()); } void wxDFBDCImpl::SetBrush(const wxBrush& brush) { - m_brush = brush.Ok() ? brush : DEFAULT_BRUSH; + m_brush = brush.IsOk() ? brush : DEFAULT_BRUSH; } void wxDFBDCImpl::SelectColour(const wxColour& clr) @@ -399,7 +408,7 @@ void wxDFBDCImpl::SetFont(const wxFont& font) { wxCHECK_RET( IsOk(), wxT("invalid dc") ); - wxFont f(font.Ok() ? font : DEFAULT_FONT); + wxFont f(font.IsOk() ? font : DEFAULT_FONT); wxFont oldfont(m_font); @@ -422,7 +431,7 @@ void wxDFBDCImpl::SetBackground(const wxBrush& brush) { wxCHECK_RET( IsOk(), wxT("invalid dc") ); - if (!brush.Ok()) return; + if (!brush.IsOk()) return; m_backgroundBrush = brush; } @@ -432,7 +441,7 @@ void wxDFBDCImpl::SetBackgroundMode(int mode) m_backgroundMode = mode; } -void wxDFBDCImpl::SetLogicalFunction(int function) +void wxDFBDCImpl::SetLogicalFunction(wxRasterOperationMode function) { wxCHECK_RET( IsOk(), wxT("invalid dc") ); @@ -469,7 +478,7 @@ void wxDFBDCImpl::EndPage() wxCoord wxDFBDCImpl::GetCharHeight() const { wxCHECK_MSG( IsOk(), -1, wxT("invalid dc") ); - wxCHECK_MSG( m_font.Ok(), -1, wxT("no font selected") ); + wxCHECK_MSG( m_font.IsOk(), -1, wxT("no font selected") ); int h = -1; GetCurrentFont()->GetHeight(&h); @@ -479,7 +488,7 @@ wxCoord wxDFBDCImpl::GetCharHeight() const wxCoord wxDFBDCImpl::GetCharWidth() const { wxCHECK_MSG( IsOk(), -1, wxT("invalid dc") ); - wxCHECK_MSG( m_font.Ok(), -1, wxT("no font selected") ); + wxCHECK_MSG( m_font.IsOk(), -1, wxT("no font selected") ); int w = -1; GetCurrentFont()->GetStringWidth("H", 1, &w); @@ -493,8 +502,8 @@ void wxDFBDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y const wxFont *theFont) const { wxCHECK_RET( IsOk(), wxT("invalid dc") ); - wxCHECK_RET( m_font.Ok(), wxT("no font selected") ); - wxCHECK_RET( !theFont || theFont->Ok(), wxT("invalid font") ); + wxCHECK_RET( m_font.IsOk(), wxT("no font selected") ); + wxCHECK_RET( !theFont || theFont->IsOk(), wxT("invalid font") ); wxFont oldFont; if ( theFont != NULL ) @@ -574,7 +583,7 @@ wxSize wxDFBDCImpl::GetPPI() const bool wxDFBDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop, bool useMask, + wxRasterOperationMode rop, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask) { wxCHECK_MSG( IsOk(), false, "invalid dc" ); @@ -631,7 +640,7 @@ bool wxDFBDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, void wxDFBDCImpl::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask) { wxCHECK_RET( IsOk(), wxT("invalid dc") ); - wxCHECK_RET( bmp.Ok(), wxT("invalid bitmap") ); + wxCHECK_RET( bmp.IsOk(), wxT("invalid bitmap") ); DoDrawSubBitmap(bmp, 0, 0, bmp.GetWidth(), bmp.GetHeight(), @@ -650,7 +659,7 @@ void wxDFBDCImpl::DoDrawSubBitmap(const wxBitmap &bmp, wxCoord destx, wxCoord desty, int rop, bool useMask) { wxCHECK_RET( IsOk(), wxT("invalid dc") ); - wxCHECK_RET( bmp.Ok(), wxT("invalid bitmap") ); + wxCHECK_RET( bmp.IsOk(), wxT("invalid bitmap") ); // NB: we could also support XOR here (via DSBLIT_XOR) // and possibly others via SetSrc/DstBlendFunction() @@ -666,9 +675,7 @@ void wxDFBDCImpl::DoDrawSubBitmap(const wxBitmap &bmp, if ( useMask && bmp.GetMask() ) { - // FIXME_DFB: see MGL sources for a way to do it, but it's not directly - // applicable because DirectFB doesn't implement ROPs; OTOH, - // it has blitting modes that can be useful; finally, see + // FIXME_DFB: Could use blitting modes for this; also see // DFB's SetSrcBlendFunction() and SetSrcColorKey() wxFAIL_MSG( "drawing bitmaps with masks not implemented" ); return;