[xserver-commit] xserver/xfixes region.c,1.4,1.5 xfixes.c,1.4,1.5 xfixesint.h,1.4,1.5

Keith Packard xserver-commit@pdx.freedesktop.org
Fri, 21 Nov 2003 16:49:13 -0800


Committed by: keithp

Update of /cvs/xserver/xserver/xfixes
In directory pdx:/tmp/cvs-serv27760/xfixes

Modified Files:
	region.c xfixes.c xfixesint.h 
Log Message:
	* composite/compwindow.c: (compCopyWindow):
	Offset for CopyWindow was wrong; resizing under twm
	demonstrated this.
	
	* miext/damage/damage.c: (damageDamageRegion):
	Clip damage to monitored drawable, not just target drawable.
	This avoids accumulating damage outside the monitored window.

	* render/mipict.c: (miClipPictureReg), (miComputeCompositeRegion):
	Clip regions for mask/src were offset wrong.
	
	* xfixes/region.c: (ProcXFixesCopyRegion), (SProcXFixesCopyRegion),
	(ProcXFixesCombineRegion), (SProcXFixesCombineRegion),
	(ProcXFixesInvertRegion), (SProcXFixesInvertRegion),
	(ProcXFixesTranslateRegion), (SProcXFixesTranslateRegion):
	* xfixes/xfixes.c: (XFixesNumberRequests):
	* xfixes/xfixesint.h:
	Eliminate offset arguments in combining operators,
	create separate CopyRegion and TranslateRegion requests.


Index: region.c
===================================================================
RCS file: /cvs/xserver/xserver/xfixes/region.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- region.c	7 Nov 2003 04:26:08 -0000	1.4
+++ region.c	22 Nov 2003 00:49:11 -0000	1.5
@@ -378,6 +378,34 @@
 }
 
 int
+ProcXFixesCopyRegion (ClientPtr client)
+{
+    RegionPtr	pSource, pDestination;
+    REQUEST (xXFixesCopyRegionReq);
+    
+    VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess);
+    VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess);
+    
+    if (!REGION_COPY(pScreen, pDestination, pSource))
+	return BadAlloc;
+
+    return(client->noClientException);
+}
+
+int
+SProcXFixesCopyRegion (ClientPtr client)
+{
+    int n;
+    REQUEST (xXFixesCopyRegionReq);
+
+    swaps (&stuff->length, n);
+    REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq);
+    swapl (&stuff->source, n);
+    swapl (&stuff->destination, n);
+    return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
+}
+
+int
 ProcXFixesCombineRegion (ClientPtr client)
 {
     RegionPtr	pSource1, pSource2, pDestination;
@@ -385,58 +413,24 @@
     REQUEST (xXFixesCombineRegionReq);
 
     REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
-    VERIFY_REGION_OR_NONE(pSource1, stuff->source1, client, SecurityReadAccess);
-    VERIFY_REGION_OR_NONE(pSource2, stuff->source2, client, SecurityReadAccess);
-    VERIFY_REGION_OR_NONE(pDestination, stuff->destination,
-			  client, SecurityWriteAccess);
-    if (pSource1 && (stuff->xOff1 || stuff->yOff1))
-	REGION_TRANSLATE (0, pSource1, stuff->xOff1, stuff->yOff1);
-    if (pSource2 && (stuff->xOff2 || stuff->yOff2))
-	REGION_TRANSLATE (0, pSource2, stuff->xOff2, stuff->yOff2);
+    VERIFY_REGION(pSource1, stuff->source1, client, SecurityReadAccess);
+    VERIFY_REGION(pSource2, stuff->source2, client, SecurityReadAccess);
+    VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess);
     
     switch (stuff->xfixesReqType) {
     case X_XFixesUnionRegion:
+	if (!REGION_UNION (0, pDestination, pSource1, pSource2))
+	    ret = BadAlloc;
+	break;
     case X_XFixesIntersectRegion:
-	if (!pSource1) {
-	    RegionPtr pTmp = pSource2;
-	    pSource2 = pSource1;
-	    pSource1 = pTmp;
-	}
-	/* fall through ... */
+	if (!REGION_INTERSECT (0, pDestination, pSource1, pSource2))
+	    ret = BadAlloc;
+	break;
     case X_XFixesSubtractRegion:
-	if (!pSource1)
-	{
-	    REGION_EMPTY (0, pDestination);
-	}
-	else if (!pSource2) 
-	{
-	    if (!REGION_COPY(0, pDestination, pSource1))
-		ret = BadAlloc;
-	}
-	else
-	{
-	    switch (stuff->xfixesReqType) {
-	    case X_XFixesUnionRegion:
-		if (!REGION_UNION (0, pDestination, pSource1, pSource2))
-		    ret = BadAlloc;
-		break;
-	    case X_XFixesIntersectRegion:
-		if (!REGION_INTERSECT (0, pDestination, pSource1, pSource2))
-		    ret = BadAlloc;
-		break;
-	    case X_XFixesSubtractRegion:
-		if (!REGION_SUBTRACT (0, pDestination, pSource1, pSource2))
-		    ret = BadAlloc;
-		break;
-	    }
-	}
+	if (!REGION_SUBTRACT (0, pDestination, pSource1, pSource2))
+	    ret = BadAlloc;
 	break;
     }
-
-    if (pSource1 && pSource1 != pDestination && (stuff->xOff1 || stuff->yOff1))
-	REGION_TRANSLATE (0, pSource1, -stuff->xOff1, -stuff->yOff1);
-    if (pSource2 && pSource2 != pDestination && (stuff->xOff2 || stuff->yOff2))
-	REGION_TRANSLATE (0, pSource2, -stuff->xOff2, -stuff->yOff2);
     
     if (ret == Success) 
 	ret = client->noClientException;
@@ -452,11 +446,7 @@
     swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
     swapl (&stuff->source1, n);
-    swaps (&stuff->xOff1, n)
-    swaps (&stuff->yOff1, n)
     swapl (&stuff->source2, n);
-    swaps (&stuff->xOff2, n)
-    swaps (&stuff->yOff2, n)
     swapl (&stuff->destination, n);
     return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
 }
@@ -473,9 +463,6 @@
     VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess);
     VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess);
 
-    if (stuff->xOff || stuff->yOff)
-	REGION_TRANSLATE (0, pSource, stuff->xOff, stuff->yOff);
-    
     /* Compute bounds, limit to 16 bits */
     bounds.x1 = stuff->x;
     bounds.y1 = stuff->y;
@@ -492,9 +479,6 @@
     if (!REGION_INVERSE(0, pDestination, pSource, &bounds))
 	ret = BadAlloc;
 
-    if (stuff->xOff || stuff->yOff)
-	REGION_TRANSLATE (0, pSource, -stuff->xOff, -stuff->yOff);
-
     if (ret == Success)
 	ret = client->noClientException;
     return ret;
@@ -509,8 +493,6 @@
     swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
     swapl (&stuff->source, n);
-    swaps (&stuff->xOff, n);
-    swaps (&stuff->yOff, n);
     swaps (&stuff->x, n);
     swaps (&stuff->y, n);
     swaps (&stuff->width, n);
@@ -520,6 +502,33 @@
 }
 
 int
+ProcXFixesTranslateRegion (ClientPtr client)
+{
+    RegionPtr	pRegion;
+    REQUEST(xXFixesTranslateRegionReq);
+
+    REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
+    VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess);
+
+    REGION_TRANSLATE(pScreen, pRegion, stuff->dx, stuff->dy);
+    return (client->noClientException);
+}
+
+int
+SProcXFixesTranslateRegion (ClientPtr client)
+{
+    int n;
+    REQUEST(xXFixesTranslateRegionReq);
+
+    swaps (&stuff->length, n);
+    REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
+    swapl (&stuff->region, n);
+    swaps (&stuff->dx, n);
+    swaps (&stuff->dy, n);
+    return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
+}
+
+int
 ProcXFixesRegionExtents (ClientPtr client)
 {
     RegionPtr	pSource, pDestination;

Index: xfixes.c
===================================================================
RCS file: /cvs/xserver/xserver/xfixes/xfixes.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xfixes.c	2 Nov 2003 19:56:11 -0000	1.4
+++ xfixes.c	22 Nov 2003 00:49:11 -0000	1.5
@@ -91,10 +91,12 @@
     ProcXFixesCreateRegionFromPicture,
     ProcXFixesDestroyRegion,
     ProcXFixesSetRegion,
+    ProcXFixesCopyRegion,
     ProcXFixesCombineRegion,
     ProcXFixesCombineRegion,
     ProcXFixesCombineRegion,
     ProcXFixesInvertRegion,
+    ProcXFixesTranslateRegion,
     ProcXFixesRegionExtents,
     ProcXFixesFetchRegion,
     ProcXFixesSetGCClipRegion,
@@ -147,10 +149,12 @@
     SProcXFixesCreateRegionFromPicture,
     SProcXFixesDestroyRegion,
     SProcXFixesSetRegion,
+    SProcXFixesCopyRegion,
     SProcXFixesCombineRegion,
     SProcXFixesCombineRegion,
     SProcXFixesCombineRegion,
     SProcXFixesInvertRegion,
+    SProcXFixesTranslateRegion,
     SProcXFixesRegionExtents,
     SProcXFixesFetchRegion,
     SProcXFixesSetGCClipRegion,

Index: xfixesint.h
===================================================================
RCS file: /cvs/xserver/xserver/xfixes/xfixesint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xfixesint.h	2 Nov 2003 19:56:11 -0000	1.4
+++ xfixesint.h	22 Nov 2003 00:49:11 -0000	1.5
@@ -178,6 +178,12 @@
 SProcXFixesSetRegion (ClientPtr client);
 
 int
+ProcXFixesCopyRegion (ClientPtr client);
+
+int
+SProcXFixesCopyRegion (ClientPtr client);
+
+int
 ProcXFixesCombineRegion (ClientPtr client);
 
 int
@@ -190,6 +196,12 @@
 SProcXFixesInvertRegion (ClientPtr client);
 
 int
+ProcXFixesTranslateRegion (ClientPtr client);
+
+int
+SProcXFixesTranslateRegion (ClientPtr client);
+
+int
 ProcXFixesRegionExtents (ClientPtr client);
 
 int