summaryrefslogtreecommitdiff
path: root/src/sna/sna_trapezoids_precise.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_precise.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_precise.c')
-rw-r--r--src/sna/sna_trapezoids_precise.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sna/sna_trapezoids_precise.c b/src/sna/sna_trapezoids_precise.c
index e7ea4337..f1532d31 100644
--- a/src/sna/sna_trapezoids_precise.c
+++ b/src/sna/sna_trapezoids_precise.c
@@ -1023,6 +1023,16 @@ tor_init(struct tor *converter, const BoxRec *box, int num_edges)
static void
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);
}