]> git.saurik.com Git - wxWidgets.git/commitdiff
Line drawing correction.
authorRobert Roebling <robert@roebling.de>
Sat, 29 Jan 2000 16:50:15 +0000 (16:50 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 29 Jan 2000 16:50:15 +0000 (16:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/drawing/drawing.cpp
src/gtk/dcclient.cpp
src/gtk1/dcclient.cpp

index c8d40c438b947be6b0fe114a1bc0f13e7dac6a88..701d217bdca2aae21a3ad322261ef85ecb009e49 100644 (file)
@@ -584,15 +584,20 @@ void MyCanvas::DrawDefault(wxDC& dc)
     memdc.DrawRectangle(0,0,20,70);
     memdc.DrawLine( 10,0,10,70 );
     
+    // to the right
+    memdc.SetPen(*wxRED_PEN);
     memdc.DrawLine( 10, 5,10, 5 );
     memdc.DrawLine( 10,10,11,10 );
     memdc.DrawLine( 10,15,12,15 );
     memdc.DrawLine( 10,20,13,20 );
     
+/*
+    memdc.SetPen(*wxRED_PEN);
     memdc.DrawLine( 12, 5,12, 5 );
     memdc.DrawLine( 12,10,13,10 );
     memdc.DrawLine( 12,15,14,15 );
     memdc.DrawLine( 12,20,15,20 );
+*/
     
     // same to the left
     memdc.DrawLine( 10,25,10,25 );
@@ -601,6 +606,7 @@ void MyCanvas::DrawDefault(wxDC& dc)
     memdc.DrawLine( 10,40, 7,40 );
 
     // XOR draw lines
+    dc.SetPen(*wxWHITE_PEN);
     memdc.SetLogicalFunction( wxINVERT );
     memdc.SetPen( *wxWHITE_PEN );
     memdc.DrawLine( 10,50,10,50 );
index 383dc186bd4843ff2d5e78104193e649d3b6ed9e..d061496e428580e7ee10e649b828532ac0223732 100644 (file)
@@ -1133,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 );
index 383dc186bd4843ff2d5e78104193e649d3b6ed9e..d061496e428580e7ee10e649b828532ac0223732 100644 (file)
@@ -1133,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 );