]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dcclient.cpp
fixed memory leaks
[wxWidgets.git] / src / gtk / dcclient.cpp
index 5b39956468b3cb5d1fb802fc324188f63e574cb1..8cfd94e8370462d084f1e29d0ffbcf9cbc61797e 100644 (file)
@@ -339,8 +339,16 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoor
         CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset );
     }
 
-    if ((m_brush.GetStyle() != wxTRANSPARENT) && m_window)
-        gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+    if (m_window)
+       {
+               if      ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))            
+               gdk_draw_polygon (m_window, m_textGC, TRUE, gdkpoints, n);
+               else
+               { 
+                       if ((m_brush.GetStyle() != wxTRANSPARENT))
+                       gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+               }               
+       }
 
     // To do: Fillstyle
 
@@ -377,11 +385,19 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
 
     if (m_window)
     {
-        if (m_brush.GetStyle() != wxTRANSPARENT)
-            gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
-
-        if (m_pen.GetStyle() != wxTRANSPARENT)
-            gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
+         if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
+         {
+             gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy, ww, hh );
+                gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
+         }
+         else
+         {
+       if (m_brush.GetStyle() != wxTRANSPARENT)
+             gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
+
+       if (m_pen.GetStyle() != wxTRANSPARENT)
+             gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
+         }
     }
 
     CalcBoundingBox( x, y );
@@ -1083,6 +1099,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
         }
 
         case wxTRANSPARENT:
+               case wxSTIPPLE_MASK_OPAQUE:
         case wxSTIPPLE:
         case wxSOLID:
         default:
@@ -1116,17 +1133,31 @@ void wxWindowDC::SetPen( const wxPen &pen )
     GdkCapStyle capStyle = GDK_CAP_ROUND;
     switch (m_pen.GetCap())
     {
-        case wxCAP_ROUND:      { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; }
         case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; }
         case wxCAP_BUTT:       { capStyle = GDK_CAP_BUTT;       break; }
+        case wxCAP_ROUND:
+        default:
+        { 
+            if (width <= 1)
+            {
+                width = 0;
+                capStyle = GDK_CAP_NOT_LAST;
+            }
+            else
+            {
+                capStyle = GDK_CAP_ROUND;
+            }
+            break; 
+        }
     }
 
     GdkJoinStyle joinStyle = GDK_JOIN_ROUND;
     switch (m_pen.GetJoin())
     {
         case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; }
-        case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; }
         case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; }
+        case wxJOIN_ROUND:
+        default:           { joinStyle = GDK_JOIN_ROUND; break; }
     }
 
     gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );
@@ -1166,6 +1197,12 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
         }
     }
 
+    if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
+    {
+            gdk_gc_set_fill( m_textGC, GDK_OPAQUE_STIPPLED);
+            gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() );
+    }
+
     if (IS_HATCH(m_brush.GetStyle()))
     {
         gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
@@ -1236,9 +1273,7 @@ void wxWindowDC::SetLogicalFunction( int function )
         case wxCLEAR:        mode = GDK_CLEAR;         break;
         case wxSET:          mode = GDK_SET;           break;
         case wxOR_INVERT:    mode = GDK_OR_INVERT;     break;
-        case wxSRC_AND:
         case wxAND:          mode = GDK_AND;           break;
-        case wxSRC_OR:
         case wxOR:           mode = GDK_OR;            break;
         case wxEQUIV:        mode = GDK_EQUIV;         break;
         case wxNAND:         mode = GDK_NAND;          break;
@@ -1246,6 +1281,13 @@ void wxWindowDC::SetLogicalFunction( int function )
         case wxCOPY:         mode = GDK_COPY;          break;
         case wxNO_OP:        mode = GDK_NOOP;          break;
         case wxSRC_INVERT:   mode = GDK_COPY_INVERT;   break;
+        
+        // unsupported by GTK
+        case wxNOR:          mode = GDK_COPY;          break;
+
+        // these are actually ternary ROPs
+        case wxSRC_AND:      mode = GDK_AND;           break;
+        case wxSRC_OR:       mode = GDK_OR;            break;
 #endif
         default:
         {