Commit a60e61ac authored by Adrian Johnson's avatar Adrian Johnson Committed by Albert Astals Cid

ps: use PS Patterns for tiling fill when PS level >= 2

parent 9938770e
......@@ -692,7 +692,7 @@ void CairoOutputDev::eoFill(GfxState *state) {
}
GBool CairoOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, Dict *resDict,
double *pmat, int paintType, int /*tilingType*/, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep)
......
......@@ -159,7 +159,7 @@ public:
virtual void eoFill(GfxState *state);
virtual void clipToStrokePath(GfxState *state);
virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, Dict *resDict,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep);
......@@ -412,7 +412,7 @@ public:
virtual void fill(GfxState *state) { }
virtual void eoFill(GfxState *state) { }
virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, Dict *resDict,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep) { return gTrue; }
......
......@@ -2142,8 +2142,8 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat,
m1[5] = m[5];
if (out->useTilingPatternFill() &&
out->tilingPatternFill(state, catalog, tPat->getContentStream(),
tPat->getMatrix(), tPat->getPaintType(), tPat->getResDict(),
m1, tPat->getBBox(),
tPat->getMatrix(), tPat->getPaintType(), tPat->getTilingType(),
tPat->getResDict(), m1, tPat->getBBox(),
xi0, yi0, xi1, yi1, xstep, ystep)) {
goto restore;
} else {
......
......@@ -197,7 +197,7 @@ public:
virtual void fill(GfxState * /*state*/) {}
virtual void eoFill(GfxState * /*state*/) {}
virtual GBool tilingPatternFill(GfxState * /*state*/, Catalog * /*cat*/, Object * /*str*/,
double * /*pmat*/, int /*paintType*/, Dict * /*resDict*/,
double * /*pmat*/, int /*paintType*/, int /*tilingType*/, Dict * /*resDict*/,
double * /*mat*/, double * /*bbox*/,
int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/,
double /*xStep*/, double /*yStep*/)
......
......@@ -4005,11 +4005,11 @@ void PSOutputDev::eoFill(GfxState *state) {
writePS("f*\n");
}
GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep) {
GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep) {
PDFRectangle box;
Gfx *gfx;
......@@ -4072,6 +4072,55 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
return gTrue;
}
GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep) {
PDFRectangle box;
Gfx *gfx;
double cxMin, cyMin, cxMax, cyMax;
writePS("<<\n /PatternType 1\n");
writePSFmt(" /PaintType {0:d}\n", paintType);
writePSFmt(" /TilingType {0:d}\n", tilingType);
writePSFmt(" /BBox [{0:.6g} {1:.6g} {2:.6g} {3:.6g}]\n", bbox[0], bbox[1], bbox[2], bbox[3]);
writePSFmt(" /XStep {0:.6g}\n", xStep);
writePSFmt(" /YStep {0:.6g}\n", yStep);
writePS(" /PaintProc { \n");
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);
inType3Char = gTrue;
gfx->display(str);
inType3Char = gFalse;
delete gfx;
writePS(" }\n");
writePS(">>\n");
writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}]\n", pmat[0], pmat[1], pmat[2], pmat[3], pmat[4], pmat[5]);
writePS("makepattern setpattern\n");
state->getClipBBox(&cxMin, &cyMin, &cxMax, &cyMax);
writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} rectfill\n", cxMin, cyMin, cxMax - cxMin, cyMax - cyMin);
return gTrue;
}
GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep) {
if (level == psLevel1 || level == psLevel1Sep) {
return tilingPatternFillL1(state, cat, str, pmat, paintType, tilingType, resDict,
mat, bbox, x0, y0, x1, y1, xStep, yStep);
} else {
return tilingPatternFillL2(state, cat, str, pmat, paintType, tilingType, resDict,
mat, bbox, x0, y0, x1, y1, xStep, yStep);
}
}
GBool PSOutputDev::functionShadedFill(GfxState *state,
GfxFunctionShading *shading) {
double x0, y0, x1, y1;
......
......@@ -210,7 +210,7 @@ public:
virtual void fill(GfxState *state);
virtual void eoFill(GfxState *state);
virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, Dict *resDict,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep);
......@@ -338,6 +338,17 @@ private:
void dumpColorSpaceL2(GfxColorSpace *colorSpace,
GBool genXform, GBool updateColors,
GBool map01);
GBool tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep);
GBool tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep);
#if OPI_SUPPORT
void opiBegin20(GfxState *state, Dict *dict);
void opiBegin13(GfxState *state, Dict *dict);
......
......@@ -81,7 +81,7 @@ void PreScanOutputDev::eoFill(GfxState *state) {
}
GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Catalog *catalog, Object *str,
double *pmat, int paintType, Dict *resDict,
double *pmat, int paintType, int /*tilingType*/, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep) {
......
......@@ -80,7 +80,7 @@ public:
virtual void fill(GfxState *state);
virtual void eoFill(GfxState *state);
virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
double *pmat, int paintType, Dict *resDict,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep);
......
......@@ -3775,7 +3775,7 @@ void SplashOutputDev::setFreeTypeHinting(GBool enable, GBool enableSlightHinting
}
GBool SplashOutputDev::tilingPatternFill(GfxState *state, Catalog *catalog, Object *str,
double *ptm, int paintType, Dict *resDict,
double *ptm, int paintType, int /*tilingType*/, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep)
......
......@@ -271,7 +271,7 @@ public:
virtual void fill(GfxState *state);
virtual void eoFill(GfxState *state);
virtual GBool tilingPatternFill(GfxState *state, Catalog *catalog, Object *str,
double *pmat, int paintType, Dict *resDict,
double *pmat, int paintType, int tilingType, Dict *resDict,
double *mat, double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment