From 3dcc2231fabc5c9ea718ae90d13fbc8dd70c3489 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 21 Sep 2006 12:56:28 +0000 Subject: [PATCH] fixed DrawText to use text colours instead of pen+brush colours git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/dfb/dc.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/dfb/dc.cpp b/src/dfb/dc.cpp index f5fac4bcc0..cf11ae7aaa 100644 --- a/src/dfb/dc.cpp +++ b/src/dfb/dc.cpp @@ -259,7 +259,8 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { SelectColour(m_brush.GetColour()); m_surface->FillRectangle(xx, yy, ww, hh); - // restore pen's colour + // restore pen's colour, because other drawing functions expect the + // colour to be set to the pen: SelectColour(m_pen.GetColour()); } @@ -309,16 +310,22 @@ void wxDC::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_backgroundBrush.Ok(), wxT("invalid background brush") ); + wxCHECK_RET( m_textBackgroundColour.Ok(), + wxT("invalid background color") ); - SelectColour(m_backgroundBrush.GetColour()); + SelectColour(m_textBackgroundColour); m_surface->FillRectangle(xx, yy, XLOG2DEVREL(w), YLOG2DEVREL(h)); - // restore pen's colour - SelectColour(m_pen.GetColour()); } // finally draw the text itself: + wxCHECK_RET( m_textForegroundColour.Ok(), + wxT("invalid foreground color") ); + SelectColour(m_textForegroundColour); m_surface->DrawString(wxSTR_TO_DFB(text), -1, xx, yy, DSTF_LEFT | DSTF_TOP); + + // restore pen's colour, because other drawing functions expect the colour + // to be set to the pen: + SelectColour(m_pen.GetColour()); } void wxDC::DoDrawRotatedText(const wxString& text, -- 2.45.2