--- poppler-0.18.0-tile/poppler/PSOutputDev.cc- 2011-08-21 17:22:54.000000000 -0400 +++ poppler-0.18.0-tile/poppler/PSOutputDev.cc 2011-10-04 15:45:15.352617243 -0400 @@ -4040,10 +4040,13 @@ box.y2 = bbox[3]; gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL); writePS("/x {\n"); +#if 0 + /* setcachedevice locks the current color and doesn't work with PaintType 2 */ if (paintType == 2) { writePSFmt("{0:.6g} 0 {1:.6g} {2:.6g} {3:.6g} {4:.6g} setcachedevice\n", xStep, bbox[0], bbox[1], bbox[2], bbox[3]); } else +#endif { if (x1 - 1 <= x0) { writePS("1 0 setcharwidth\n"); @@ -4081,7 +4084,15 @@ PDFRectangle box; Gfx *gfx; double cxMin, cyMin, cxMax, cyMax; + Matrix ctm, ictm; + state->getCTM(&ctm); + ctm.invertTo(&ictm); + writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] cm\n", ictm.m[0], ictm.m[1], ictm.m[2], ictm.m[3], ictm.m[4], ictm.m[5]); + if (paintType == 2) { + /* setpattern with PaintType 2 needs the paint color */ + writePS("currentcolor\n"); + } writePS("<<\n /PatternType 1\n"); writePSFmt(" /PaintType {0:d}\n", paintType); writePSFmt(" /TilingType {0:d}\n", tilingType); @@ -4113,9 +4124,6 @@ double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { - if (x1 - x0 == 1 && y1 - y0 == 1) - return gFalse; // Don't need to use patterns if only one instance of the pattern is used - if (level == psLevel1 || level == psLevel1Sep) { return tilingPatternFillL1(state, cat, str, pmat, paintType, tilingType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep);