summaryrefslogtreecommitdiff
path: root/src/sna/sna_trapezoids_imprecise.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-02-25 17:20:28 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-02-25 17:40:55 +0000
commitea09d830c8651fe854ba772a9e28e8a5f601b1c1 (patch)
tree89faeb9400d26ce93c6e06ec5055a66bb0ff4c42 /src/sna/sna_trapezoids_imprecise.c
parent2b978c71e4a9f54e728fb8abf2734c260ee74916 (diff)
sna/trapezoids: Restore lost xTrapezoidValid() checks
When fixing up the sample projection of the trapezoids, we lost the safety check that the trapezoid was valid. Fixes regression from commit bca08dc4155c0ee304c60340ccf95fe7b03ac11b [2.99.917] Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Mon Sep 29 19:30:03 2014 +0100 sna/trapezoids: Fix loss of precision through projection onto sample grid Reported-by: Jiri Slaby <jirislaby@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c95 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_trapezoids_imprecise.c')
-rw-r--r--src/sna/sna_trapezoids_imprecise.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sna/sna_trapezoids_imprecise.c b/src/sna/sna_trapezoids_imprecise.c
index 60c13875..df22add5 100644
--- a/src/sna/sna_trapezoids_imprecise.c
+++ b/src/sna/sna_trapezoids_imprecise.c
@@ -962,6 +962,16 @@ tor_add_trapezoid(struct tor *tor,
const xTrapezoid *t,
int dx, int dy)
{
+ if (!xTrapezoidValid(t)) {
+ __DBG(("%s: skipping invalid trapezoid: top=%d, bottom=%d, left=(%d, %d), (%d, %d), right=(%d, %d), (%d, %d)\n",
+ __FUNCTION__,
+ t->top, t->bottom,
+ t->left.p1.x, t->left.p1.y,
+ t->left.p2.x, t->left.p2.y,
+ t->right.p1.x, t->right.p1.y,
+ t->right.p2.x, t->right.p2.y));
+ return;
+ }
polygon_add_edge(tor->polygon, t, &t->left, 1, dx, dy);
polygon_add_edge(tor->polygon, t, &t->right, -1, dx, dy);
}