summaryrefslogtreecommitdiff
path: root/poppler
diff options
context:
space:
mode:
authorOliver Sander <oliver.sander@tu-dresden.de>2020-04-28 08:19:26 +0200
committerOliver Sander <oliver.sander@tu-dresden.de>2020-05-11 10:12:39 +0200
commitc2f914359cdc672288d6cd68f157921214e536fa (patch)
treeab311444a965d5db6915cefd3639e5676b527098 /poppler
parent7c890b37ac70394cb330e9d9615ad9532769c9e0 (diff)
[cairo] Use stroke opacity when clipping to a stroke path
Fixes: https://gitlab.freedesktop.org/poppler/poppler/issues/178
Diffstat (limited to 'poppler')
-rw-r--r--poppler/CairoOutputDev.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 34c02667..da41a23c 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -33,6 +33,7 @@
// Copyright (C) 2018, 2020 Adam Reichold <adam.reichold@t-online.de>
// Copyright (C) 2019 Marek Kasik <mkasik@redhat.com>
// Copyright (C) 2020 Michal <sudolskym@gmail.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
@@ -585,11 +586,17 @@ void CairoOutputDev::updateFillColorStop(GfxState *state, double offset) {
state->getFillRGB(&fill_color);
+ // If stroke pattern is set then the current fill is clipped
+ // to a stroke path. In that case, the stroke opacity has to be used
+ // rather than the fill opacity.
+ // See https://gitlab.freedesktop.org/poppler/poppler/issues/178
+ auto opacity = (state->getStrokePattern()) ? state->getStrokeOpacity() : state->getFillOpacity();
+
cairo_pattern_add_color_stop_rgba(fill_pattern, offset,
colToDbl(fill_color.r),
colToDbl(fill_color.g),
colToDbl(fill_color.b),
- fill_opacity);
+ opacity);
LOG(printf ("fill color stop: %f (%d, %d, %d)\n",
offset, fill_color.r, fill_color.g, fill_color.b));
}