summaryrefslogtreecommitdiff
path: root/gdk/win32/gdkdrawable-win32.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2006-03-11 20:34:37 +0000
committerTor Lillqvist <tml@src.gnome.org>2006-03-11 20:34:37 +0000
commit23025393a6444f8b92eb09c567e49c15322d4b92 (patch)
tree101a7423179ec6e02aeaad0e37e2d20435c4ad12 /gdk/win32/gdkdrawable-win32.c
parenta579bc5a5471315ac111889fb0cd11dd62e7009a (diff)
downloadgtk+-23025393a6444f8b92eb09c567e49c15322d4b92.tar.gz
Use Polygon() for outlined polygons, too. Same idea as in
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.
Diffstat (limited to 'gdk/win32/gdkdrawable-win32.c')
-rw-r--r--gdk/win32/gdkdrawable-win32.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 8c8d4fe401..d14dfc1d88 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -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,