summaryrefslogtreecommitdiff
path: root/miext
diff options
context:
space:
mode:
authorCedric Roux <sed@free.fr>2018-09-12 19:14:18 +0200
committerEric Anholt <eric@anholt.net>2018-09-25 21:27:08 -0700
commitbc36594e0eb8bfa5a673bcfd8c8168f70994a1df (patch)
tree0f741278d535c68415eb0f9593f5ed353a8739d2 /miext
parent734b2d6907f730571a2805cbc53fe7056190f19e (diff)
miext/damage: take care of the coordinate mode in damagePolyPoint
The mode (CoordModeOrigin or CoordModePrevious) was not taken into account when computing the box. The result was a bad drawing of points in some situations (on my hardware/software configuration, calling XDrawString followed by XDrawPoints in the mode CoordModePrevious). Signed-off-by: Cedric Roux <sed@free.fr> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'miext')
-rw-r--r--miext/damage/damage.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index de14d5cc8..f3ae4ebbc 100644
--- a/miext/damage/damage.c
+++ b/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++;