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 bca08dc415 [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>
This commit is contained in:
parent
2b978c71e4
commit
ea09d830c8
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue