diff options
Diffstat (limited to 'pixman/pixman-filter.c')
-rw-r--r-- | pixman/pixman-filter.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c index fa94532..5f3b752 100644 --- a/pixman/pixman-filter.c +++ b/pixman/pixman-filter.c @@ -237,14 +237,11 @@ create_1d_filter (int width, pixman_kernel_t sample, double scale, int n_phases, - pixman_fixed_t *pstart, - pixman_fixed_t *pend - ) + pixman_fixed_t *p) { - pixman_fixed_t *p = pstart; double step; int i; - if(width <= 0) return; + step = 1.0 / n_phases; for (i = 0; i < n_phases; ++i) @@ -261,7 +258,7 @@ create_1d_filter (int width, x1 = ceil (frac - width / 2.0 - 0.5); x2 = x1 + width; - assert( p >= pstart && p + (x2 - x1) <= pend ); /* assert validity of the following loop */ + total = 0; for (x = x1; x < x2; ++x) { @@ -290,10 +287,8 @@ create_1d_filter (int width, /* Normalize, with error diffusion */ p -= width; - assert(p >= pstart && p + (x2 - x1) <= pend); /* assert validity of the following loop */ - - total = 65536.0 / total; - new_total = 0; + total = 65536.0 / total; + new_total = 0; e = 0.0; for (x = x1; x < x2; ++x) { @@ -309,8 +304,6 @@ create_1d_filter (int width, * at the first sample, since that is the only one that * hasn't had any error diffused into it. */ - - assert(p - width >= pstart && p - width < pend); /* assert... */ *(p - width) += pixman_fixed_1 - new_total; } } @@ -472,16 +465,10 @@ pixman_filter_create_separable_convolution (int *n_values, params[2] = pixman_int_to_fixed (subsample_bits_x); params[3] = pixman_int_to_fixed (subsample_bits_y); - { - pixman_fixed_t - *xparams = params+4, - *yparams = xparams + width*subsample_x, - *endparams = params + *n_values; - create_1d_filter(width, reconstruct_x, sample_x, sx, subsample_x, - xparams, yparams); - create_1d_filter(height, reconstruct_y, sample_y, sy, subsample_y, - yparams, endparams); - } + create_1d_filter (width, reconstruct_x, sample_x, sx, subsample_x, + params + 4); + create_1d_filter (height, reconstruct_y, sample_y, sy, subsample_y, + params + 4 + width * subsample_x); #ifdef PIXMAN_GNUPLOT gnuplot_filter(width, subsample_x, params + 4); |