summaryrefslogtreecommitdiff
path: root/draw
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2011-08-01 11:55:08 +0100
committerRobin Watts <Robin.Watts@artifex.com>2011-08-01 14:11:53 +0100
commitd451b09f75625a1b902c14afdede5242ad66713a (patch)
tree4430f7ec25d1f6d80214bf3fafa0ab65719b10cd /draw
parent5a46065a0df691a79b75f5e61e34e344afd5349a (diff)
downloadmupdf-d451b09f75625a1b902c14afdede5242ad66713a.tar.xz
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.
Diffstat (limited to 'draw')
-rw-r--r--draw/draw_scale.c8
1 files changed, 8 insertions, 0 deletions
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 <windows.h>
@@ -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));