summaryrefslogtreecommitdiff
path: root/xserver/miext/damage/damage.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2019-07-27 07:57:27 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2019-07-27 07:57:27 +0000
commitd4a0bed4b91da9de86c311c7fef9a8aa9a6f500c (patch)
treea1b439049dee87bc951e190db93f5bbe8b43b0b5 /xserver/miext/damage/damage.c
parentb6bc775539a31f663f9e22ce3ccaf0aa96adf3b6 (diff)
Update to xserver 1.20.5. Tested by jsg@
Diffstat (limited to 'xserver/miext/damage/damage.c')
-rw-r--r--xserver/miext/damage/damage.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/xserver/miext/damage/damage.c b/xserver/miext/damage/damage.c
index 2fae03fc2..f3ae4ebbc 100644
--- a/xserver/miext/damage/damage.c
+++ b/xserver/miext/damage/damage.c
@@ -829,16 +829,36 @@ damagePolyPoint(DrawablePtr pDrawable,
/* this could be slow if the points were spread out */
- while (--nptTmp) {
- pptTmp++;
- if (box.x1 > pptTmp->x)
- box.x1 = pptTmp->x;
- else if (box.x2 < pptTmp->x)
- box.x2 = pptTmp->x;
- if (box.y1 > pptTmp->y)
- box.y1 = pptTmp->y;
- else if (box.y2 < pptTmp->y)
- box.y2 = pptTmp->y;
+ if (mode == CoordModePrevious) {
+ int x = box.x1;
+ int y = box.y1;
+
+ while (--nptTmp) {
+ pptTmp++;
+ x += pptTmp->x;
+ y += pptTmp->y;
+ if (box.x1 > x)
+ box.x1 = x;
+ else if (box.x2 < x)
+ box.x2 = x;
+ if (box.y1 > y)
+ box.y1 = y;
+ else if (box.y2 < y)
+ box.y2 = y;
+ }
+ }
+ else {
+ while (--nptTmp) {
+ pptTmp++;
+ if (box.x1 > pptTmp->x)
+ box.x1 = pptTmp->x;
+ else if (box.x2 < pptTmp->x)
+ box.x2 = pptTmp->x;
+ if (box.y1 > pptTmp->y)
+ box.y1 = pptTmp->y;
+ else if (box.y2 < pptTmp->y)
+ box.y2 = pptTmp->y;
+ }
}
box.x2++;
@@ -1696,7 +1716,7 @@ DamageCreate(DamageReportFunc damageReport,
damageScrPriv(pScreen);
DamagePtr pDamage;
- pDamage = dixAllocateObjectWithPrivates(DamageRec, PRIVATE_DAMAGE);
+ pDamage = calloc(1, sizeof(DamageRec));
if (!pDamage)
return 0;
pDamage->pNext = 0;
@@ -1821,7 +1841,7 @@ DamageDestroy(DamagePtr pDamage)
(*pScrPriv->funcs.Destroy) (pDamage);
RegionUninit(&pDamage->damage);
RegionUninit(&pDamage->pendingDamage);
- dixFreeObjectWithPrivates(pDamage, PRIVATE_DAMAGE);
+ free(pDamage);
}
Bool