diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-02-24 21:01:29 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-02-24 21:01:29 -0500 |
commit | e0f1d8410715083498a35284ea7e5bb71fabe090 (patch) | |
tree | 37cc04da97f23342bdaefb650e19b8af225f5f23 | |
parent | 16ef3ab230047221f813905d390bf762a3d8508a (diff) | |
parent | 282f5cf8b821a34bab1e32957913ef8d9f9ee43c (diff) |
Merge branch 'trap-fixes'
-rw-r--r-- | pixman/pixman-edge-imp.h | 12 | ||||
-rw-r--r-- | pixman/pixman-private.h | 4 | ||||
-rw-r--r-- | pixman/pixman-trap.c | 14 |
3 files changed, 17 insertions, 13 deletions
diff --git a/pixman/pixman-edge-imp.h b/pixman/pixman-edge-imp.h index 74720d10..a4698edd 100644 --- a/pixman/pixman-edge-imp.h +++ b/pixman/pixman-edge-imp.h @@ -49,10 +49,14 @@ RASTERIZE_EDGES (pixman_image_t *image, rx = r->x; #if N_BITS == 1 /* For the non-antialiased case, round the coordinates up, in effect - * sampling the center of the pixel. (The AA case does a similar - * adjustment in RENDER_SAMPLES_X) */ - lx += X_FRAC_FIRST(1); - rx += X_FRAC_FIRST(1); + * sampling just slightly to the left of the pixel. This is so that + * when the sample point lies exactly on the line, we round towards + * north-west. + * + * (The AA case does a similar adjustment in RENDER_SAMPLES_X) + */ + lx += X_FRAC_FIRST(1) - pixman_fixed_e; + rx += X_FRAC_FIRST(1) - pixman_fixed_e; #endif /* clip X */ if (lx < 0) diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 048d030e..7ed8aa7a 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -349,13 +349,13 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker, #define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC (n)) #define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC (n) - 1) * STEP_Y_SMALL (n)) -#define Y_FRAC_FIRST(n) (STEP_Y_SMALL (n) / 2) +#define Y_FRAC_FIRST(n) (STEP_Y_BIG (n) / 2) #define Y_FRAC_LAST(n) (Y_FRAC_FIRST (n) + (N_Y_FRAC (n) - 1) * STEP_Y_SMALL (n)) #define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC (n)) #define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC (n) - 1) * STEP_X_SMALL (n)) -#define X_FRAC_FIRST(n) (STEP_X_SMALL (n) / 2) +#define X_FRAC_FIRST(n) (STEP_X_BIG (n) / 2) #define X_FRAC_LAST(n) (X_FRAC_FIRST (n) + (N_X_FRAC (n) - 1) * STEP_X_SMALL (n)) #define RENDER_SAMPLES_X(x, n) \ diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c index 962cbb39..8353992c 100644 --- a/pixman/pixman-trap.c +++ b/pixman/pixman-trap.c @@ -28,8 +28,8 @@ #include "pixman-private.h" /* - * Compute the smallest value no less than y which is on a - * grid row + * Compute the smallest value greater than or equal to y which is on a + * grid row. */ PIXMAN_EXPORT pixman_fixed_t @@ -38,7 +38,7 @@ pixman_sample_ceil_y (pixman_fixed_t y, int n) pixman_fixed_t f = pixman_fixed_frac (y); pixman_fixed_t i = pixman_fixed_floor (y); - f = ((f + Y_FRAC_FIRST (n)) / STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) + + f = DIV (f - Y_FRAC_FIRST (n) + (STEP_Y_SMALL (n) - pixman_fixed_e), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) + Y_FRAC_FIRST (n); if (f > Y_FRAC_LAST (n)) @@ -57,8 +57,8 @@ pixman_sample_ceil_y (pixman_fixed_t y, int n) } /* - * Compute the largest value no greater than y which is on a - * grid row + * Compute the largest value strictly less than y which is on a + * grid row. */ PIXMAN_EXPORT pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y, @@ -67,7 +67,7 @@ pixman_sample_floor_y (pixman_fixed_t y, pixman_fixed_t f = pixman_fixed_frac (y); pixman_fixed_t i = pixman_fixed_floor (y); - f = DIV (f - Y_FRAC_FIRST (n), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) + + f = DIV (f - pixman_fixed_e - Y_FRAC_FIRST (n), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) + Y_FRAC_FIRST (n); if (f < Y_FRAC_FIRST (n)) @@ -380,7 +380,7 @@ pixman_rasterize_trapezoid (pixman_image_t * image, if (pixman_fixed_to_int (b) >= height) b = pixman_int_to_fixed (height) - 1; b = pixman_sample_floor_y (b, bpp); - + if (b >= t) { /* initialize edge walkers */ |