From d451b09f75625a1b902c14afdede5242ad66713a Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 1 Aug 2011 11:55:08 +0100 Subject: Fix bug 691629; avoid aa'd edge pixels due to bad weight calcs. When we calculate weights for scaling, 'wrap' weight calculations slightly to avoid getting antialiased edge pixels in grid fitted images. Seems to solve bug 691629 as much as it's possible to. --- draw/draw_scale.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'draw') diff --git a/draw/draw_scale.c b/draw/draw_scale.c index 40a5deff..6bf741ca 100644 --- a/draw/draw_scale.c +++ b/draw/draw_scale.c @@ -16,6 +16,12 @@ and then positioning it at (frac(x),frac(y)). */ #define SINGLE_PIXEL_SPECIALS +/* It's important that we count contributions carefully as they approach the + * edges, otherwise we end up with weights in the outside pixels of + * grid-fitted images that don't sum to 256, and hence get lines across the + * page. See bug #691629. */ +#define WRAP + #ifdef DEBUG_SCALING #ifdef WIN32 #include @@ -357,6 +363,8 @@ add_weight(fz_weights *weights, int j, int i, fz_scale_filter *filter, i = src_w-1; weight = 0; } + if (weight == 0) + return; #endif DBUG(("add_weight[%d][%d] = %d(%g) dist=%g\n",j,i,weight,f,dist)); -- cgit v1.2.3