summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2013-03-19 22:53:47 +0100
committerAlbert Astals Cid <aacid@kde.org>2013-03-19 22:53:47 +0100
commit2bce2cf2a523f9b8db7f5e255384044b8dfe1a24 (patch)
tree01b5512fafa9e51c3da5c328bd1f7f539546d51e /splash
parentb2d07cbf0c2f94bd25e1422e366ff78031815867 (diff)
Avoid blackboxes on weird files using the thin line mode
Bug #61719
Diffstat (limited to 'splash')
-rw-r--r--splash/Splash.cc35
-rw-r--r--splash/Splash.h1
2 files changed, 36 insertions, 0 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 34bea6a1..1f100fee 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 49bad837..8bcd1dbc 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);