sna/trapezoids: Difference between two 32-bit quantities is 33-bits in size
When computing the edge distance, we subtract on 32-bit quantity from another. This requires 33-bits to store the full result so promote the subtraction to 64-bits (rather than the result of that subtraction as done currently). Reported-by: Jiri Slaby <jirislaby@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c76 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
4df0052a21
commit
f611f95804
|
|
@ -500,8 +500,8 @@ polygon_add_edge(struct polygon *polygon,
|
|||
} else {
|
||||
int64_t Ex, Ey, tmp;
|
||||
|
||||
Ex = (int64_t)(edge->p2.x - edge->p1.x) * FAST_SAMPLES_X;
|
||||
Ey = (int64_t)(edge->p2.y - edge->p1.y) * FAST_SAMPLES_Y * (2 << 16);
|
||||
Ex = ((int64_t)edge->p2.x - edge->p1.x) * FAST_SAMPLES_X;
|
||||
Ey = ((int64_t)edge->p2.y - edge->p1.y) * FAST_SAMPLES_Y * (2 << 16);
|
||||
assert(Ey > 0);
|
||||
|
||||
e->dxdy.quo = Ex * (2 << 16) / Ey;
|
||||
|
|
@ -594,8 +594,8 @@ polygon_add_line(struct polygon *polygon,
|
|||
} else {
|
||||
int64_t Ex, Ey, tmp;
|
||||
|
||||
Ex = (int64_t)(p2->x - p1->x) * FAST_SAMPLES_X;
|
||||
Ey = (int64_t)(p2->y - p1->y) * FAST_SAMPLES_Y * (2 << 16);
|
||||
Ex = ((int64_t)p2->x - p1->x) * FAST_SAMPLES_X;
|
||||
Ey = ((int64_t)p2->y - p1->y) * FAST_SAMPLES_Y * (2 << 16);
|
||||
|
||||
e->dxdy.quo = Ex * (2 << 16) / Ey;
|
||||
e->dxdy.rem = Ex * (2 << 16) % Ey;
|
||||
|
|
|
|||
|
|
@ -553,8 +553,8 @@ polygon_add_edge(struct polygon *polygon,
|
|||
edge->p2.x - edge->p1.x,
|
||||
edge->p2.y - edge->p1.y));
|
||||
|
||||
Ex = (int64_t)(edge->p2.x - edge->p1.x) * SAMPLES_X;
|
||||
Ey = (int64_t)(edge->p2.y - edge->p1.y) * SAMPLES_Y * (2 << 16);
|
||||
Ex = ((int64_t)edge->p2.x - edge->p1.x) * SAMPLES_X;
|
||||
Ey = ((int64_t)edge->p2.y - edge->p1.y) * SAMPLES_Y * (2 << 16);
|
||||
assert(Ey > 0);
|
||||
e->dxdy.quo = Ex * (2 << 16) / Ey;
|
||||
e->dxdy.rem = Ex * (2 << 16) % Ey;
|
||||
|
|
@ -663,8 +663,8 @@ polygon_add_line(struct polygon *polygon,
|
|||
p2->x - p1->x,
|
||||
p2->y - p1->y));
|
||||
|
||||
Ex = (int64_t)(p2->x - p1->x) * SAMPLES_X;
|
||||
Ey = (int64_t)(p2->y - p1->y) * SAMPLES_Y * (2 << 16);
|
||||
Ex = ((int64_t)p2->x - p1->x) * SAMPLES_X;
|
||||
Ey = ((int64_t)p2->y - p1->y) * SAMPLES_Y * (2 << 16);
|
||||
e->dxdy.quo = Ex * (2 << 16) / Ey;
|
||||
e->dxdy.rem = Ex * (2 << 16) % Ey;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue