[cairo-commit] cairo/src cairo_gstate.c,1.87,1.88

Kristian Hogsberg commit at pdx.freedesktop.org
Sun Feb 27 11:21:41 PST 2005


Committed by: krh

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv20357/src

Modified Files:
	cairo_gstate.c 
Log Message:
2005-02-27  Kristian Høgsberg  <krh at redhat.com>

        * src/cairo_gstate.c (_cairo_rectangle_intersect): Fix this
        function again.  Problem with signed/unsigned types reported by
        Jeff Muizelaar <jrmuizel at nit.ca>.



Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- cairo_gstate.c	25 Feb 2005 21:03:42 -0000	1.87
+++ cairo_gstate.c	27 Feb 2005 19:21:39 -0000	1.88
@@ -1407,20 +1407,23 @@
 static void
 _cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src)
 {
-    cairo_rectangle_t out;
+    int x1, y1, x2, y2;
 
-    out.x = MAX (dest->x, src->x);
-    out.y = MAX (dest->y, src->y);
-    out.width = MIN (dest->x + dest->width, src->x + src->width) - out.x;
-    out.height = MIN (dest->y + dest->height, src->y + src->height) - out.y;
+    x1 = MAX (dest->x, src->x);
+    y1 = MAX (dest->y, src->y);
+    x2 = MIN (dest->x + dest->width, src->x + src->width);
+    y2 = MIN (dest->y + dest->height, src->y + src->height);
 
-    if (out.width <= 0 || out.height <= 0) {
+    if (x1 >= x2 || y1 >= y2) {
 	dest->x = 0;
 	dest->y = 0;
 	dest->width = 0;
 	dest->height = 0;
     } else {
-	*dest = out;
+	dest->x = x1;
+	dest->y = y1;
+	dest->width = x2 - x1;
+	dest->height = y2 - y1;
     }	
 }
 




More information about the cairo-commit mailing list