From 0e0d6f88cb1e8628c2e464fe27aba2b3a6d7a8ca Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 7 Oct 2011 20:29:36 +1030 Subject: [PATCH 2/2] ps: emit non repeating patterns in PSOutput with inType3Char = true instead of falling back to Gfx. This avoids emitting the image data twice. --- poppler/PSOutputDev.cc | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 6371668..09889f8 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -4111,6 +4111,29 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { + if (x1 - x0 == 1 && y1 - y0 == 1) { + // Don't need to use patterns if only one instance of the pattern is used + PDFRectangle box; + Gfx *gfx; + double x, y, tx, ty; + + x = x0 * xStep; + y = y0 * yStep; + tx = x * mat[0] + y * mat[2] + mat[4]; + ty = x * mat[1] + y * mat[3] + mat[5]; + box.x1 = bbox[0]; + box.y1 = bbox[1]; + box.x2 = bbox[2]; + box.y2 = bbox[3]; + gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL); + writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] cm\n", mat[0], mat[1], mat[2], mat[3], tx, ty); + inType3Char = gTrue; + gfx->display(str); + inType3Char = gFalse; + delete gfx; + return gTrue; + } + if (level == psLevel1 || level == psLevel1Sep) { return tilingPatternFillL1(state, cat, str, pmat, paintType, tilingType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); -- 1.7.4.1