diff options
author | Xisco Fauli <anistenis@gmail.com> | 2015-12-13 20:32:42 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2015-12-21 09:09:26 +0000 |
commit | 3725144bfa547fcb76d54e3e2c0977ac09c436f0 (patch) | |
tree | 65797028dcfe4cd1cbbd2be0803e589d415488b1 /filter | |
parent | e18b08363a939b35e7f5dc435e606d2c62bddebd (diff) |
SVG: don't fill the gradient if there's no stop element present
Change-Id: Ia12bd6bdbc248b382a7cbee8b75bdff462e715bd
Reviewed-on: https://gerrit.libreoffice.org/20690
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/svg/svgreader.cxx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx index f824953e517b..4cd7080b8a9a 100644 --- a/filter/source/svg/svgreader.cxx +++ b/filter/source/svg/svgreader.cxx @@ -656,18 +656,24 @@ struct AnnotatingVisitor { if( rState.meFillType == GRADIENT ) { - xAttrs->AddAttribute( "draw:fill", "gradient"); - xAttrs->AddAttribute( "draw:fill-gradient-name", - getStyleName("svggradient", rState.maFillGradient.mnId) ); - if( hasGradientOpacity(rState.maFillGradient) ) + // don't fill the gradient if there's no stop element present + if( rState.maFillGradient.maStops.size() == 0 ) + xAttrs->AddAttribute( "draw:fill", "none" ); + else { - // needs transparency gradient as well - xAttrs->AddAttribute( "draw:opacity-name", - getStyleName("svgopacity", rState.maFillGradient.mnId) ); + xAttrs->AddAttribute( "draw:fill", "gradient"); + xAttrs->AddAttribute( "draw:fill-gradient-name", + getStyleName("svggradient", rState.maFillGradient.mnId) ); + if( hasGradientOpacity(rState.maFillGradient) ) + { + // needs transparency gradient as well + xAttrs->AddAttribute( "draw:opacity-name", + getStyleName("svgopacity", rState.maFillGradient.mnId) ); + } + else if( maCurrState.mnFillOpacity*maCurrState.mnOpacity != 1.0 ) + xAttrs->AddAttribute( "draw:opacity", + OUString::number(100.0*maCurrState.mnFillOpacity*maCurrState.mnOpacity)+"%" ); } - else if( maCurrState.mnFillOpacity*maCurrState.mnOpacity != 1.0 ) - xAttrs->AddAttribute( "draw:opacity", - OUString::number(100.0*maCurrState.mnFillOpacity*maCurrState.mnOpacity)+"%" ); } else { |