summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-op-run.c
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2015-01-18 16:37:41 +0100
committerSimon Bünzli <zeniko@gmail.com>2015-01-20 20:55:58 +0100
commit57fbed681778012810594a3974906ed767b11dbf (patch)
tree1f518a5da59819f1857134cf683d3b159c55495c /source/pdf/pdf-op-run.c
parent3f7e3314739c91a170677954f160ee978eed76c7 (diff)
downloadmupdf-57fbed681778012810594a3974906ed767b11dbf.tar.xz
don't omit patterns with huge xstep/ystep values
If a pattern is expected to be rendered exactly once and its relevant part covers the target area, the xstep and ystep values may be far larger than the pattern's relevant content. Due to rounding applied in pdf_show_pattern, such patterns have been omitted so far. This issue is exposed e.g. by the document linked from http://forums.fofou.org/sumatrapdf/topic?id=3184639 .
Diffstat (limited to 'source/pdf/pdf-op-run.c')
-rw-r--r--source/pdf/pdf-op-run.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c
index 22e6a4be..73f89fd3 100644
--- a/source/pdf/pdf-op-run.c
+++ b/source/pdf/pdf-op-run.c
@@ -671,6 +671,13 @@ pdf_show_pattern(pdf_csi *csi, pdf_run_state *pr, pdf_pattern *pat, pdf_gstate *
y0 = floorf(fy0 + 0.001);
x1 = ceilf(fx1 - 0.001);
y1 = ceilf(fy1 - 0.001);
+ /* The above adjustments cause problems for sufficiently
+ * large values for xstep/ystep which may be used if the
+ * pattern is expected to be rendered exactly once. */
+ if (fx1 > fx0 && x1 == x0)
+ x1 = x0 + 1;
+ if (fy1 > fy0 && y1 == y0)
+ y1 = y0 + 1;
for (y = y0; y < y1; y++)
{