summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-12 11:50:54 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-12 12:04:53 +0000
commit278c329b9e2aa9a94bd0d0ee73939814ac514e3d (patch)
tree04fdb588e864d2b89ecd6d14921d7f72a1bcf196
parent7ae45584327a10b05f7aee99bcb71e9d990a3e9b (diff)
sna/trapezoids: Further improve the clipping criteria for inplace traps
Not only must we defend against the span starting too far to the right, we must also defend against the span terminating too far to the left. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_trapezoids.c59
1 files changed, 31 insertions, 28 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index e76f9186..f936b4b0 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -1520,37 +1520,40 @@ inplace_subrow(struct active_list *active, int8_t *row,
winding += edge->dir;
if (0 == winding) {
- if (edge->x.quo >= FAST_SAMPLES_X * width) {
- *max = width;
- } else if (edge->next->x.quo != edge->x.quo) {
- grid_scaled_x_t fx;
- int ix;
-
- xstart = edge->x.quo;
- FAST_SAMPLES_X_TO_INT_FRAC(xstart, ix, fx);
- row[ix++] -= FAST_SAMPLES_X - fx;
- if (ix < width)
- row[ix] -= fx;
-
- if (ix > *max)
- *max = ix;
-
- xstart = INT_MIN;
+ if (edge->next->x.quo != edge->x.quo) {
+ if (edge->x.quo <= xstart) {
+ xstart = INT_MIN;
+ } else {
+ grid_scaled_x_t fx;
+ int ix;
+
+ if (xstart < FAST_SAMPLES_X * width) {
+ FAST_SAMPLES_X_TO_INT_FRAC(xstart, ix, fx);
+ if (ix < *min)
+ *min = ix;
+
+ row[ix++] += FAST_SAMPLES_X - fx;
+ if (ix < width)
+ row[ix] += fx;
+ }
+
+ xstart = edge->x.quo;
+ if (xstart < FAST_SAMPLES_X * width) {
+ FAST_SAMPLES_X_TO_INT_FRAC(xstart, ix, fx);
+ row[ix++] -= FAST_SAMPLES_X - fx;
+ if (ix < width)
+ row[ix] -= fx;
+
+ if (ix > *max)
+ *max = ix;
+
+ xstart = INT_MIN;
+ } else
+ *max = width;
+ }
}
} else if (xstart < 0) {
xstart = MAX(edge->x.quo, 0);
- if (xstart < FAST_SAMPLES_X * width) {
- grid_scaled_x_t fx;
- int ix;
-
- FAST_SAMPLES_X_TO_INT_FRAC(xstart, ix, fx);
- if (ix < *min)
- *min = ix;
-
- row[ix++] += FAST_SAMPLES_X - fx;
- if (ix < width)
- row[ix] += fx;
- }
}
if (--edge->height_left) {