From ba718c979ceaf46176f541bd615e309ca8447bd3 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 3 Nov 1999 20:26:32 +0000 Subject: [PATCH] Do proper rounding of bounding box coordinates. 1999-11-03 Federico Mena Quintero * src/gnome-canvas-pixbuf.c (recompute_bounding_box): Do proper rounding of bounding box coordinates. (gnome_canvas_pixbuf_bounds): Implemented the ::bounds() method. (gnome_canvas_pixbuf_draw): Use the correct alpha threshold value. --- gdk-pixbuf/ChangeLog | 7 +++++++ gdk-pixbuf/gnome-canvas-pixbuf.c | 26 ++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index c7aeccd3f2..b74960c074 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,10 @@ +1999-11-03 Federico Mena Quintero + + * src/gnome-canvas-pixbuf.c (recompute_bounding_box): Do proper + rounding of bounding box coordinates. + (gnome_canvas_pixbuf_bounds): Implemented the ::bounds() method. + (gnome_canvas_pixbuf_draw): Use the correct alpha threshold value. + 1999-11-03 Jonathan Blandford * src/io-gif.c (gif_prepare_lzw): s/lwz/lzw/g diff --git a/gdk-pixbuf/gnome-canvas-pixbuf.c b/gdk-pixbuf/gnome-canvas-pixbuf.c index 9c9bf9159c..57b7626d6a 100644 --- a/gdk-pixbuf/gnome-canvas-pixbuf.c +++ b/gdk-pixbuf/gnome-canvas-pixbuf.c @@ -578,8 +578,10 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp) item->x2 = MAX (max_x1, max_x2); item->y2 = MAX (max_y1, max_y2); - item->x2++; - item->y2++; + item->x1 = floor (item->x1); + item->y1 = floor (item->y1); + item->x2 = ceil (item->x2); + item->y2 = ceil (item->y2); } @@ -708,7 +710,7 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable, 0, 0, width, height, GDK_PIXBUF_ALPHA_BILEVEL, - 127, + 128, GDK_RGB_DITHER_MAX, x, y); @@ -808,5 +810,21 @@ gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, double *x1, double *y1, doubl gcp = GNOME_CANVAS_PIXBUF (item); priv = gcp->priv; - + *x1 = 0.0; + *y1 = 0.0; + + if (priv->pixbuf) { + if (priv->width_set) + *x2 = priv->width; + else + *x2 = priv->pixbuf->art_pixbuf->width; + + if (priv->height_set) + *y2 = priv->height; + else + *y2 = priv->pixbuf->art_pixbuf->height; + } else { + *x2 = 0.0; + *y2 = 0.0; + } }