diff options
author | Armin Le Grand <alg@apache.org> | 2013-07-08 10:30:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-08 13:18:51 +0100 |
commit | 8b74ad05daa9e766c875152d1c82eee5926ee182 (patch) | |
tree | 8c5a54db6eef1bd3909d1a34540a2c07c7c009c1 | |
parent | a024849cf7bd2869ff18e111577454751278e7f6 (diff) |
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
3 files changed, 15 insertions, 7 deletions
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)); diff --git a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx index dc6aa42d7a21..db45d60d0d8b 100644 --- a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx @@ -156,7 +156,7 @@ namespace drawinglayer const basegfx::B2DPoint& rStart, bool bUseUnitCoordinates, SpreadMethod aSpreadMethod = Spread_pad); - virtual ~SvgGradientHelper() {} + virtual ~SvgGradientHelper(); /// data read access const basegfx::B2DHomMatrix& getGradientTransform() const { return maGradientTransform; } @@ -167,7 +167,7 @@ namespace drawinglayer SpreadMethod getSpreadMethod() const { return maSpreadMethod; } /// compare operator - bool equalTo(const SvgGradientHelper& rSvgGradientHelper) const; + bool operator==(const SvgGradientHelper& rSvgGradientHelper) const; }; } // end of namespace primitive2d } // end of namespace drawinglayer |