diff options
author | thb <thb@openoffice.org> | 2010-01-16 02:20:50 +0100 |
---|---|---|
committer | thb <thb@openoffice.org> | 2010-01-16 02:20:50 +0100 |
commit | a3de1ad361232a4ebe7edbd0817bcf0b2c59e56e (patch) | |
tree | 41635814d4f5dbde3a55925ab00eaf79f7a7bee2 /basegfx/source/tools | |
parent | 42c0c069b71db77b3a0f1617dac3c569df798625 (diff) |
#i105937# Fixed a few remaining gradient glitches
* linear/axial gradient were f*cked up when border and rotation
was given
* found another place where drawinglayer was generating helper
polygons for gradients (vclgradienthelper.cxx), adapted to new
value ranges
* fixed build breakage in debug build in oox
* fixed order of gradient color generation
Diffstat (limited to 'basegfx/source/tools')
-rw-r--r-- | basegfx/source/tools/gradienttools.cxx | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 337f9bd8e52b..447eac056c55 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -72,31 +72,28 @@ namespace basegfx fTargetSizeY = fNewY; } - double fSizeWithoutBorder=0; - double fTranslateY=0; + const double fSizeWithoutBorder=1.0 - fBorder; if( bAxial ) { - fSizeWithoutBorder = (1.0 - fBorder) * 0.5; - fTranslateY = 0.5; + o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder * .5); + o_rGradientInfo.maTextureTransform.translate(0.0, 0.5); } else { - fSizeWithoutBorder = 1.0 - fBorder; - fTranslateY = fBorder; + if(!fTools::equal(fSizeWithoutBorder, 1.0)) + { + o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder); + o_rGradientInfo.maTextureTransform.translate(0.0, fBorder); + } } - if(!fTools::equal(fSizeWithoutBorder, 0.0)) - o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder); - - o_rGradientInfo.maTextureTransform.translate(0.0, fTranslateY); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); // add texture rotate after scale to keep perpendicular angles if(0.0 != fAngle) { - B2DPoint aCenter(0.5, 0.5); - aCenter *= o_rGradientInfo.maTextureTransform; - + const B2DPoint aCenter(0.5*fTargetSizeX, + 0.5*fTargetSizeY); o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); o_rGradientInfo.maTextureTransform.rotate(fAngle); o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); @@ -153,8 +150,7 @@ namespace basegfx } const double fHalfBorder((1.0 - fBorder) * 0.5); - if(!fTools::equal(fHalfBorder, 0.0)) - o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); + o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); o_rGradientInfo.maTextureTransform.translate(0.5, 0.5); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); @@ -226,8 +222,7 @@ namespace basegfx } const double fHalfBorder((1.0 - fBorder) * 0.5); - if(!fTools::equal(fHalfBorder, 0.0)) - o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); + o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); o_rGradientInfo.maTextureTransform.translate(0.5, 0.5); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); |