summaryrefslogtreecommitdiff
path: root/gdk/gdkdraw.c
diff options
context:
space:
mode:
authorPST 1998 Shawn T. Amundson <amundson@gimp.org>1998-03-02 00:32:52 +0000
committerShawn Amundson <amundson@src.gnome.org>1998-03-02 00:32:52 +0000
commitf6f1ce01c6b33fe75e32c7e76ef5e7fc9ce494ab (patch)
treedca8f578054ea33fd2973ee3eb6d6d38e4a60342 /gdk/gdkdraw.c
parent80fd0a0c0068cd09d120e1a74df26cf82004a491 (diff)
downloadgdk-pixbuf-f6f1ce01c6b33fe75e32c7e76ef5e7fc9ce494ab.tar.gz
Required changes for version change to 0.99.4
Sun Mar 1 15:18:38 PST 1998 Shawn T. Amundson <amundson@gimp.org> * Required changes for version change to 0.99.4 * gtk/gtktree.[ch]: patch from J. Bolliet to correct some bugs * gtk/testgtk.c: added test here from J. Bolliet, removed testtree * gtk/clist: gtk-abilleira-981602-0, allows gtk_clist_set_pixmap and gtk_clist_set_pixtext to not require a mask * gdk/gdkdraw.c,gdk.h: gtk-trow-980217-0 adds gdk_draw_lines and fixes some things about gdk_draw_polygon
Diffstat (limited to 'gdk/gdkdraw.c')
-rw-r--r--gdk/gdkdraw.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index de23f6c4f..3d39d3faa 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -142,6 +142,9 @@ gdk_draw_polygon (GdkDrawable *drawable,
{
GdkWindowPrivate *drawable_private;
GdkGCPrivate *gc_private;
+ GdkPoint *local_points = points;
+ gint local_npoints = npoints;
+ gint local_alloc = 0;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
@@ -158,14 +161,24 @@ gdk_draw_polygon (GdkDrawable *drawable,
}
else
{
- XDrawLines (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, (XPoint*) points, npoints, CoordModeOrigin);
-
if ((points[0].x != points[npoints-1].x) ||
- (points[0].y != points[npoints-1].y))
- XDrawLine (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, points[npoints-1].x, points[npoints-1].y,
- points[0].x, points[0].y);
+ (points[0].y != points[npoints-1].y))
+ {
+ local_alloc = 1;
+ ++local_npoints;
+ local_points = (GdkPoint*) g_malloc (local_npoints * sizeof(GdkPoint));
+ memcpy (local_points, points, npoints * sizeof(GdkPoint));
+ local_points[npoints].x = points[0].x;
+ local_points[npoints].y = points[0].y;
+ }
+
+ XDrawLines (drawable_private->xdisplay, drawable_private->xwindow,
+ gc_private->xgc,
+ (XPoint*) local_points, local_npoints,
+ CoordModeOrigin);
+
+ if (local_alloc)
+ g_free (local_points);
}
}
@@ -401,3 +414,30 @@ gdk_draw_segments (GdkDrawable *drawable,
(XSegment *) segs,
nsegs);
}
+
+void
+gdk_draw_lines (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints)
+{
+ GdkWindowPrivate *drawable_private;
+ GdkGCPrivate *gc_private;
+
+ if (npoints <= 0)
+ return;
+
+ g_return_if_fail (drawable != NULL);
+ g_return_if_fail (points != NULL);
+ g_return_if_fail (gc != NULL);
+
+ drawable_private = (GdkWindowPrivate*) drawable;
+ gc_private = (GdkGCPrivate*) gc;
+
+ XDrawLines (drawable_private->xdisplay,
+ drawable_private->xwindow,
+ gc_private->xgc,
+ (XPoint *) points,
+ npoints,
+ CoordModeOrigin);
+}