]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dcclient.cpp
Updated version to 2.3.2 so apps can test for differences in new merged source
[wxWidgets.git] / src / gtk / dcclient.cpp
index f283c9b53a0fe902eb0a0a718d2ffeddb66fc08e..8a507fb23addc90696283a0a75cd8edf17801511 100644 (file)
@@ -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,12 @@ 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 )
 {
    /* this is the nth try to get this utterly useless function to
       work. it now completely ignores the scaling or translation
@@ -1100,6 +1103,12 @@ 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;
 
@@ -1206,7 +1215,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 +2078,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 +2102,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