[PATCH] damageext: Make DamageSubtract actually work for raw-rects mode

Adam Jackson ajax at redhat.com
Tue Jul 14 10:25:10 PDT 2015


I swear this has come up before, but I have no idea why this isn't
implemented.  This basically makes the raw mode unusable since you can
never subtract damage, your only recourse is to destroy the old damage
and make a new one as the old one saturates in area.  I can't see a good
reason to leave it broken.

Bugzilla: https://bugs.freedesktop.org/15347
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 damageext/damageext.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/damageext/damageext.c b/damageext/damageext.c
index 886f56d..3b1d7ab 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -405,6 +405,7 @@ ProcDamageSubtract(ClientPtr client)
 {
     REQUEST(xDamageSubtractReq);
     DamageExtPtr pDamageExt;
+    DamagePtr pDamage;
     RegionPtr pRepair;
     RegionPtr pParts;
 
@@ -413,21 +414,18 @@ ProcDamageSubtract(ClientPtr client)
     VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
     VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
 
-    if (pDamageExt->level != DamageReportRawRegion) {
-        DamagePtr pDamage = pDamageExt->pDamage;
-
-        if (pRepair) {
-            if (pParts)
-                RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
-            if (DamageExtSubtract(pDamageExt, pRepair))
-                DamageExtReport(pDamage, DamageRegion(pDamage),
-                                (void *) pDamageExt);
-        }
-        else {
-            if (pParts)
-                RegionCopy(pParts, DamageRegion(pDamage));
-            DamageEmpty(pDamage);
-        }
+    pDamage = pDamageExt->pDamage;
+    if (pRepair) {
+        if (pParts)
+            RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
+        if (DamageExtSubtract(pDamageExt, pRepair))
+            DamageExtReport(pDamage, DamageRegion(pDamage),
+                            (void *) pDamageExt);
+    }
+    else {
+        if (pParts)
+            RegionCopy(pParts, DamageRegion(pDamage));
+        DamageEmpty(pDamage);
     }
 
     return Success;
-- 
2.4.3



More information about the xorg-devel mailing list