summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-05-15 08:47:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-17 14:43:25 +0100
commitb7a425aab6122b5848362815e5fe665c7e38da05 (patch)
treeaefb221b0f04f81d9b4dfdd17d1724e4e32ab088 /drawinglayer
parent821446a0be326c0065c827ffcd4670c113c78755 (diff)
Resolves: #i121801# Corrected handling of gradient transformations
(cherry picked from commit 4f49f1d95e8d0be7df259ad1458441fd858be735) Conflicts: drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx svgio/source/svgreader/svgnode.cxx svgio/source/svgreader/svgstyleattributes.cxx Change-Id: I155854692a9d1771826867d2666fc6174e2c9256
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/svggradientprimitive2d.cxx25
1 files changed, 21 insertions, 4 deletions
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 03280707ffde..756f7b03454e 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -280,12 +280,14 @@ namespace drawinglayer
}
SvgGradientHelper::SvgGradientHelper(
+ const basegfx::B2DHomMatrix& rGradientTransform,
const basegfx::B2DPolyPolygon& rPolyPolygon,
const SvgGradientEntryVector& rGradientEntries,
const basegfx::B2DPoint& rStart,
bool bUseUnitCoordinates,
SpreadMethod aSpreadMethod)
- : maPolyPolygon(rPolyPolygon),
+ : maGradientTransform(rGradientTransform),
+ maPolyPolygon(rPolyPolygon),
maGradientEntries(rGradientEntries),
maStart(rStart),
maSpreadMethod(aSpreadMethod),
@@ -301,7 +303,8 @@ namespace drawinglayer
{
const SvgGradientHelper& rCompare = static_cast< const SvgGradientHelper& >(rSvgGradientHelper);
- return (getPolyPolygon() == rCompare.getPolyPolygon()
+ return (getGradientTransform() == rCompare.getGradientTransform()
+ && getPolyPolygon() == rCompare.getPolyPolygon()
&& getGradientEntries() == rCompare.getGradientEntries()
&& getStart() == rCompare.getStart()
&& getUseUnitCoordinates() == rCompare.getUseUnitCoordinates()
@@ -427,6 +430,11 @@ namespace drawinglayer
aUnitGradientToObject.translate(aStart.getX(), aStart.getY());
}
+ if(!getGradientTransform().isIdentity())
+ {
+ aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ }
+
// create inverse from it
basegfx::B2DHomMatrix aObjectToUnitGradient(aUnitGradientToObject);
aObjectToUnitGradient.invert();
@@ -545,6 +553,7 @@ namespace drawinglayer
}
SvgLinearGradientPrimitive2D::SvgLinearGradientPrimitive2D(
+ const basegfx::B2DHomMatrix& rGradientTransform,
const basegfx::B2DPolyPolygon& rPolyPolygon,
const SvgGradientEntryVector& rGradientEntries,
const basegfx::B2DPoint& rStart,
@@ -552,7 +561,7 @@ namespace drawinglayer
bool bUseUnitCoordinates,
SpreadMethod aSpreadMethod)
: BufferedDecompositionPrimitive2D(),
- SvgGradientHelper(rPolyPolygon, rGradientEntries, rStart, bUseUnitCoordinates, aSpreadMethod),
+ SvgGradientHelper(rGradientTransform, rPolyPolygon, rGradientEntries, rStart, bUseUnitCoordinates, aSpreadMethod),
maEnd(rEnd)
{
}
@@ -748,6 +757,8 @@ namespace drawinglayer
else
{
// interpret in object coordinate system -> object aspect ratio will not scale result
+ // use X-Axis with radius, it was already made relative to object width when coming from
+ // SVG import
const double fRadius((aObjectTransform * basegfx::B2DVector(getRadius(), 0.0)).getLength());
const basegfx::B2DPoint aStart(aObjectTransform * getStart());
@@ -755,6 +766,11 @@ namespace drawinglayer
aUnitGradientToObject.translate(aStart.getX(), aStart.getY());
}
+ if(!getGradientTransform().isIdentity())
+ {
+ aUnitGradientToObject = getGradientTransform() * aUnitGradientToObject;
+ }
+
// create inverse from it
basegfx::B2DHomMatrix aObjectToUnitGradient(aUnitGradientToObject);
aObjectToUnitGradient.invert();
@@ -822,6 +838,7 @@ namespace drawinglayer
}
SvgRadialGradientPrimitive2D::SvgRadialGradientPrimitive2D(
+ const basegfx::B2DHomMatrix& rGradientTransform,
const basegfx::B2DPolyPolygon& rPolyPolygon,
const SvgGradientEntryVector& rGradientEntries,
const basegfx::B2DPoint& rStart,
@@ -830,7 +847,7 @@ namespace drawinglayer
SpreadMethod aSpreadMethod,
const basegfx::B2DPoint* pFocal)
: BufferedDecompositionPrimitive2D(),
- SvgGradientHelper(rPolyPolygon, rGradientEntries, rStart, bUseUnitCoordinates, aSpreadMethod),
+ SvgGradientHelper(rGradientTransform, rPolyPolygon, rGradientEntries, rStart, bUseUnitCoordinates, aSpreadMethod),
mfRadius(fRadius),
maFocal(rStart),
maFocalVector(0.0, 0.0),