summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorOliver Sander <oliver.sander@tu-dresden.de>2020-04-21 16:03:37 +0200
committerOliver Sander <oliver.sander@tu-dresden.de>2020-04-21 20:56:20 +0200
commit846575911483787a0fe28d76c4e9b51a644d7152 (patch)
tree2e67048f78f7c2d5622230a372dd227c7465faec /splash
parent9e302b6bf42c5d8b48bc5b6c04621e52d52da3f2 (diff)
[splash, arthur] Use stroking opacity when clipping to a stroke path
When filling a region that is clipped to a stroke path, then the stroking opacity shall be used rather than the fill opacity. I couldn't find this in the spec, but it seems to be what Acrobat does. BUG: https://gitlab.freedesktop.org/poppler/poppler/-/issues/178
Diffstat (limited to 'splash')
-rw-r--r--splash/Splash.cc8
-rw-r--r--splash/Splash.h6
2 files changed, 10 insertions, 4 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 70584ec4..feb738bb 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -21,7 +21,7 @@
// Copyright (C) 2012 Matthias Kramm <kramm@quiss.org>
// Copyright (C) 2018, 2019 Stefan Brüns <stefan.bruens@rwth-aachen.de>
// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
-// Copyright (C) 2019 Oliver Sander <oliver.sander@tu-dresden.de>
+// Copyright (C) 2019, 2020 Oliver Sander <oliver.sander@tu-dresden.de>
// Copyright (C) 2019 Marek Kasik <mkasik@redhat.com>
//
// To see a description of the changes please see the Changelog file that
@@ -6356,7 +6356,8 @@ void Splash::dumpXPath(SplashXPath *path) {
}
SplashError Splash::shadedFill(SplashPath *path, bool hasBBox,
- SplashPattern *pattern) {
+ SplashPattern *pattern,
+ bool clipToStrokePath) {
SplashPipe pipe;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes;
@@ -6397,7 +6398,8 @@ SplashError Splash::shadedFill(SplashPath *path, bool hasBBox,
yMaxI = state->clip->getYMaxI();
}
- pipeInit(&pipe, 0, yMinI, pattern, nullptr, (unsigned char)splashRound(state->fillAlpha * 255), vectorAntialias && !hasBBox, false);
+ unsigned char alpha = splashRound((clipToStrokePath) ? state->strokeAlpha * 255 : state->fillAlpha * 255);
+ pipeInit(&pipe, 0, yMinI, pattern, nullptr, alpha, vectorAntialias && !hasBBox, false);
// draw the spans
if (vectorAntialias) {
diff --git a/splash/Splash.h b/splash/Splash.h
index 28ea4e5d..16b41c0a 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -16,6 +16,7 @@
// Copyright (C) 2010-2013, 2015 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com>
+// Copyright (C) 2020 Oliver Sander <oliver.sander@tu-dresden.de>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -264,8 +265,11 @@ public:
#endif
// Do shaded fills with dynamic patterns
+ //
+ // clipToStrokePath: Whether the current clip region is a stroke path.
+ // In that case, strokeAlpha is used rather than fillAlpha.
SplashError shadedFill(SplashPath *path, bool hasBBox,
- SplashPattern *pattern);
+ SplashPattern *pattern, bool clipToStrokePath);
// Draw a gouraud triangle shading.
bool gouraudTriangleShadedFill(SplashGouraudColor *shading);