summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-02-05 00:25:58 +0100
committerXisco Faulí <anistenis@gmail.com>2016-02-11 17:17:06 +0000
commitb6a62f07557fe4ae0931e0f3e0f306d2f69b116b (patch)
tree10539ba9812c0048bb23684c9502a424b67f2c0a /svgio/source/svgreader
parent54e3ea8a86a309990f5edf78948bfe18dd2de96b (diff)
tdf#97542: SVGIO: First check the current fill attribute
Differenciate when gradient is defined in the text element or in its parents Add unit tests Change-Id: I85b09f72fbb1a3c8d2fa7350b4396b5bf924277f Reviewed-on: https://gerrit.libreoffice.org/22131 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-by: Xisco Faulí <anistenis@gmail.com>
Diffstat (limited to 'svgio/source/svgreader')
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 2ae8a06054a4..1f592e7d73d7 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -263,6 +263,9 @@ namespace svgio
// dismantle to geometry and add needed primitives
const basegfx::BColor* pFill = getFill();
const SvgGradientNode* pFillGradient = getSvgGradientNodeFill();
+ const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+ const SvgGradientNode* pParentFillGradient =
+ pSvgStyleAttributes ? pSvgStyleAttributes->getSvgGradientNodeFill() : nullptr;
const SvgPatternNode* pFillPattern = getSvgPatternNodeFill();
const basegfx::BColor* pStroke = getStroke();
const SvgGradientNode* pStrokeGradient = getSvgGradientNodeStroke();
@@ -303,20 +306,20 @@ namespace svgio
const bool bStrokeUsed(pStroke || pStrokeGradient || pStrokePattern);
+ if(pFill && (!pFillGradient || pParentFillGradient))
+ {
+ // add the already prepared primitives for single color fill
+ rTarget.append(rSource);
+ }
// add fill. Use geometry even for simple color fill when stroke
// is used, else text rendering and the geometry-based stroke will
// normally not really match optically due to diverse system text
// renderers
- if(aMergedArea.count() && (pFillGradient || pFillPattern || bStrokeUsed))
+ else if(aMergedArea.count() && (pFillGradient || pFillPattern || bStrokeUsed))
{
// create text fill content based on geometry
add_fill(aMergedArea, rTarget, aMergedArea.getB2DRange());
}
- else if(pFill)
- {
- // add the already prepared primitives for single color fill
- rTarget.append(rSource);
- }
// add stroke
if(aMergedArea.count() && bStrokeUsed)