[cairo-commit] goocanvas/src goocanvas.c, 1.26, 1.27 goocanvasrect.c, 1.14, 1.15
Damon Chaplin
commit at pdx.freedesktop.org
Sun May 18 02:23:00 PDT 2008
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv24687/src
Modified Files:
goocanvas.c goocanvasrect.c
Log Message:
2008-05-18 Damon Chaplin <damon at gnome.org>
* src/goocanvas.c (goo_canvas_expose_event): when clipping, clip to
the intersection of the canvas bounds and the expose bounds, to avoid
problems with cairo's coordinate limits. (This was apparent in the
scalability demo - it wasn't redrawing properly at the bottom of the
canvas.)
Index: goocanvas.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- goocanvas.c 25 Feb 2008 14:12:25 -0000 1.26
+++ goocanvas.c 18 May 2008 09:22:57 -0000 1.27
@@ -2231,6 +2231,7 @@
GooCanvas *canvas = GOO_CANVAS (widget);
GooCanvasBounds bounds, root_item_bounds;
cairo_t *cr;
+ double x1, y1, x2, y2;
if (!canvas->root_item)
return FALSE;
@@ -2282,11 +2283,18 @@
|| (root_item_bounds.y2 > canvas->bounds.y2
&& canvas->bounds.y2 < bounds.y2))
{
+ /* Clip to the intersection of the canvas bounds and the expose
+ bounds, to avoid cairo's 16-bit limits. */
+ x1 = MAX (canvas->bounds.x1, bounds.x1);
+ y1 = MAX (canvas->bounds.y1, bounds.y1);
+ x2 = MIN (canvas->bounds.x2, bounds.x2);
+ y2 = MIN (canvas->bounds.y2, bounds.y2);
+
cairo_new_path (cr);
- cairo_move_to (cr, canvas->bounds.x1, canvas->bounds.y1);
- cairo_line_to (cr, canvas->bounds.x2, canvas->bounds.y1);
- cairo_line_to (cr, canvas->bounds.x2, canvas->bounds.y2);
- cairo_line_to (cr, canvas->bounds.x1, canvas->bounds.y2);
+ cairo_move_to (cr, x1, y1);
+ cairo_line_to (cr, x2, y1);
+ cairo_line_to (cr, x2, y2);
+ cairo_line_to (cr, x1, y2);
cairo_close_path (cr);
cairo_clip (cr);
}
Index: goocanvasrect.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasrect.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- goocanvasrect.c 11 May 2007 16:30:49 -0000 1.14
+++ goocanvasrect.c 18 May 2008 09:22:58 -0000 1.15
@@ -360,7 +360,6 @@
/* Draw the plain rectangle. */
cairo_rectangle (cr, rect_data->x, rect_data->y,
rect_data->width, rect_data->height);
- cairo_close_path (cr);
}
}
More information about the cairo-commit
mailing list