tdf#79163: SVGIO: Fix problem with opacity attribute

Opacity attribute didn't work because it was always set to 1.0

Change-Id: I3a2029ef23acf9d8c0f346e04341db33c6802b8e
Reviewed-on: https://gerrit.libreoffice.org/21911
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
This commit is contained in:
Xisco Fauli
2016-01-30 01:50:07 +01:00
committed by Armin Le Grand
parent a395a1137d
commit 359f43f8e7
2 changed files with 26 additions and 4 deletions

View File

@@ -425,7 +425,7 @@ namespace svgio
const basegfx::BColor* getCurrentColor() const; const basegfx::BColor* getCurrentColor() const;
/// Opacity content /// Opacity content
SvgNumber getOpacity() const { return maOpacity; } SvgNumber getOpacity() const;
void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { maOpacity = rOpacity; } void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { maOpacity = rOpacity; }
/// Visibility /// Visibility

View File

@@ -1056,7 +1056,7 @@ namespace svgio
return; return;
} }
const double fOpacity(getOpacity().getNumber()); const double fOpacity(getOpacity().solve(mrOwner));
if(basegfx::fTools::equalZero(fOpacity)) if(basegfx::fTools::equalZero(fOpacity))
{ {
@@ -1113,7 +1113,7 @@ namespace svgio
{ {
if(!rSource.empty()) if(!rSource.empty())
{ {
const double fOpacity(getOpacity().getNumber()); const double fOpacity(getOpacity().solve(mrOwner));
if(basegfx::fTools::equalZero(fOpacity)) if(basegfx::fTools::equalZero(fOpacity))
{ {
@@ -1210,7 +1210,7 @@ namespace svgio
maTextDecoration(TextDecoration_notset), maTextDecoration(TextDecoration_notset),
maTextAnchor(TextAnchor_notset), maTextAnchor(TextAnchor_notset),
maColor(), maColor(),
maOpacity(1.0), maOpacity(),
maVisibility(Visibility_visible), maVisibility(Visibility_visible),
maTitle(), maTitle(),
maDesc(), maDesc(),
@@ -2163,6 +2163,28 @@ namespace svgio
return SvgNumber(1.0); return SvgNumber(1.0);
} }
SvgNumber SvgStyleAttributes::getOpacity() const
{
if(mbIsClipPathContent)
{
return SvgNumber(1.0);
}
else if(maOpacity.isSet())
{
return maOpacity;
}
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
if(pSvgStyleAttributes)
{
return pSvgStyleAttributes->getOpacity();
}
// default is 1
return SvgNumber(1.0);
}
FillRule SvgStyleAttributes::getFillRule() const FillRule SvgStyleAttributes::getFillRule() const
{ {
if(FillRule_notset != maFillRule) if(FillRule_notset != maFillRule)