xf86-video-intel: src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Mar 12 05:42:33 PDT 2012


 src/sna/sna_trapezoids.c |   59 ++++++++++++++++++++++++-----------------------
 1 file changed, 31 insertions(+), 28 deletions(-)

New commits:
commit 278c329b9e2aa9a94bd0d0ee73939814ac514e3d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Mar 12 11:50:54 2012 +0000

    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 at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index e76f918..f936b4b 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) {


More information about the xorg-commit mailing list