From cc89f3525dfc852f6491d80d6e5c1194d431ab38 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 19 Apr 2012 17:33:42 +0100 Subject: Bug 692847: Tiling problem fix. The test in mupdf for 'is more than one tile needed' is wrong, as it assumes that tile bboxes start at 0. Fix that, and everything else should work OK. --- pdf/pdf_interpret.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'pdf') diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index 5b2f75a1..a11b8c30 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -1264,18 +1264,19 @@ pdf_show_pattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what) ptm = fz_concat(pat->matrix, csi->top_ctm); invptm = fz_invert_matrix(ptm); - /* patterns are painted using the ctm in effect at the beginning of the content stream */ - /* get bbox of shape in pattern space for stamping */ + /* patterns are painted using the ctm in effect at the beginning + * of the content stream. area = bbox of shape to be filled in + * device space. Map it back to pattern space. */ area = fz_transform_rect(invptm, area); /* When calculating the number of tiles required, we adjust by a small * amount to allow for rounding errors. By choosing this amount to be * smaller than 1/256, we guarantee we won't cause problems that will * be visible even under our most extreme antialiasing. */ - x0 = floorf(area.x0 / pat->xstep + 0.001); - y0 = floorf(area.y0 / pat->ystep + 0.001); - x1 = ceilf(area.x1 / pat->xstep - 0.001); - y1 = ceilf(area.y1 / pat->ystep - 0.001); + x0 = floorf((area.x0 - pat->bbox.x0) / pat->xstep + 0.001); + y0 = floorf((area.y0 - pat->bbox.y0) / pat->ystep + 0.001); + x1 = ceilf((area.x1 - pat->bbox.x0) / pat->xstep - 0.001); + y1 = ceilf((area.y1 - pat->bbox.y0) / pat->ystep - 0.001); oldtopctm = csi->top_ctm; oldtop = csi->gtop; -- cgit v1.2.3