summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-09-01 15:50:29 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-09-01 15:51:31 +0100
commit695e7115efab96c4467dc926be07dc2609011720 (patch)
tree985ffc66f102865bd2f9392e83a8d34b98831ce8
parent9a563ea03b6ad87d41bc091c5819e6c462100450 (diff)
sna/trapezoids: Edges may lie out of bounds
We cannot assume that the edge lies completely within the target, so we must make sure that the initial prev_x is truly less than any possible value whilst sorting intersections. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_trapezoids.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 4dceba9f..4698f7f3 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -602,7 +602,7 @@ polygon_init(struct polygon *polygon,
{
unsigned h = ymax - ymin;
unsigned num_buckets =
- EDGE_Y_BUCKET_INDEX(ymax+EDGE_Y_BUCKET_HEIGHT-1, ymin);
+ EDGE_Y_BUCKET_INDEX(ymax+EDGE_Y_BUCKET_HEIGHT-1, ymin);
if (unlikely(h > 0x7FFFFFFFU - EDGE_Y_BUCKET_HEIGHT))
goto bail_no_mem; /* even if you could, you wouldn't want to. */
@@ -862,8 +862,8 @@ inline static void
nonzero_subrow(struct active_list *active, struct cell_list *coverages)
{
struct edge *edge = active->head.next;
- grid_scaled_x_t prev_x = -1;
- int winding = 0, xstart = -1;
+ grid_scaled_x_t prev_x = INT_MIN;
+ int winding = 0, xstart = INT_MIN;
cell_list_rewind (coverages);
@@ -875,7 +875,7 @@ nonzero_subrow(struct active_list *active, struct cell_list *coverages)
if (edge->next->x.quo != edge->x.quo) {
cell_list_add_subspan(coverages,
xstart, edge->x.quo);
- xstart = -1;
+ xstart = INT_MIN;
}
} else if (xstart < 0)
xstart = edge->x.quo;