diff --git a/splash/Splash.cc b/splash/Splash.cc index 34bea6a..1f100fe 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -2360,6 +2360,31 @@ SplashError Splash::fill(SplashPath *path, GBool eo) { return fillWithPattern(path, eo, state->fillPattern, state->fillAlpha); } +inline void Splash::getBBoxFP(SplashPath *path, SplashCoord *xMinA, SplashCoord *yMinA, + SplashCoord *xMaxA, SplashCoord *yMaxA) { + SplashCoord xMinFP, yMinFP, xMaxFP, yMaxFP, tx, ty; + + // make compiler happy: + xMinFP = xMaxFP = yMinFP = yMaxFP = 0; + for (int i = 0; i < path->length; ++i) { + transform(state->matrix, path->pts[i].x, path->pts[i].y, &tx, &ty); + if (i == 0) { + xMinFP = xMaxFP = tx; + yMinFP = yMaxFP = ty; + } else { + if (tx < xMinFP) xMinFP = tx; + if (tx > xMaxFP) xMaxFP = tx; + if (ty < yMinFP) yMinFP = ty; + if (ty > yMaxFP) yMaxFP = ty; + } + } + + *xMinA = xMinFP; + *yMinA = yMinFP; + *xMaxA = xMaxFP; + *yMaxA = yMaxFP; +} + SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, SplashPattern *pattern, SplashCoord alpha) { @@ -2439,6 +2464,16 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); } + if (eo && (yMinI == yMaxI || xMinI == xMaxI) && thinLineMode != splashThinLineDefault) { + SplashCoord delta, xMinFP, yMinFP, xMaxFP, yMaxFP; + getBBoxFP(path, &xMinFP, &yMinFP, &xMaxFP, &yMaxFP); + delta = (yMinI == yMaxI) ? yMaxFP - yMinFP : xMaxFP - xMinFP; + if (delta < 0.2) { + opClipRes = splashClipAllOutside; + return splashOk; + } + } + // check clipping if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) != splashClipAllOutside) { diff --git a/splash/Splash.h b/splash/Splash.h index 49bad83..8bcd1db 100644 --- a/splash/Splash.h +++ b/splash/Splash.h @@ -327,6 +327,7 @@ private: SplashCoord *matrix, SplashCoord flatness2, SplashPath *fPath); SplashPath *makeDashedPath(SplashPath *xPath); + void getBBoxFP(SplashPath *path, SplashCoord *xMinA, SplashCoord *yMinA, SplashCoord *xMaxA, SplashCoord *yMaxA); SplashError fillWithPattern(SplashPath *path, GBool eo, SplashPattern *pattern, SplashCoord alpha); GBool pathAllOutside(SplashPath *path);