Resolves: fdo#49508# #i120539# Fixed visualisation of gradient 'square'

which was broken in OOo3.3

(cherry picked from commit 008bc1d4b8cd47ca9940be00a8cfdcdb1ef85856)

Change-Id: I912b74deb37f9dc09e2ae83977aab180c46bd501
This commit is contained in:
Armin Le Grand 2012-08-14 08:19:40 +00:00 committed by Caolán McNamara
parent 931984489e
commit ed43421545

View file

@ -190,6 +190,16 @@ namespace basegfx
double fTargetOffsetX(rTargetRange.getMinX());
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)
{
@ -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;