From 2dcf60dab4d60daeeb59b54d96e67006c75f25a8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 3 Feb 2010 21:07:32 +0000 Subject: [PATCH] Correct bounding box calculation in wxGTK wxDC::DrawText(). Physical coordinates were incorrectly used to update the bounding box instead of the logical ones. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/dcclient.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 2ab02fcdaa..4b4b7fbf11 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1335,7 +1335,9 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, return true; } -void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) +void wxWindowDCImpl::DoDrawText(const wxString& text, + wxCoord xLogical, + wxCoord yLogical) { wxCHECK_RET( IsOk(), wxT("invalid window dc") ); @@ -1343,8 +1345,8 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) if (text.empty()) return; - x = XLOG2DEV(x); - y = YLOG2DEV(y); + wxCoord x = XLOG2DEV(xLogical), + y = YLOG2DEV(yLogical); wxCHECK_RET( m_context, wxT("no Pango context") ); wxCHECK_RET( m_layout, wxT("no Pango layout") ); @@ -1459,8 +1461,8 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) pango_layout_set_attributes(m_layout, NULL); } - CalcBoundingBox(x + int(w / m_scaleX), y + int(h / m_scaleY)); - CalcBoundingBox(x, y); + CalcBoundingBox(xLogical + int(w / m_scaleX), yLogical + int(h / m_scaleY)); + CalcBoundingBox(xLogical, yLogical); } // TODO: When GTK2.6 is required, merge DoDrawText and DoDrawRotatedText to -- 2.47.2