]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dcclient.cpp
wxFrame size bug
[wxWidgets.git] / src / gtk1 / dcclient.cpp
index af85da16da84275a217cc2273413dba05c657b05..452f2bde090ed72703f1084b73550dd91915f785 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "wx/dcclient.h"
 #include "wx/dcmemory.h"
+#include <math.h>
 
 //-----------------------------------------------------------------------------
 // local data
@@ -531,7 +532,7 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
        wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask )
 {
     if (!Ok()) return FALSE;
-  
+    
     CalcBoundingBox( xdest, ydest );
     CalcBoundingBox( xdest + width, ydest + height );
     
@@ -540,7 +541,39 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
     if (csrc->m_isMemDC)
     {
         wxMemoryDC* srcDC = (wxMemoryDC*)source;
-        GdkPixmap* bmap = srcDC->m_selected.GetPixmap();
+        GdkPixmap* pmap = srcDC->m_selected.GetPixmap();
+        if (pmap)
+        {
+            long xx = XLOG2DEV(xdest);
+            long yy = YLOG2DEV(ydest);
+    
+            GdkBitmap *mask = (GdkBitmap *) NULL;
+            if (srcDC->m_selected.GetMask()) mask = srcDC->m_selected.GetMask()->GetBitmap();
+    
+            if (useMask && mask) 
+            {
+                gdk_gc_set_clip_mask( m_textGC, mask );
+                gdk_gc_set_clip_origin( m_textGC, xx, yy );
+            }
+  
+            gdk_draw_pixmap( m_window, m_textGC, pmap,
+                             source->DeviceToLogicalX(xsrc), 
+                            source->DeviceToLogicalY(ysrc),
+                             xx, 
+                            yy,
+                             source->DeviceToLogicalXRel(width), 
+                            source->DeviceToLogicalYRel(height) );
+         
+            if (useMask && mask) 
+            {
+                gdk_gc_set_clip_mask( m_textGC, (GdkBitmap *) NULL );
+                gdk_gc_set_clip_origin( m_textGC, 0, 0 );
+            }
+      
+            return TRUE;
+        }
+       
+        GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
         if (bmap)
         {
             long xx = XLOG2DEV(xdest);
@@ -551,11 +584,11 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
     
             if (useMask && mask) 
             {
-                gdk_gc_set_clip_mask( m_penGC, mask );
-                gdk_gc_set_clip_origin( m_penGC, xx, yy );
+                gdk_gc_set_clip_mask( m_textGC, mask );
+                gdk_gc_set_clip_origin( m_textGC, xx, yy );
             }
   
-            gdk_draw_pixmap( m_window, m_penGC, bmap,
+            gdk_draw_bitmap( m_window, m_textGC, bmap,
                              source->DeviceToLogicalX(xsrc), 
                             source->DeviceToLogicalY(ysrc),
                              xx, 
@@ -565,15 +598,15 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
          
             if (useMask && mask) 
             {
-                gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
-                gdk_gc_set_clip_origin( m_penGC, 0, 0 );
+                gdk_gc_set_clip_mask( m_textGC, (GdkBitmap *) NULL );
+                gdk_gc_set_clip_origin( m_textGC, 0, 0 );
             }
       
             return TRUE;
         }
     }
 
-    gdk_window_copy_area ( m_window, m_penGC,
+    gdk_window_copy_area ( m_window, m_textGC,
                            XLOG2DEV(xdest), YLOG2DEV(ydest),
                            csrc->GetWindow(),
                            source->DeviceToLogicalX(xsrc), 
@@ -582,7 +615,7 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
                           source->DeviceToLogicalYRel(height) );
 
 /*    
-    gdk_window_copy_area ( m_window, m_penGC,
+    gdk_window_copy_area ( m_window, m_textGC,
                            XLOG2DEV(xdest), YLOG2DEV(ydest),
                            csrc->GetWindow(),
                            xsrc, ysrc,
@@ -835,6 +868,7 @@ void wxPaintDC::SetLogicalFunction( int function )
     m_logicalFunction = function;
     gdk_gc_set_function( m_penGC, mode );
     gdk_gc_set_function( m_brushGC, mode );
+    gdk_gc_set_function( m_textGC, mode );
 }
 
 void wxPaintDC::SetTextForeground( const wxColour &col )