Author: alg
Date: Wed Aug  1 08:43:53 2012
New Revision: 1367886

URL: http://svn.apache.org/viewvc?rev=1367886&view=rev
Log:
#120397# Corrected linear gradient primitive decomposition

Modified:
    
incubator/ooo/trunk/main/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx

Modified: 
incubator/ooo/trunk/main/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx?rev=1367886&r1=1367885&r2=1367886&view=diff
==============================================================================
--- 
incubator/ooo/trunk/main/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
 (original)
+++ 
incubator/ooo/trunk/main/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
 Wed Aug  1 08:43:53 2012
@@ -399,19 +399,19 @@ namespace drawinglayer
                         fPolyWidth, fPolyHeight, 
                         aPolyRange.getMinX(), aPolyRange.getMinY()));
 
-                // create unit transform from unit vector [0.0 .. 1.0] along 
the X-Axis to given 
-                // gradient vector defined by Start,End
-                const basegfx::B2DVector aVector(getEnd() - getStart());
+                // get start, end in object coordinates
+                const basegfx::B2DPoint aStart(aObjectTransform * getStart());
+                const basegfx::B2DPoint aEnd(aObjectTransform * getEnd());
+
+                // create transform from unit vector [0.0 .. 1.0] along the 
X-Axis to given 
+                // gradient vector in object coordinates defined by Start, End
+                const basegfx::B2DVector aVector(aEnd - aStart);
                 const double fVectorLength(aVector.getLength());
-                basegfx::B2DHomMatrix aUnitGradientToGradient;
-
-                aUnitGradientToGradient.scale(fVectorLength, 1.0);
-                aUnitGradientToGradient.rotate(atan2(aVector.getY(), 
aVector.getX()));
-                aUnitGradientToGradient.translate(getStart().getX(), 
getStart().getY());
+                basegfx::B2DHomMatrix aUnitGradientToObject;
 
-                // create full transform from unit gradient coordinates to 
object coordinates
-                // including the SvgGradient transformation
-                basegfx::B2DHomMatrix aUnitGradientToObject(aObjectTransform * 
aUnitGradientToGradient);
+                aUnitGradientToObject.scale(fVectorLength, 1.0);
+                aUnitGradientToObject.rotate(atan2(aVector.getY(), 
aVector.getX()));
+                aUnitGradientToObject.translate(aStart.getX(), aStart.getY());
 
                 // create inverse from it
                 basegfx::B2DHomMatrix 
aObjectToUnitGradient(aUnitGradientToObject);


Reply via email to