From d3dde5d940d69d6b859fef3ff722e349d7d89c54 Mon Sep 17 00:00:00 2001 From: Regina Henschel Date: Fri, 7 Sep 2012 12:33:04 +0000 Subject: [PATCH] Resolves: #i120642# expand target to maximum edge not to diagonal (cherry picked from commit 2e1700bf4f7cf913c23d35f325a50d3aa25426cc) Change-Id: Ic27fb3b18f42667419765a6adca41e1df27561c2 --- basegfx/source/tools/gradienttools.cxx | 10 +++++----- sd/qa/unit/data/xml/fdo64586_0.xml | 8 ++++---- sd/qa/unit/data/xml/n758621_0.xml | 8 ++++---- sd/qa/unit/data/xml/n758621_1.xml | 8 ++++---- 4 files changed, 17 insertions(+), 17 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 diff --git a/sd/qa/unit/data/xml/fdo64586_0.xml b/sd/qa/unit/data/xml/fdo64586_0.xml index cd2b2da13127..bcfa520ebbeb 100644 --- a/sd/qa/unit/data/xml/fdo64586_0.xml +++ b/sd/qa/unit/data/xml/fdo64586_0.xml @@ -1,6 +1,6 @@ - + @@ -10,11 +10,11 @@ - + - + @@ -24,7 +24,7 @@ - + diff --git a/sd/qa/unit/data/xml/n758621_0.xml b/sd/qa/unit/data/xml/n758621_0.xml index 600d31c6647b..b569f2307eb4 100644 --- a/sd/qa/unit/data/xml/n758621_0.xml +++ b/sd/qa/unit/data/xml/n758621_0.xml @@ -1,6 +1,6 @@ - + @@ -10,11 +10,11 @@ - + - + @@ -24,7 +24,7 @@ - + diff --git a/sd/qa/unit/data/xml/n758621_1.xml b/sd/qa/unit/data/xml/n758621_1.xml index 7dd7f24be1b5..689cc0028132 100644 --- a/sd/qa/unit/data/xml/n758621_1.xml +++ b/sd/qa/unit/data/xml/n758621_1.xml @@ -1,6 +1,6 @@ - + @@ -10,11 +10,11 @@ - + - + @@ -24,7 +24,7 @@ - +