[cairo-commit] cairo/src cairo.c, 1.51, 1.52 cairo_gstate.c, 1.81, 1.82

Kristian Hogsberg commit at pdx.freedesktop.org
Sat Feb 12 12:59:55 PST 2005


Committed by: krh

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

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

        * src/cairo_gstate.c
        (_cairo_gstate_clip_and_composite_trapezoids): Make clipping fast
        path fast.  When we have a clipping region set, intersect it
        against the drawing extents to determine the bounding box for the
        visible drawing.



Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- cairo.c	6 Feb 2005 23:07:17 -0000	1.51
+++ cairo.c	12 Feb 2005 20:59:53 -0000	1.52
@@ -105,7 +105,7 @@
  * @cr: a #cairo_t
  * 
  * Increases the reference count on @cr by one. This prevents
- * @cr from being destroyed until a matching call to @cairo_destroy()
+ * @cr from being destroyed until a matching call to cairo_destroy() 
  * is made.
  **/
 void

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- cairo_gstate.c	6 Feb 2005 23:07:17 -0000	1.81
+++ cairo_gstate.c	12 Feb 2005 20:59:53 -0000	1.82
@@ -1565,6 +1565,40 @@
 	    return status;
 	
     } else {
+	if (gstate->clip.region) {
+	    pixman_box16_t box;
+	    pixman_box16_t *intersection_extents;
+	    pixman_region16_t *rect, *intersection;
+
+	    box.x1 = _cairo_fixed_integer_floor (trap_extents.p1.x);
+	    box.y1 = _cairo_fixed_integer_floor (trap_extents.p1.y);
+	    box.x2 = _cairo_fixed_integer_ceil (trap_extents.p2.x);
+	    box.y2 = _cairo_fixed_integer_ceil (trap_extents.p2.y);
+
+	    rect = pixman_region_create_simple (&box);
+	    if (rect == NULL)
+		goto bail1;
+	    intersection = pixman_region_create();
+	    if (intersection == NULL)
+		goto bail2;
+
+	    if (pixman_region_intersect (intersection, gstate->clip.region,
+					 rect) != PIXMAN_REGION_STATUS_SUCCESS)
+		goto bail3;
+	    intersection_extents = pixman_region_extents (intersection);
+
+	    extents.x = intersection_extents->x1;
+	    extents.y = intersection_extents->y1;
+	    extents.width = intersection_extents->x2 - intersection_extents->x2;
+	    extents.height = intersection_extents->y2 - intersection_extents->y1;
+	bail3:
+	    pixman_region_destroy (intersection);
+	bail2:
+	    pixman_region_destroy (rect);
+	bail1:
+	    ;
+	}
+
 	_cairo_pattern_init_copy (&pattern, src);
 	_cairo_gstate_create_pattern (gstate, &pattern);
 




More information about the cairo-commit mailing list