X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b666ade78496cd91d648fcfe2fd6b79ce2b15e33..d26cb76b58d53bdd667e706f12442c349ff13bc1:/src/gtk/dcclient.cpp diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 93788ede5b..0f3cd68a25 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -282,7 +282,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) : SetDeviceLocalOrigin(widget->allocation.x, widget->allocation.y); } - m_context = window->GtkGetPangoDefaultContext(); + m_context = window->GTKGetPangoDefaultContext(); m_layout = pango_layout_new( m_context ); m_fontdesc = pango_font_description_copy( widget->style->font_desc ); @@ -419,7 +419,7 @@ void wxWindowDCImpl::SetUpDC( bool isMemDC ) void wxWindowDCImpl::DoGetSize( int* width, int* height ) const { - wxCHECK_RET( m_window, _T("GetSize() doesn't work without window") ); + wxCHECK_RET( m_window, wxT("GetSize() doesn't work without window") ); m_window->GetSize(width, height); } @@ -1059,8 +1059,11 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, const int w = bitmap.GetWidth(); const int h = bitmap.GetHeight(); + // notice that as the bitmap is not drawn upside down (or right to left) + // even if the corresponding axis direction is inversed, we need to take it + // into account when calculating its bounding box CalcBoundingBox(x, y); - CalcBoundingBox(x + w, y + h); + CalcBoundingBox(x + m_signX*w, y + m_signY*h); // device coords int xx = LogicalToDeviceX(x); @@ -1335,7 +1338,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 +1348,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 +1464,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 @@ -1778,10 +1783,10 @@ wxCoord wxWindowDCImpl::GetCharWidth() const wxCoord wxWindowDCImpl::GetCharHeight() const { PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, pango_context_get_language(m_context)); - wxCHECK_MSG( metrics, -1, _T("failed to get pango font metrics") ); + wxCHECK_MSG( metrics, -1, wxT("failed to get pango font metrics") ); wxCoord h = PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + - pango_font_metrics_get_ascent (metrics)); + pango_font_metrics_get_ascent (metrics)); pango_font_metrics_unref (metrics); return h; } @@ -1813,7 +1818,7 @@ void wxWindowDCImpl::SetFont( const wxFont &font ) { PangoContext *oldContext = m_context; - m_context = m_window->GtkGetPangoDefaultContext(); + m_context = m_window->GTKGetPangoDefaultContext(); // If we switch back/forth between different contexts // we also have to create a new layout. I think so, @@ -2081,6 +2086,9 @@ void wxWindowDCImpl::SetLogicalFunction( wxRasterOperationMode function ) case wxNO_OP: mode = GDK_NOOP; break; case wxSRC_INVERT: mode = GDK_COPY_INVERT; break; case wxNOR: mode = GDK_NOR; break; + default: + wxFAIL_MSG("unknown mode"); + return; } m_logicalFunction = function; @@ -2296,7 +2304,7 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner ) wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *win ) : wxWindowDCImpl( owner, win ) { - wxCHECK_RET( win, _T("NULL window in wxClientDCImpl::wxClientDC") ); + wxCHECK_RET( win, wxT("NULL window in wxClientDCImpl::wxClientDC") ); #ifdef __WXUNIVERSAL__ wxPoint ptOrigin = win->GetClientAreaOrigin(); @@ -2309,7 +2317,7 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *win ) void wxClientDCImpl::DoGetSize(int *width, int *height) const { - wxCHECK_RET( m_window, _T("GetSize() doesn't work without window") ); + wxCHECK_RET( m_window, wxT("GetSize() doesn't work without window") ); m_window->GetClientSize( width, height ); }