Re: Bug in gnome-canvas-polygon.c
- From: Lyndon Drake <lyndon stat auckland ac nz>
- To: Gnome List <gnome-list gnome org>
- Subject: Re: Bug in gnome-canvas-polygon.c
- Date: Tue, 26 Jan 1999 17:01:15 +1300
On Tue, Jan 26, 1999 at 04:15:39PM +1300, Lyndon Drake wrote:
> Hi,
>
> I am using the Gnome canvas for plotting data, and it appears that
> there is a bug in the polygon item code. Specifically, giving it a
> color argument of type "outline_color_gdk" or "fill_color_gdk" will
> cause wierd drawing problems, when using an aa canvas. The problem
> is in gnome_canvas_polygon_set_args, lines 410 to 415 and 446 to 451.
> The code needs to take into account the anti-aliased canvas, but the
> current code just sets the gc color.
>
Attached to this message is a patch which seems to fix the problem
(at least, it works for me). I created the patch by doing
diff -u gnome-canvas-polygon.c.orig gnome-canvas-polygon.c
I hope this is the correct way to do it.
Lyndon
--- gnome-canvas-polygon.c.orig Tue Jan 26 16:56:16 1999
+++ gnome-canvas-polygon.c Tue Jan 26 16:25:52 1999
@@ -365,7 +365,7 @@
GnomeCanvasItem *item;
GnomeCanvasPolygon *poly;
GnomeCanvasPoints *points;
- GdkColor color;
+ GdkColor color, *colorp;
item = GNOME_CANVAS_ITEM (object);
poly = GNOME_CANVAS_POLYGON (object);
@@ -408,9 +408,17 @@
break;
case ARG_FILL_COLOR_GDK:
- poly->fill_set = TRUE;
- poly->fill_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
- set_gc_foreground (poly->fill_gc, poly->fill_pixel);
+ colorp = (GdkColor *) GTK_VALUE_BOXED (*arg);
+ poly->fill_set = TRUE;
+ poly->fill_pixel = colorp->pixel;
+ if (item->canvas->aa)
+ poly->fill_rgba =
+ (((colorp->red & 0xff00) << 16) |
+ ((colorp->green & 0xff00) << 8) |
+ (colorp->blue & 0xff00) |
+ 0xff);
+ else
+ set_gc_foreground (poly->fill_gc, poly->fill_pixel);
gnome_canvas_item_request_update (item);
break;
@@ -444,9 +452,17 @@
break;
case ARG_OUTLINE_COLOR_GDK:
+ colorp = (GdkColor *) GTK_VALUE_BOXED (*arg);
poly->outline_set = TRUE;
- poly->outline_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
- set_gc_foreground (poly->outline_gc, poly->outline_pixel);
+ poly->outline_pixel = colorp->pixel;
+ if(item->canvas->aa)
+ poly->outline_rgba =
+ (((colorp->red & 0xff00) << 16) |
+ ((colorp->green & 0xff00) << 8) |
+ (colorp->blue & 0xff00) |
+ 0xff);
+ else
+ set_gc_foreground (poly->outline_gc, poly->outline_pixel);
gnome_canvas_item_request_update (item);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]