summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-05-15 09:51:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-17 14:43:56 +0100
commite0d8fb0cb157668dffa683fe81418304f8a843dd (patch)
treeefb4a8a2b7bf3d94bf1b60921a1352838680c3c9
parentb7a425aab6122b5848362815e5fe665c7e38da05 (diff)
Related: #i121801# Corrected objectBoundingBox case for GradientTransform
(cherry picked from commit f03ec4812cfe71f582c5290869f22eadd661b48a) Change-Id: Icb3e2cefda2fd5fe9a2dcf501e5e07881961932e
-rw-r--r--drawinglayer/source/primitive2d/svggradientprimitive2d.cxx41
1 files changed, 24 insertions, 17 deletions
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 756f7b03454e..66d21f037f2a 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -408,15 +408,19 @@ namespace drawinglayer
// gradient vector defined by Start,End
const basegfx::B2DVector aVector(getEnd() - getStart());
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());
+ aUnitGradientToObject.scale(fVectorLength, 1.0);
+ aUnitGradientToObject.rotate(atan2(aVector.getY(), aVector.getX()));
+ aUnitGradientToObject.translate(getStart().getX(), getStart().getY());
+
+ if(!getGradientTransform().isIdentity())
+ {
+ aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ }
// create full transform from unit gradient coordinates to object coordinates
// including the SvgGradient transformation
- aUnitGradientToObject = aObjectTransform * aUnitGradientToGradient;
+ aUnitGradientToObject = aObjectTransform * aUnitGradientToObject;
}
else
{
@@ -428,11 +432,11 @@ namespace drawinglayer
aUnitGradientToObject.scale(aVector.getLength(), 1.0);
aUnitGradientToObject.rotate(atan2(aVector.getY(), aVector.getX()));
aUnitGradientToObject.translate(aStart.getX(), aStart.getY());
- }
- if(!getGradientTransform().isIdentity())
- {
- aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ if(!getGradientTransform().isIdentity())
+ {
+ aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ }
}
// create inverse from it
@@ -745,14 +749,17 @@ namespace drawinglayer
{
// interpret in unit coordinate system -> object aspect ratio will scale result
// create unit transform from unit vector to given linear gradient vector
- basegfx::B2DHomMatrix aUnitGradientToGradient;
+ aUnitGradientToObject.scale(getRadius(), getRadius());
+ aUnitGradientToObject.translate(getStart().getX(), getStart().getY());
- aUnitGradientToGradient.scale(getRadius(), getRadius());
- aUnitGradientToGradient.translate(getStart().getX(), getStart().getY());
+ if(!getGradientTransform().isIdentity())
+ {
+ aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ }
// create full transform from unit gradient coordinates to object coordinates
// including the SvgGradient transformation
- aUnitGradientToObject = aObjectTransform * aUnitGradientToGradient;
+ aUnitGradientToObject = aObjectTransform * aUnitGradientToObject;
}
else
{
@@ -764,11 +771,11 @@ namespace drawinglayer
aUnitGradientToObject.scale(fRadius, fRadius);
aUnitGradientToObject.translate(aStart.getX(), aStart.getY());
- }
- if(!getGradientTransform().isIdentity())
- {
- aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ if(!getGradientTransform().isIdentity())
+ {
+ aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ }
}
// create inverse from it