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 @@ - +