From 57fbed681778012810594a3974906ed767b11dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Sun, 18 Jan 2015 16:37:41 +0100 Subject: 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 . --- source/pdf/pdf-op-run.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source') 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++) { -- cgit v1.2.3