diff options
author | Armin Le Grand <alg@apache.org> | 2012-08-14 08:19:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-12 15:39:17 +0100 |
commit | ed43421545c86f85b5fc4b9a33be077748fb8487 (patch) | |
tree | e448774304d654a06fb4216c14522ef5dace7aed /basegfx | |
parent | 931984489e1f2da1b223ba927bda6a06e0d3f75f (diff) |
Resolves: fdo#49508# #i120539# Fixed visualisation of gradient 'square'
which was broken in OOo3.3
(cherry picked from commit 008bc1d4b8cd47ca9940be00a8cfdcdb1ef85856)
Change-Id: I912b74deb37f9dc09e2ae83977aab180c46bd501
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/tools/gradienttools.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index f2e65774ba02..c45c335e9368 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -191,6 +191,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))); @@ -230,10 +240,7 @@ namespace basegfx o_rGradientInfo.maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); // prepare aspect for texture - if( bSquare ) - o_rGradientInfo.mfAspectRatio = 1.0; // since we want a square - else - o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; + 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; |