From 03f4184d39cf93e8dac27b1ca2a68ce9f84e8357 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 26 Oct 2012 13:57:30 +0100 Subject: [PATCH] sna: Ensure that the trap is clipped if it ends within the boundary pixel Reported-by: Jiri Slaby References: https://bugs.freedesktop.org/show_bug.cgi?id=56395 Signed-off-by: Chris Wilson --- src/sna/sna_trapezoids.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index 482abd3..008ba2e 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -3073,13 +3073,13 @@ lerp32_unaligned_box_row(PixmapPtr scratch, uint32_t color, uint8_t covered) { int16_t x1 = pixman_fixed_to_int(trap->left.p1.x) + dx; - int16_t fx1 = grid_coverage(SAMPLES_X, trap->left.p1.x); + uint16_t fx1 = grid_coverage(SAMPLES_X, trap->left.p1.x); int16_t x2 = pixman_fixed_to_int(trap->right.p2.x) + dx; - int16_t fx2 = grid_coverage(SAMPLES_X, trap->right.p2.x); + uint16_t fx2 = grid_coverage(SAMPLES_X, trap->right.p2.x); if (x1 < extents->x1) x1 = extents->x1, fx1 = 0; - if (x2 > extents->x2) + if (x2 >= extents->x2) x2 = extents->x2, fx2 = 0; DBG(("%s: x=(%d.%d, %d.%d), y=%dx%d, covered=%d\n", __FUNCTION__, @@ -3171,13 +3171,13 @@ pixsolid_unaligned_box_row(struct pixman_inplace *pi, uint8_t covered) { int16_t x1 = pixman_fixed_to_int(trap->left.p1.x); - int16_t fx1 = grid_coverage(SAMPLES_X, trap->left.p1.x); + uint16_t fx1 = grid_coverage(SAMPLES_X, trap->left.p1.x); int16_t x2 = pixman_fixed_to_int(trap->right.p1.x); - int16_t fx2 = grid_coverage(SAMPLES_X, trap->right.p1.x); + uint16_t fx2 = grid_coverage(SAMPLES_X, trap->right.p1.x); if (x1 < extents->x1) x1 = extents->x1, fx1 = 0; - if (x2 > extents->x2) + if (x2 >= extents->x2) x2 = extents->x2, fx2 = 0; if (x1 < x2) { @@ -3276,9 +3276,9 @@ composite_unaligned_boxes_inplace__solid(CARD8 op, uint32_t color, extents = REGION_RECTS(&clip); while (count--) { int16_t y1 = dy + pixman_fixed_to_int(t->top); - int16_t fy1 = pixman_fixed_frac(t->top); + uint16_t fy1 = pixman_fixed_frac(t->top); int16_t y2 = dy + pixman_fixed_to_int(t->bottom); - int16_t fy2 = pixman_fixed_frac(t->bottom); + uint16_t fy2 = pixman_fixed_frac(t->bottom); DBG(("%s: t=(%d, %d), (%d, %d), extents (%d, %d), (%d, %d)\n", __FUNCTION__, @@ -3291,7 +3291,7 @@ composite_unaligned_boxes_inplace__solid(CARD8 op, uint32_t color, if (y1 < extents->y1) y1 = extents->y1, fy1 = 0; - if (y2 > extents->y2) + if (y2 >= extents->y2) y2 = extents->y2, fy2 = 0; if (y1 < y2) { @@ -3363,13 +3363,13 @@ pixman: extents = REGION_RECTS(&clip); while (count--) { int16_t y1 = pixman_fixed_to_int(t->top); - int16_t fy1 = pixman_fixed_frac(t->top); + uint16_t fy1 = pixman_fixed_frac(t->top); int16_t y2 = pixman_fixed_to_int(t->bottom); - int16_t fy2 = pixman_fixed_frac(t->bottom); + uint16_t fy2 = pixman_fixed_frac(t->bottom); if (y1 < extents->y1) y1 = extents->y1, fy1 = 0; - if (y2 > extents->y2) + if (y2 >= extents->y2) y2 = extents->y2, fy2 = 0; if (y1 < y2) { if (fy1) { @@ -3429,13 +3429,13 @@ pixmask_unaligned_box_row(struct pixman_inplace *pi, uint8_t covered) { int16_t x1 = pixman_fixed_to_int(trap->left.p1.x); - int16_t fx1 = grid_coverage(SAMPLES_X, trap->left.p1.x); + uint16_t fx1 = grid_coverage(SAMPLES_X, trap->left.p1.x); int16_t x2 = pixman_fixed_to_int(trap->right.p1.x); - int16_t fx2 = grid_coverage(SAMPLES_X, trap->right.p1.x); + uint16_t fx2 = grid_coverage(SAMPLES_X, trap->right.p1.x); if (x1 < extents->x1) x1 = extents->x1, fx1 = 0; - if (x2 > extents->x2) + if (x2 >= extents->x2) x2 = extents->x2, fx2 = 0; if (x1 < x2) { @@ -3526,9 +3526,9 @@ composite_unaligned_boxes_inplace(CARD8 op, extents = REGION_RECTS(&clip); while (count--) { int16_t y1 = pixman_fixed_to_int(t->top); - int16_t fy1 = pixman_fixed_frac(t->top); + uint16_t fy1 = pixman_fixed_frac(t->top); int16_t y2 = pixman_fixed_to_int(t->bottom); - int16_t fy2 = pixman_fixed_frac(t->bottom); + uint16_t fy2 = pixman_fixed_frac(t->bottom); if (y1 < extents->y1) y1 = extents->y1, fy1 = 0; -- 1.7.10.4