You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/03/20 13:05:25 UTC

svn commit: r1458779 - /openoffice/branches/sidebar/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx

Author: alg
Date: Wed Mar 20 12:05:25 2013
New Revision: 1458779

URL: http://svn.apache.org/r1458779
Log:
i121788 corrected handling of TransparenceGradients when start/end values are 0% or 100%

Modified:
    openoffice/branches/sidebar/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx

Modified: openoffice/branches/sidebar/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx?rev=1458779&r1=1458778&r2=1458779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx Wed Mar 20 12:05:25 2013
@@ -399,6 +399,26 @@ namespace drawinglayer
 
 				if(100 != nTransparence)
 				{
+                    // need to check XFillFloatTransparence, object fill may still be completely transparent
+                    const SfxPoolItem* pGradientItem;
+
+                    if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem) 
+                        && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
+                    {
+                        const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
+                        const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
+                        const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
+                        const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
+
+                        if(bCompletelyTransparent)
+                        {
+                            nTransparence = 100;
+                        }
+                    }
+                }
+
+				if(100 != nTransparence)
+				{
 					const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue());
 					attribute::FillGradientAttribute aGradient;
 					attribute::FillHatchAttribute aHatch;
@@ -569,8 +589,13 @@ namespace drawinglayer
 				const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
 				const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
 				const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
+				const bool bNotTransparent(0x00 == nStartLuminance && 0x00 == nEndLuminance);
 
-				if(!bCompletelyTransparent)
+                // create nothing when completely transparent: This case is already checked for the
+                // normal fill attributes, XFILL_NONE will be used.
+                // create nothing when not transparent: use normal fill, no need t create a FillGradientAttribute.
+                // Both cases are optimizations, always creating FillGradientAttribute will work, too
+				if(!bNotTransparent && !bCompletelyTransparent)
 				{
 					const double fStartLum(nStartLuminance / 255.0);
 					const double fEndLum(nEndLuminance / 255.0);