From 1ef21281ad92b00f76aacdc8795913d64626b813 Mon Sep 17 00:00:00 2001 From: thb Date: Sat, 16 Jan 2010 02:20:50 +0100 Subject: #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 --- drawinglayer/source/processor2d/vclhelpergradient.cxx | 16 ++++++---------- drawinglayer/source/texture/texture.cxx | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx index 25d7513006fa..fb6ba566f19c 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.cxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx @@ -218,16 +218,6 @@ namespace drawinglayer ::std::vector< basegfx::BColor > aColors; basegfx::B2DPolygon aUnitPolygon; - if(attribute::GRADIENTSTYLE_RADIAL == eGradientStyle || attribute::GRADIENTSTYLE_ELLIPTICAL == eGradientStyle) - { - const basegfx::B2DPoint aCircleCenter(0.5, 0.5); - aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); - } - else - { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); - } - // make sure steps is not too high/low nSteps = impCalcGradientSteps(rOutDev, nSteps, aOutlineRange, sal_uInt32((rStart.getMaximumDistance(rEnd) * 127.5) + 0.5)); @@ -239,6 +229,7 @@ namespace drawinglayer texture::GeoTexSvxGradientLinear aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); aGradient.appendTransformations(aMatrices); aGradient.appendColors(aColors); + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); break; } case attribute::GRADIENTSTYLE_AXIAL: @@ -246,6 +237,7 @@ namespace drawinglayer texture::GeoTexSvxGradientAxial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); aGradient.appendTransformations(aMatrices); aGradient.appendColors(aColors); + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); break; } case attribute::GRADIENTSTYLE_RADIAL: @@ -253,6 +245,7 @@ namespace drawinglayer texture::GeoTexSvxGradientRadial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetY); aGradient.appendTransformations(aMatrices); aGradient.appendColors(aColors); + aUnitPolygon = basegfx::tools::createPolygonFromEllipse(basegfx::B2DPoint(0,0), 1, 1); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: @@ -260,6 +253,7 @@ namespace drawinglayer texture::GeoTexSvxGradientElliptical aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); aGradient.appendTransformations(aMatrices); aGradient.appendColors(aColors); + aUnitPolygon = basegfx::tools::createPolygonFromEllipse(basegfx::B2DPoint(0,0), 1, 1); break; } case attribute::GRADIENTSTYLE_SQUARE: @@ -267,6 +261,7 @@ namespace drawinglayer texture::GeoTexSvxGradientSquare aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); aGradient.appendTransformations(aMatrices); aGradient.appendColors(aColors); + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); break; } case attribute::GRADIENTSTYLE_RECT: @@ -274,6 +269,7 @@ namespace drawinglayer texture::GeoTexSvxGradientRect aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); aGradient.appendTransformations(aMatrices); aGradient.appendColors(aColors); + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); break; } } diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx index 934003ce5a00..c5f255f0a9e9 100644 --- a/drawinglayer/source/texture/texture.cxx +++ b/drawinglayer/source/texture/texture.cxx @@ -276,7 +276,7 @@ namespace drawinglayer if(maGradientInfo.mnSteps) { const double fStepSize=1.0 / maGradientInfo.mnSteps; - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) + for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--) { const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a); impAppendMatrix(rMatrices, aRect); @@ -391,7 +391,7 @@ namespace drawinglayer if(maGradientInfo.mnSteps) { const double fStepSize=1.0 / maGradientInfo.mnSteps; - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) + for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--) { const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a); impAppendMatrix(rMatrices, aRect); -- cgit