summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2003-07-04 00:23:03 +0000
committerTor Lillqvist <tml@src.gnome.org>2003-07-04 00:23:03 +0000
commitaac21b6f6a2ac87a5577306a5c777ae980a3c4e5 (patch)
tree3141ae96ff90c448b7881994cb39b9090edfb4e2 /gdk
parent44f044e6cd364ae6af36082663b60be64830faaa (diff)
downloadgtk+-aac21b6f6a2ac87a5577306a5c777ae980a3c4e5.tar.gz
We can calculate the width and height of the bounding rectangle only after
2003-07-04 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_polygon, gdk_win32_draw_segments, gdk_win32_draw_lines): We can calculate the width and height of the bounding rectangle only after the minumum x and y have been found, and need a separate loop for it. Thanks to Bruce Hochstetler for providing a sample program exhibiting the bug.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/win32/gdkdrawable-win32.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 819adf6fcc..7a86fe7a02 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -955,12 +955,16 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
{
bounds.x = MIN (bounds.x, points[i].x);
bounds.y = MIN (bounds.y, points[i].y);
- bounds.width = MAX (bounds.width, points[i].x - bounds.x);
- bounds.height = MAX (bounds.height, points[i].y - bounds.y);
pts[i].x = points[i].x;
pts[i].y = points[i].y;
}
+ for (i = 0; i < npoints; i++)
+ {
+ bounds.width = MAX (bounds.width, points[i].x - bounds.x);
+ 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)
{
@@ -1250,6 +1254,10 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
bounds.x = MIN (bounds.x, segs[i].x2);
bounds.y = MIN (bounds.y, segs[i].y1);
bounds.y = MIN (bounds.y, segs[i].y2);
+ }
+
+ for (i = 0; i < nsegs; i++)
+ {
bounds.width = MAX (bounds.width, segs[i].x1 - bounds.x);
bounds.width = MAX (bounds.width, segs[i].x2 - bounds.x);
bounds.height = MAX (bounds.height, segs[i].y1 - bounds.y);
@@ -1353,12 +1361,16 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
{
bounds.x = MIN (bounds.x, points[i].x);
bounds.y = MIN (bounds.y, points[i].y);
- bounds.width = MAX (bounds.width, points[i].x - bounds.x);
- bounds.height = MAX (bounds.height, points[i].y - bounds.y);
pts[i].x = points[i].x;
pts[i].y = points[i].y;
}
+ for (i = 0; i < npoints; i++)
+ {
+ bounds.width = MAX (bounds.width, points[i].x - bounds.x);
+ bounds.height = MAX (bounds.height, points[i].y - bounds.y);
+ }
+
region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width);
generic_draw (drawable, gc, GDK_GC_FOREGROUND|LINE_ATTRIBUTES,