[cairo-commit] libpixman/src iccompose.c, 1.17, 1.18 icimage.c, 1.27, 1.28 icimage.h, 1.22, 1.23

Keith Packard commit at pdx.freedesktop.org
Thu May 26 13:02:34 PDT 2005


Committed by: keithp

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

Modified Files:
	iccompose.c icimage.c icimage.h 
Log Message:
2005-05-26  Keith Packard  <keithp at keithp.com>

	* src/iccompose.c: (IcFetch_transform), (IcFetcha_transform),
	(IcBuildCompositeOperand):
	* src/icimage.c: (pixman_image_init), (pixman_image_destroy),
	(pixman_image_set_clip_region), (IcClipImageSrc):
	* src/icimage.h:

	Split clipping into separate source and destination operand
	clips.  By default, source operands are not affected by
	any client clipping.  This matches the desired semantics
	for cairo.  When this code is ported back to the X server,
	that will have to select the clipping option which clip
	source operands to the client clip.


Index: iccompose.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/iccompose.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- iccompose.c	2 Mar 2005 15:43:33 -0000	1.17
+++ iccompose.c	26 May 2005 20:02:31 -0000	1.18
@@ -2265,7 +2265,7 @@
 	    y = MOD (y, op->u.transform.height);
 	    x = MOD (x, op->u.transform.width);
 	}
-	if (pixman_region_contains_point (op->clip, x, y, &box))
+	if (pixman_region_contains_point (op->src_clip, x, y, &box))
 	{
 	    (*op[1].set) (&op[1], x, y);
 	    bits = (*op[1].fetch) (&op[1]);
@@ -2302,7 +2302,7 @@
 		else
 		    tx = x;
 
-		if (pixman_region_contains_point (op->clip, tx, ty, &box))
+		if (pixman_region_contains_point (op->src_clip, tx, ty, &box))
 		{
 		    (*op[1].set) (&op[1], tx, ty);
 		    bits = (*op[1].fetch) (&op[1]);
@@ -2364,7 +2364,7 @@
 	    y = MOD (y, op->u.transform.height);
 	    x = MOD (x, op->u.transform.width);
 	}
-	if (pixman_region_contains_point (op->clip, x, y, &box))
+	if (pixman_region_contains_point (op->src_clip, x, y, &box))
 	{
 	    (*op[1].set) (&op[1], x, y);
 	    bits = (*op[1].fetcha) (&op[1]);
@@ -2402,7 +2402,7 @@
 		else
 		    tx = x;
 		
-		if (pixman_region_contains_point (op->clip, tx, ty, &box))
+		if (pixman_region_contains_point (op->src_clip, tx, ty, &box))
 		{
 		    (*op[1].set) (&op[1], tx, ty);
 		    bits = (*op[1].fetcha) (&op[1]);
@@ -2579,7 +2579,8 @@
 	op->down = IcStepDown_transform;
 	op->set = IcSet_transform;
 
-	op->clip = op[1].clip;
+	op->src_clip = op[1].src_clip;
+	op->dst_clip = op[1].dst_clip;
 	
 	return 1;
     }
@@ -2603,7 +2604,8 @@
 	op->down = IcStepDown_external;
 	op->set = IcSet_external;
 
-	op->clip = op[1].clip;
+	op->src_clip = op[1].dst_clip;
+	op->dst_clip = op[1].dst_clip;
 	
 	return 1;
     }
@@ -2627,7 +2629,11 @@
 		op->down = IcStepDown;
 		op->set = IcSet;
 
-		op->clip = image->pCompositeClip;
+		op->dst_clip = image->pCompositeClip;
+		if (image->compositeClipSource)
+		    op->src_clip = image->pCompositeClip;
+		else
+		    op->src_clip = image->pSourceClip;
 
 		IcGetPixels (image->pixels, bits, stride, bpp,
 			     xoff, yoff);

Index: icimage.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/icimage.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- icimage.c	18 May 2005 16:27:24 -0000	1.27
+++ icimage.c	26 May 2005 20:02:31 -0000	1.28
@@ -110,10 +110,15 @@
     image->subWindowMode = ClipByChildren;
     image->polyEdge = PolyEdgeSharp;
     image->polyMode = PolyModePrecise;
-    /* XXX: In the server this was 0. Why? */
-    image->freeCompClip = 1;
+    /* 
+     * In the server this was 0 because the composite clip list
+     * can be referenced from a window (and often is)
+     */
+    image->freeCompClip = 0;
+    image->freeSourceClip = 0;
     image->clientClipType = CT_NONE;
     image->componentAlpha = 0;
+    image->compositeClipSource = 0;
 
     image->alphaMap = 0;
     image->alphaOrigin.x = 0;
@@ -133,7 +138,13 @@
     image->pCompositeClip = pixman_region_create();
     pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip,
 			0, 0, image->pixels->width, image->pixels->height);
