X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/44856297325729dec296be659fa40ba003d2a64f..b142515e79888988bf22c532c8c0da175fb59aca:/src/gtk1/dcclient.cpp diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index f283c9b53a..f318b34c92 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -54,7 +54,7 @@ static GdkPixmap *hatches[num_hatches]; static GdkPixmap **hatch_bitmap = (GdkPixmap **) NULL; -extern GtkWidget *wxRootWindow; +extern GtkWidget *wxGetRootWindow(); //----------------------------------------------------------------------------- // constants @@ -77,15 +77,15 @@ static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } #include "gdk/gdkprivate.h" -void gdk_wx_draw_bitmap (GdkDrawable *drawable, - GdkGC *gc, - GdkDrawable *src, - gint xsrc, - gint ysrc, - gint xdest, - gint ydest, - gint width, - gint height) +void gdk_wx_draw_bitmap(GdkDrawable *drawable, + GdkGC *gc, + GdkDrawable *src, + gint xsrc, + gint ysrc, + gint xdest, + gint ydest, + gint width, + gint height) { gint src_width, src_height; #ifndef __WXGTK20__ @@ -415,7 +415,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const memdc.SelectObject(bitmap); memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1); memdc.SelectObject(wxNullBitmap); - + wxImage image(bitmap); col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0)); return TRUE; @@ -1021,7 +1021,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, if (!m_currentClippingRegion.IsNull()) { GdkColor col; - new_mask = gdk_pixmap_new( wxRootWindow->window, ww, hh, 1 ); + new_mask = gdk_pixmap_new( wxGetRootWindow()->window, ww, hh, 1 ); GdkGC *gc = gdk_gc_new( new_mask ); col.pixel = 0; gdk_gc_set_foreground( gc, &col ); @@ -1085,9 +1085,13 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, } } -bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int logical_func, bool useMask ) +bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, + wxCoord xsrc, wxCoord ysrc, + int logical_func, + bool useMask, + wxCoord xsrcMask, wxCoord ysrcMask ) { /* this is the nth try to get this utterly useless function to work. it now completely ignores the scaling or translation @@ -1100,12 +1104,24 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he if (!m_window) return FALSE; +#if 0 + // transform the source DC coords to the device ones + xsrc = XLOG2DEV(xsrc); + ysrc = YLOG2DEV(ysrc); +#endif + wxClientDC *srcDC = (wxClientDC*)source; wxMemoryDC *memDC = (wxMemoryDC*)source; bool use_bitmap_method = FALSE; bool is_mono = FALSE; + /* TODO: use the mask origin when drawing transparently */ + if (xsrcMask == -1 && ysrcMask == -1) + { + xsrcMask = xsrc; ysrcMask = ysrc; + } + if (srcDC->m_isMemDC) { if (!memDC->m_selected.Ok()) return FALSE; @@ -1206,7 +1222,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he if (!m_currentClippingRegion.IsNull()) { GdkColor col; - new_mask = gdk_pixmap_new( wxRootWindow->window, bm_ww, bm_hh, 1 ); + new_mask = gdk_pixmap_new( wxGetRootWindow()->window, bm_ww, bm_hh, 1 ); GdkGC *gc = gdk_gc_new( new_mask ); col.pixel = 0; gdk_gc_set_foreground( gc, &col ); @@ -2069,14 +2085,19 @@ wxPaintDC::wxPaintDC( wxWindow *win ) GdkRegion *region = m_paintClippingRegion.GetRegion(); if ( region ) { - m_currentClippingRegion.Union( m_paintClippingRegion ); + m_paintClippingRegion = win->GetUpdateRegion(); + GdkRegion *region = m_paintClippingRegion.GetRegion(); + if ( region ) + { + m_currentClippingRegion.Union( m_paintClippingRegion ); - gdk_gc_set_clip_region( m_penGC, region ); - gdk_gc_set_clip_region( m_brushGC, region ); - gdk_gc_set_clip_region( m_textGC, region ); - gdk_gc_set_clip_region( m_bgGC, region ); + gdk_gc_set_clip_region( m_penGC, region ); + gdk_gc_set_clip_region( m_brushGC, region ); + gdk_gc_set_clip_region( m_textGC, region ); + gdk_gc_set_clip_region( m_bgGC, region ); + } } -#endif +#endif // USE_PAINT_REGION } //----------------------------------------------------------------------------- @@ -2088,6 +2109,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC) wxClientDC::wxClientDC( wxWindow *win ) : wxWindowDC( win ) { + wxCHECK_RET( win, _T("NULL window in wxClientDC::wxClientDC") ); + +#ifdef __WXUNIVERSAL__ + wxPoint ptOrigin = win->GetClientAreaOrigin(); + SetDeviceOrigin(ptOrigin.x, ptOrigin.y); + wxSize size = win->GetClientSize(); + SetClippingRegion(wxPoint(0, 0), size); +#endif // __WXUNIVERSAL__ } void wxClientDC::DoGetSize(int *width, int *height) const