[poppler] splash/Splash.cc splash/Splash.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Tue Mar 19 14:56:29 PDT 2013
splash/Splash.cc | 35 +++++++++++++++++++++++++++++++++++
splash/Splash.h | 1 +
2 files changed, 36 insertions(+)
New commits:
commit 2bce2cf2a523f9b8db7f5e255384044b8dfe1a24
Author: Albert Astals Cid <aacid at kde.org>
Date: Tue Mar 19 22:53:47 2013 +0100
Avoid blackboxes on weird files using the thin line mode
Bug #61719
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);
More information about the poppler
mailing list