+    image->freeCompClip = 1;
 
+    image->pSourceClip = pixman_region_create ();
+    pixman_region_union_rect (image->pSourceClip, image->pSourceClip,
+			0, 0, image->pixels->width, image->pixels->height);
+    image->freeSourceClip = 1;
+    
     image->transform = NULL;
 
     image->filter = PIXMAN_FILTER_NEAREST;
@@ -247,6 +258,11 @@
 	pixman_region_destroy (image->pCompositeClip);
 	image->pCompositeClip = NULL;
     }
+    
+    if (image->freeSourceClip) {
+	pixman_region_destroy (image->pSourceClip);
+	image->pSourceClip = NULL;
+    }
 
     if (image->owns_pixels) {
 	IcPixelsDestroy (image->pixels);
@@ -281,7 +297,7 @@
 
 int
 pixman_image_set_clip_region (pixman_image_t	*image,
-		      pixman_region16_t	*region)
+			      pixman_region16_t	*region)
 {
     pixman_image_destroyClip (image);
     if (region) {
@@ -290,9 +306,12 @@
 	image->clientClipType = CT_REGION;
     }
     
+    if (image->freeCompClip)
+	pixman_region_destroy (image->pCompositeClip);
     image->pCompositeClip = pixman_region_create();
     pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip,
 			      0, 0, image->pixels->width, image->pixels->height);
+    image->freeCompClip = 1;
     if (region) {
 	pixman_region_translate (image->pCompositeClip,
 				 - image->clipOrigin.x,
@@ -358,7 +377,9 @@
 	return 1;
     if (image->repeat)
     {
-	if (image->clientClipType != CT_NONE)
+	/* XXX no source clipping */
+	if (image->compositeClipSource &&
+	    image->clientClipType != CT_NONE)
 	{
 	    pixman_region_translate (region, 
 			   dx - image->clipOrigin.x,
@@ -372,8 +393,14 @@
     }
     else
     {
+	pixman_region16_t   *clip;
+
+	if (image->compositeClipSource)
+	    clip = image->pCompositeClip;
+	else
+	    clip = image->pSourceClip;
 	return IcClipImageReg (region,
-			       image->pCompositeClip,
+			       clip,
 			       dx,
 			       dy);
     }

Index: icimage.h
===================================================================
RCS file: /cvs/cairo/libpixman/src/icimage.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- icimage.h	3 Mar 2005 22:27:31 -0000	1.22
+++ icimage.h	26 May 2005 20:02:31 -0000	1.23
@@ -97,11 +97,12 @@
     unsigned int    subWindowMode : 1;
     unsigned int    polyEdge : 1;
     unsigned int    polyMode : 1;
-    /* XXX: Do we need this field */
     unsigned int    freeCompClip : 1;
+    unsigned int    freeSourceClip : 1;
     unsigned int    clientClipType : 2;
     unsigned int    componentAlpha : 1;
-    unsigned int    unused : 23;
+    unsigned int    compositeClipSource : 1;
+    unsigned int    unused : 21;
 
     struct pixman_image *alphaMap;
     IcPoint	    alphaOrigin;
@@ -115,6 +116,7 @@
     unsigned long   serialNumber;
 
     pixman_region16_t	    *pCompositeClip;
+    pixman_region16_t	    *pSourceClip;
     
     pixman_transform_t     *transform;
 
@@ -289,7 +291,8 @@
 /* XXX: We're not supporting indexed operations, right?
     IcIndexedPtr	indexed;
 */
-    pixman_region16_t		*clip;
+    pixman_region16_t		*dst_clip;
+    pixman_region16_t		*src_clip;
 };
 
 typedef void (*IcCombineFunc) (pixman_compositeOperand	*src,




More information about the cairo-commit mailing list