incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1372793 - /incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx
Date Tue, 14 Aug 2012 09:19:41 GMT
Author: alg
Date: Tue Aug 14 09:19:40 2012
New Revision: 1372793

URL: http://svn.apache.org/viewvc?rev=1372793&view=rev
Log:
#120539# Fixed visualisation of gradeint type 'square' which was broken in OOo3.3

Modified:
    incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx

Modified: incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx?rev=1372793&r1=1372792&r2=1372793&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx (original)
+++ incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx Tue Aug 14 09:19:40 2012
@@ -183,7 +183,8 @@ namespace basegfx
                                      const B2DVector& rOffset,
                                      sal_uInt32       nSteps,
                                      double           fBorder, 
-                                     double           fAngle)
+                                     double           fAngle,
+                                     bool             bSquare)
     {
         o_rGradientInfo.maTextureTransform.identity();
         o_rGradientInfo.maBackTextureTransform.identity();
@@ -197,6 +198,16 @@ namespace basegfx
         double fTargetOffsetY(rTargetRange.getMinY());
 
         // add object expansion
+        if(bSquare)
+        {
+            const double fOriginalDiag(sqrt((fTargetSizeX * fTargetSizeX) + (fTargetSizeY
* fTargetSizeY)));
+            fTargetOffsetX -= (fOriginalDiag - fTargetSizeX) / 2.0;
+            fTargetOffsetY -= (fOriginalDiag - fTargetSizeY) / 2.0;
+            fTargetSizeX = fOriginalDiag;
+            fTargetSizeY = fOriginalDiag;
+        }    
+
+        // add object expansion
         if(0.0 != fAngle)
         {
             const double fAbsCos(fabs(cos(fAngle)));
@@ -320,7 +331,8 @@ namespace basegfx
                                  rOffset,
                                  nSteps,
                                  fBorder, 
-                                 fAngle);
+                                 fAngle,
+                                 true);
             return o_rGradientInfo;
         }
 
@@ -336,7 +348,8 @@ namespace basegfx
                                  rOffset,
                                  nSteps,
                                  fBorder, 
-                                 fAngle);
+                                 fAngle,
+                                 false);
             return o_rGradientInfo;
         }
         



Mime
View raw message