diff options
author | Regina Henschel <regina@apache.org> | 2012-09-07 12:33:04 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-19 20:07:33 +0100 |
commit | d3dde5d940d69d6b859fef3ff722e349d7d89c54 (patch) | |
tree | fd2b4b5bed0e12c655e079bdb1c6895d9b16b267 /basegfx | |
parent | 43c234b0481fe63b8c4823affad066c6362f5068 (diff) |
Resolves: #i120642# expand target to maximum edge not to diagonal
(cherry picked from commit 2e1700bf4f7cf913c23d35f325a50d3aa25426cc)
Change-Id: Ic27fb3b18f42667419765a6adca41e1df27561c2
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/tools/gradienttools.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index c45c335e9368..9587872f8995 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -193,11 +193,11 @@ namespace basegfx // 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; + const double fSquareWidth((fTargetSizeX>fTargetSizeY) ? fTargetSizeX : fTargetSizeY); + fTargetOffsetX = fTargetOffsetX + fTargetSizeX / 2.0 - fSquareWidth / 2.0; + fTargetOffsetY = fTargetOffsetY + fTargetSizeY / 2.0 - fSquareWidth / 2.0; + fTargetSizeX = fSquareWidth; + fTargetSizeY = fSquareWidth; } // add object expansion |