X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea280776839d06d0e8076e79336319d45e276f4e..3087eaea04bb4f8fe6aef1c649fe86fa1691894a:/src/dfb/dc.cpp?ds=sidebyside diff --git a/src/dfb/dc.cpp b/src/dfb/dc.cpp index 6df3838932..8093bec3d2 100644 --- a/src/dfb/dc.cpp +++ b/src/dfb/dc.cpp @@ -25,6 +25,7 @@ #ifndef WX_PRECOMP #include "wx/dc.h" + #include "wx/dcmemory.h" #include "wx/log.h" #endif @@ -53,10 +54,10 @@ wxDC::wxDC() wxDC::wxDC(const wxIDirectFBSurfacePtr& surface) { - Init(surface); + DFBInit(surface); } -void wxDC::Init(const wxIDirectFBSurfacePtr& surface) +void wxDC::DFBInit(const wxIDirectFBSurfacePtr& surface) { m_ok = (surface != NULL); wxCHECK_RET( surface != NULL, _T("invalid surface") ); @@ -181,9 +182,9 @@ void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) return; wxCoord xx1 = XLOG2DEV(x1); - wxCoord yy1 = XLOG2DEV(y1); + wxCoord yy1 = YLOG2DEV(y1); wxCoord xx2 = XLOG2DEV(x2); - wxCoord yy2 = XLOG2DEV(y2); + wxCoord yy2 = YLOG2DEV(y2); // FIXME: DrawLine() shouldn't draw the last pixel, but DFB's DrawLine() // does draw it. We should undo any change to the last pixel by @@ -390,10 +391,21 @@ void wxDC::SetFont(const wxFont& font) wxFont f(font.Ok() ? font : DEFAULT_FONT); - if ( !m_surface->SetFont(f.GetDirectFBFont()) ) - return; + wxFont oldfont(m_font); m_font = f; + + if ( !m_surface->SetFont(GetCurrentFont()) ) + { + m_font = oldfont; + return; + } +} + +wxIDirectFBFontPtr wxDC::GetCurrentFont() const +{ + bool aa = (GetDepth() > 8); + return m_font.GetDirectFBFont(aa); } void wxDC::SetBackground(const wxBrush& brush) @@ -450,7 +462,7 @@ wxCoord wxDC::GetCharHeight() const wxCHECK_MSG( m_font.Ok(), -1, wxT("no font selected") ); int h = -1; - m_font.GetDirectFBFont()->GetHeight(&h); + GetCurrentFont()->GetHeight(&h); return YDEV2LOGREL(h); } @@ -460,7 +472,7 @@ wxCoord wxDC::GetCharWidth() const wxCHECK_MSG( m_font.Ok(), -1, wxT("no font selected") ); int w = -1; - m_font.GetDirectFBFont()->GetStringWidth("H", 1, &w); + GetCurrentFont()->GetStringWidth("H", 1, &w); // VS: YDEV is corrent, it should *not* be XDEV, because font's are only // scaled according to m_scaleY return YDEV2LOGREL(w); @@ -483,7 +495,7 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord xx = 0, yy = 0; DFBRectangle rect; - wxIDirectFBFontPtr f = m_font.GetDirectFBFont(); + wxIDirectFBFontPtr f = GetCurrentFont(); if ( f->GetStringExtents(wxSTR_TO_DFB(string), -1, &rect, NULL) ) {