[Libreoffice-commits] .: Branch 'libreoffice-3-5' - basegfx/source

Michael Meeks michael at kemper.freedesktop.org
Tue May 8 02:08:23 PDT 2012


 basegfx/source/tools/gradienttools.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit f3ee7a8a463af1fde6ed0da91abb654b25a3ecd9
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Fri May 4 21:50:13 2012 +0200

    Fix fdo#49508 incorrect square gradients in slideshow.
    
    Make sure client code sees isotrophic aspect ratio for the
    square gradient case. This somehow never worked.
    
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx
index 3017c8c..a56d334 100644
--- a/basegfx/source/tools/gradienttools.cxx
+++ b/basegfx/source/tools/gradienttools.cxx
@@ -185,7 +185,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();
@@ -238,7 +239,10 @@ namespace basegfx
         o_rGradientInfo.maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY);
 
         // prepare aspect for texture
-        o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ?  fTargetSizeX / fTargetSizeY : 1.0;
+        if( bSquare )
+            o_rGradientInfo.mfAspectRatio = 1.0; // since we want a square
+        else
+            o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ?  fTargetSizeX / fTargetSizeY : 1.0;
 
         // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform
         o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform;
@@ -322,7 +326,8 @@ namespace basegfx
                                  rOffset,
                                  nSteps,
                                  fBorder,
-                                 fAngle);
+                                 fAngle,
+                                 true);
             return o_rGradientInfo;
         }
 
@@ -338,7 +343,8 @@ namespace basegfx
                                  rOffset,
                                  nSteps,
                                  fBorder,
-                                 fAngle);
+                                 fAngle,
+                                 false);
             return o_rGradientInfo;
         }
 


More information about the Libreoffice-commits mailing list