From 8b74ad05daa9e766c875152d1c82eee5926ee182 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Mon, 8 Jul 2013 10:30:37 +0000 Subject: WaE and numerical inconsequence in gradient fallback render handling (cherry picked from commit d8dfdae3da901a5a26182f3221c7aa374561672f) Conflicts: drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx drawinglayer/source/primitive2d/svggradientprimitive2d.cxx Change-Id: Ifcc795a3474efad1c1bca77088adfef36258ee95 --- drawinglayer/source/primitive2d/svggradientprimitive2d.cxx | 10 +++++++--- drawinglayer/source/processor2d/vclprocessor2d.cxx | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'drawinglayer/source') diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index 66d21f037f2a..d9ca6e19f8ca 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -299,7 +299,11 @@ namespace drawinglayer { } - bool SvgGradientHelper::equalTo(const SvgGradientHelper& rSvgGradientHelper) const + SvgGradientHelper::~SvgGradientHelper() + { + } + + bool SvgGradientHelper::operator==(const SvgGradientHelper& rSvgGradientHelper) const { const SvgGradientHelper& rCompare = static_cast< const SvgGradientHelper& >(rSvgGradientHelper); @@ -578,7 +582,7 @@ namespace drawinglayer { const SvgGradientHelper* pSvgGradientHelper = dynamic_cast< const SvgGradientHelper* >(&rPrimitive); - if(pSvgGradientHelper && SvgGradientHelper::equalTo(*pSvgGradientHelper)) + if(pSvgGradientHelper && SvgGradientHelper::operator==(*pSvgGradientHelper)) { const SvgLinearGradientPrimitive2D& rCompare = static_cast< const SvgLinearGradientPrimitive2D& >(rPrimitive); @@ -878,7 +882,7 @@ namespace drawinglayer { const SvgGradientHelper* pSvgGradientHelper = dynamic_cast< const SvgGradientHelper* >(&rPrimitive); - if(pSvgGradientHelper && SvgGradientHelper::equalTo(*pSvgGradientHelper)) + if(pSvgGradientHelper && SvgGradientHelper::operator==(*pSvgGradientHelper)) { const SvgRadialGradientPrimitive2D& rCompare = static_cast< const SvgRadialGradientPrimitive2D& >(rPrimitive); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 1ec9f50dc53e..86c51b2c7d2e 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1396,8 +1396,10 @@ namespace drawinglayer { const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA())); const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB())); + + // calculate discrete unit in WorldCoordinates; use diagonal (1.0, 1.0) and divide by sqrt(2) const basegfx::B2DVector aDiscreteVector(getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); - const double fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), fabs(aDiscreteVector.getY()))); + const double fDiscreteUnit(aDiscreteVector.getLength() * (1.0 / 1.414213562373)); // use color distance and discrete lengths to calculate step count const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDelta, fDiscreteUnit)); @@ -1439,8 +1441,10 @@ namespace drawinglayer { const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA())); const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB())); + + // calculate discrete unit in WorldCoordinates; use diagonal (1.0, 1.0) and divide by sqrt(2) const basegfx::B2DVector aDiscreteVector(getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); - const double fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), fabs(aDiscreteVector.getY()))); + const double fDiscreteUnit(aDiscreteVector.getLength() * (1.0 / 1.414213562373)); // use color distance and discrete lengths to calculate step count const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDeltaScale, fDiscreteUnit)); -- cgit