]> Pileus Git - ~andy/gtk/commitdiff
Use Polygon() for outlined polygons, too. Same idea as in
authorTor Lillqvist <tml@novell.com>
Sat, 11 Mar 2006 20:34:37 +0000 (20:34 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sat, 11 Mar 2006 20:34:37 +0000 (20:34 +0000)
2006-03-11  Tor Lillqvist  <tml@novell.com>

* gdk/win32/gdkdrawable-win32.c (draw_polygon): Use Polygon() for
outlined polygons, too. Same idea as in draw_rectangle(): Set pen
to NULL_PEN if drawing a filled polygon, set brush to HOLLOW_BRUSH
if drawing a polygon outline. (#332662)
(gdk_win32_draw_polygon): Corresponding simplification: no need to
add an extra final copy of the starting point.

ChangeLog
ChangeLog.pre-2-10
gdk/win32/gdkdrawable-win32.c

index eab550ed8c5491d480cc4342b620dd9b2a9d3ac1..c5d598f4720e25161be09288f71c19f06dba2069 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-03-11  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkdrawable-win32.c (draw_polygon): Use Polygon() for
+       outlined polygons, too. Same idea as in draw_rectangle(): Set pen
+       to NULL_PEN if drawing a filled polygon, set brush to HOLLOW_BRUSH
+       if drawing a polygon outline. (#332662)
+       (gdk_win32_draw_polygon): Corresponding simplification: no need to
+       add an extra final copy of the starting point.
+
 2006-03-11  Dom Lachowicz <cinamod@hotmail.com>
 
        * modules/engines/ms-windows: Speed up the Windows theme
index eab550ed8c5491d480cc4342b620dd9b2a9d3ac1..c5d598f4720e25161be09288f71c19f06dba2069 100644 (file)
@@ -1,3 +1,12 @@
+2006-03-11  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkdrawable-win32.c (draw_polygon): Use Polygon() for
+       outlined polygons, too. Same idea as in draw_rectangle(): Set pen
+       to NULL_PEN if drawing a filled polygon, set brush to HOLLOW_BRUSH
+       if drawing a polygon outline. (#332662)
+       (gdk_win32_draw_polygon): Corresponding simplification: no need to
+       add an extra final copy of the starting point.
+
 2006-03-11  Dom Lachowicz <cinamod@hotmail.com>
 
        * modules/engines/ms-windows: Speed up the Windows theme
index 8c8d4fe4019ae3c05b06e43a50f423782c1393f7..d14dfc1d88473614b608c2595a68d66acb6be7c0 100644 (file)
@@ -994,7 +994,7 @@ draw_polygon (GdkGCWin32 *gcwin32,
 {
   gboolean filled;
   POINT *pts;
-  HPEN old_pen;
+  HGDIOBJ old_pen_or_brush;
   gint npoints;
   gint i;
 
@@ -1010,16 +1010,14 @@ draw_polygon (GdkGCWin32 *gcwin32,
       }
 
   if (filled)
-    {
-      old_pen = SelectObject (hdc, GetStockObject (NULL_PEN));
-      if (old_pen == NULL)
-       WIN32_GDI_FAILED ("SelectObject");
-      GDI_CALL (Polygon, (hdc, pts, npoints));
-      if (old_pen != NULL)
-       GDI_CALL (SelectObject, (hdc, old_pen));
-    }
+    old_pen_or_brush = SelectObject (hdc, GetStockObject (NULL_PEN));
   else
-    GDI_CALL (Polyline, (hdc, pts, npoints));
+    old_pen_or_brush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH));
+  if (old_pen_or_brush == NULL)
+    WIN32_GDI_FAILED ("SelectObject");
+  GDI_CALL (Polygon, (hdc, pts, npoints));
+  if (old_pen_or_brush != NULL)
+    GDI_CALL (SelectObject, (hdc, old_pen_or_brush));
 }
 
 static void
@@ -1046,7 +1044,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
   bounds.width = 0;
   bounds.height = 0;
 
-  pts = g_new (POINT, npoints+1);
+  pts = g_new (POINT, npoints);
 
   for (i = 0; i < npoints; i++)
     {
@@ -1062,14 +1060,6 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
       bounds.height = MAX (bounds.height, points[i].y - bounds.y);
     }
 
-  if (points[0].x != points[npoints-1].x ||
-      points[0].y != points[npoints-1].y) 
-    {
-      pts[npoints].x = points[0].x;
-      pts[npoints].y = points[0].y;
-      npoints++;
-    }
-      
   region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width);
 
   generic_draw (drawable, gc,