From 5e7afa8bff944b2e7e2d3d10adbb1ae4958b743f Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 24 Dec 2013 17:18:55 +0000 Subject: Bug 694587: Fix pattern repeat calculation The pattern repeat calculation should be done in pattern space, but one of the arguments in the calculation was being taken from device space. Fix this. Also only apply the bias in the case where the bias would make it larger. 173 progressions. --- source/fitz/draw-device.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index a92c88b5..355022f3 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -1857,9 +1857,15 @@ fz_draw_end_tile(fz_device *devp) * single tile) (see fts_15_1506.pdf for an example). This means that * we have to bias the left hand/bottom edge calculations by the * difference between the step and the width/height of the tile. */ - /* state[0].scissor = view, transformed by ctm */ - x0 = floorf((area.x0 + xstep - state[0].scissor.x1 + state[0].scissor.x0) / xstep); - y0 = floorf((area.y0 + ystep - state[0].scissor.y1 + state[0].scissor.y0) / ystep); + /* scissor, xstep and area are all in pattern space. */ + x0 = xstep - scissor.x1 + scissor.x0; + if (x0 > 0) + x0 = 0; + y0 = ystep - scissor.y1 + scissor.y0; + if (y0 > 0) + y0 = 0; + x0 = floorf((area.x0 + x0) / xstep); + y0 = floorf((area.y0 + y0) / ystep); x1 = ceilf(area.x1 / xstep); y1 = ceilf(area.y1 / ystep); -- cgit v1.2.3