[Libreoffice-commits] .: writerperfect/source
Fridrich Strba
fridrich at kemper.freedesktop.org
Fri Jul 22 03:27:23 PDT 2011
writerperfect/source/filter/OdgGenerator.cxx | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
New commits:
commit fd601ca106ee7e9708aeceb7043bd99f4ca2afcf
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Fri Jul 22 12:26:16 2011 +0200
Don't output opacity gradients if the stops are completely opaque
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index 5ad616d..45facff 100644
--- a/writerperfect/source/filter/OdgGenerator.cxx
+++ b/writerperfect/source/filter/OdgGenerator.cxx
@@ -906,6 +906,7 @@ void OdgGenerator::drawGraphicObject(const ::WPXPropertyList &propList, const ::
void OdgGeneratorPrivate::_writeGraphicsStyle()
{
+ bool bUseOpacityGradient = false;
#if 0
if(mxStyle["libwpg:stroke-solid"] && !mxStyle["libwpg:stroke-solid"]->getInt() && (mxDashArray.count() >=2 ) )
{
@@ -937,6 +938,7 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
#endif
if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient")
{
+ bUseOpacityGradient = true;
TagOpenElement *pDrawGradientElement = new TagOpenElement("draw:gradient");
TagOpenElement *pDrawOpacityElement = new TagOpenElement("draw:opacity");
if (mxStyle["draw:style"])
@@ -1020,18 +1022,21 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
else
pDrawOpacityElement->addAttribute("draw:end", "100%");
+ mGraphicsGradientStyles.push_back(pDrawGradientElement);
+ mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient"));
+
// Work around a mess in LibreOffice where both opacities of 100% are interpreted as complete transparency
// Nevertheless, when one is different, immediately, they are interpreted correctly
if (!(mxStyle["libwpg:start-opacity"] && mxStyle["libwpg:end-opacity"]) || (mxStyle["libwpg:start-opacity"]->getDouble() == 1.0 && mxStyle["libwpg:end-opacity"]->getDouble() == 1.0))
{
- pDrawOpacityElement->addAttribute("draw:start", "0%");
- pDrawOpacityElement->addAttribute("draw:end", "0%");
+ delete pDrawOpacityElement;
+ bUseOpacityGradient = false;
+ }
+ else
+ {
+ mGraphicsGradientStyles.push_back(pDrawOpacityElement);
+ mGraphicsGradientStyles.push_back(new TagCloseElement("draw:opacity"));
}
-
- mGraphicsGradientStyles.push_back(pDrawGradientElement);
- mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient"));
- mGraphicsGradientStyles.push_back(pDrawOpacityElement);
- mGraphicsGradientStyles.push_back(new TagCloseElement("draw:opacity"));
}
else if(mxGradient.count() >= 2)
{
@@ -1123,8 +1128,11 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "gradient");
sValue.sprintf("Gradient_%i", miGradientIndex-1);
pStyleGraphicsPropertiesElement->addAttribute("draw:fill-gradient-name", sValue);
- sValue.sprintf("Transparency_%i", miGradientIndex-1);
- pStyleGraphicsPropertiesElement->addAttribute("draw:opacity-name", sValue);
+ if (bUseOpacityGradient)
+ {
+ sValue.sprintf("Transparency_%i", miGradientIndex-1);
+ pStyleGraphicsPropertiesElement->addAttribute("draw:opacity-name", sValue);
+ }
}
else
{
More information about the Libreoffice-commits
mailing list