diff --git a/splash/Splash.cc b/splash/Splash.cc index 047bbe8..e50c2a3 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -2265,7 +2265,8 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, } } - xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue); + xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue, + state->clip->getYMinI() == state->clip->getYMaxI() || state->clip->getXMinI() == state->clip->getXMaxI()); if (vectorAntialias && !inShading) { xPath->aaScale(); } diff --git a/splash/SplashXPath.cc b/splash/SplashXPath.cc index b82d355..9288e1e 100644 --- a/splash/SplashXPath.cc +++ b/splash/SplashXPath.cc @@ -66,7 +66,8 @@ inline void SplashXPath::transform(SplashCoord *matrix, //------------------------------------------------------------------------ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool closeSubpaths) { + SplashCoord flatness, GBool closeSubpaths, + GBool adjustLines) { SplashPathHint *hint; SplashXPathPoint *pts; SplashXPathAdjust *adjusts, *adjust; @@ -124,13 +125,27 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix, // adj0=10.4, adj1=11.6 --> x0=10, x1=12), but it has the // benefit of making adjacent strokes/fills line up without any // gaps between them - x0 = splashRound(adj0); - x1 = splashRound(adj1); - if (x1 == x0) { - x1 = x1 + 1; + if (!adjustLines) { + x0 = splashRound(adj0); + x1 = splashRound(adj1); + if (x1 == x0) { + x1 = x1 + 1; + } + adjusts[i].x0 = (SplashCoord)x0; + adjusts[i].x1 = (SplashCoord)x1 - 0.01; + } else { + // the ahead adjustments moves thin lines (clip rectangle with + // empty width or height) out of clip area, here we need + // a special adjustment: + x0 = splashFloor(adj0 + 0.1); + x1 = splashFloor(adj1 + 0.1); + adjusts[i].x0 = (SplashCoord)x0; + if (x1 == x0) { + adjusts[i].x1 = (SplashCoord)x1 + splashAASize / 2 - 0.01; + } else { + adjusts[i].x1 = (SplashCoord)x1 - 0.01; + } } - adjusts[i].x0 = (SplashCoord)x0; - adjusts[i].x1 = (SplashCoord)x1 - 0.01; adjusts[i].xm = (SplashCoord)0.5 * (adjusts[i].x0 + adjusts[i].x1); adjusts[i].firstPt = hint->firstPt; adjusts[i].lastPt = hint->lastPt; diff --git a/splash/SplashXPath.h b/splash/SplashXPath.h index db06978..3f73564 100644 --- a/splash/SplashXPath.h +++ b/splash/SplashXPath.h @@ -50,7 +50,7 @@ public: // space, via . If is true, closes all open // subpaths. SplashXPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool closeSubpaths); + SplashCoord flatness, GBool closeSubpaths, GBool adjustLines = gFalse); // Copy an expanded path. SplashXPath *copy() { return new SplashXPath(this); }