[xserver-commit] xserver/render mipict.c,1.17,1.18

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


Committed by: keithp

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

Modified Files:
	mipict.c 
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: mipict.c
===================================================================
RCS file: /cvs/xserver/xserver/render/mipict.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mipict.c	7 Nov 2003 23:29:30 -0000	1.17
+++ mipict.c	22 Nov 2003 00:49:11 -0000	1.18
@@ -277,14 +277,18 @@
 	    REGION_EMPTY(pScreen, pRegion);
 	}
     }
+    else if (!REGION_NOTEMPTY (pScreen, pClip))
+	return FALSE;
     else
     {
-	REGION_TRANSLATE(pScreen, pRegion, dx, dy);
+	if (dx || dy)
+	    REGION_TRANSLATE(pScreen, pRegion, -dx, -dy);
 	if (!REGION_INTERSECT (pScreen, pRegion, pRegion, pClip))
 	    return FALSE;
-	REGION_TRANSLATE(pScreen, pRegion, -dx, -dy);
+	if (dx || dy)
+	    REGION_TRANSLATE(pScreen, pRegion, dx, dy);
     }
-    return TRUE;
+    return REGION_NOTEMPTY(pScreen, pRegion);
 }
 		  
 static __inline Bool
@@ -321,6 +325,11 @@
     }
 }
 
+/*
+ * returns FALSE if the final region is empty.  Indistinguishable from
+ * an allocation failure, but rendering ignores those anyways.
+ */
+
 Bool
 miComputeCompositeRegion (RegionPtr	pRegion,
 			  PicturePtr	pSrc,
@@ -349,7 +358,23 @@
 	pRegion->extents.y1 >= pRegion->extents.y2)
     {
 	REGION_EMPTY (pDst->pDrawable->pScreen, pRegion);
-	return TRUE;
+	return FALSE;
+    }
+    /* clip against dst */
+    if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0))
+    {
+	REGION_UNINIT (pScreen, pRegion);
+	return FALSE;
+    }
+    if (pDst->alphaMap)
+    {
+	if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip,
+			       -pDst->alphaOrigin.x,
+			       -pDst->alphaOrigin.y))
+	{
+	    REGION_UNINIT (pScreen, pRegion);
+	    return FALSE;
+	}
     }
     /* clip against src */
     if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
@@ -386,21 +411,6 @@
 	    }
 	}
     }
-    if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0))
-    {
-	REGION_UNINIT (pScreen, pRegion);
-	return FALSE;
-    }
-    if (pDst->alphaMap)
-    {
-	if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip,
-			       -pDst->alphaOrigin.x,
-			       -pDst->alphaOrigin.y))
-	{
-	    REGION_UNINIT (pScreen, pRegion);
-	    return FALSE;
-	}
-    }
     return TRUE;
 }