]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dcclient.cpp
Patch from Andre Reitz to correct a couple of bugs
[wxWidgets.git] / src / gtk1 / dcclient.cpp
index 5eb1d99388d6893e8290b17599411f3cf16b1f55..626d46cf44c10e25b8049d4e6b0988960daa8154 100644 (file)
@@ -143,8 +143,6 @@ void gdk_wx_draw_bitmap(GdkDrawable  *drawable,
 // Implement Pool of Graphic contexts. Creating them takes too much time.
 //-----------------------------------------------------------------------------
 
-#define GC_POOL_SIZE 200
-
 enum wxPoolGCType
 {
    wxGC_ERROR = 0,
@@ -1156,7 +1154,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
     else
     {
 #if GTK_CHECK_VERSION(2,2,0)
-        if (use_bitmap.HasPixbuf())
+        if (!gtk_check_version(2,2,0) && use_bitmap.HasPixbuf())
         {
             gdk_draw_pixbuf(m_window, m_penGC,
                             use_bitmap.GetPixbuf(),
@@ -1219,7 +1217,6 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
     bool use_bitmap_method = false;
     bool is_mono = false;
 
-    // TODO: use the mask origin when drawing transparently
     if (xsrcMask == -1 && ysrcMask == -1)
     {
         xsrcMask = xsrc;
@@ -1349,6 +1346,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
                 GdkGC *gc = gdk_gc_new( new_mask );
                 col.pixel = 0;
                 gdk_gc_set_foreground( gc, &col );
+                gdk_gc_set_ts_origin( gc, -xsrcMask, -ysrcMask);
                 gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh );
                 col.pixel = 0;
                 gdk_gc_set_background( gc, &col );
@@ -1366,20 +1364,28 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
             if (is_mono)
             {
                 if (new_mask)
+                {
                     gdk_gc_set_clip_mask( m_textGC, new_mask );
+                    gdk_gc_set_clip_origin( m_textGC, cx, cy );
+                }
                 else
+                {
                     gdk_gc_set_clip_mask( m_textGC, mask );
-                // was: gdk_gc_set_clip_origin( m_textGC, xx, yy );
-                gdk_gc_set_clip_origin( m_textGC, cx, cy );
+                    gdk_gc_set_clip_origin( m_textGC, cx-xsrcMask, cy-ysrcMask );
+                }                                
             }
             else
             {
                 if (new_mask)
+                {
                     gdk_gc_set_clip_mask( m_penGC, new_mask );
+                    gdk_gc_set_clip_origin( m_penGC, cx, cy );
+                }
                 else
+                {
                     gdk_gc_set_clip_mask( m_penGC, mask );
-                // was: gdk_gc_set_clip_origin( m_penGC, xx, yy );
-                gdk_gc_set_clip_origin( m_penGC, cx, cy );
+                    gdk_gc_set_clip_origin( m_penGC, cx-xsrcMask, cy-ysrcMask );
+                }                
             }
         }