[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer
Armin Le Grand
alg at apache.org
Mon Jul 8 05:23:10 PDT 2013
drawinglayer/source/primitive2d/svggradientprimitive2d.cxx | 10 +++++++---
drawinglayer/source/processor2d/vclprocessor2d.cxx | 8 ++++++--
include/drawinglayer/primitive2d/svggradientprimitive2d.hxx | 4 ++--
3 files changed, 15 insertions(+), 7 deletions(-)
New commits:
commit 8b74ad05daa9e766c875152d1c82eee5926ee182
Author: Armin Le Grand <alg at apache.org>
Date: Mon Jul 8 10:30:37 2013 +0000
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
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 66d21f0..d9ca6e1 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 1ec9f50..86c51b2 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 dc6aa42..db45d60 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
More information about the Libreoffice-commits
mailing list