[Libreoffice-commits] core.git: Branch 'aoo/trunk' - drawinglayer/inc drawinglayer/source

Armin Le Grand alg at apache.org
Mon Jul 8 05:07:56 PDT 2013


 drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx |    3 ++-
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx           |    4 ++++
 drawinglayer/source/processor2d/vclprocessor2d.cxx                   |    8 ++++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit d8dfdae3da901a5a26182f3221c7aa374561672f
Author: Armin Le Grand <alg at apache.org>
Date:   Mon Jul 8 10:30:37 2013 +0000

    corrected warnings and numerical inconsequence in gradient fallback render handling

diff --git a/drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx
index 5737d51..887f300 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx
@@ -158,6 +158,7 @@ namespace drawinglayer
                 const basegfx::B2DPoint& rStart,
                 bool bUseUnitCoordinates,
                 SpreadMethod aSpreadMethod = Spread_pad);
+            virtual ~SvgGradientHelper();
 
             /// data read access
             const basegfx::B2DHomMatrix& getGradientTransform() const { return maGradientTransform; }
@@ -168,7 +169,7 @@ namespace drawinglayer
             SpreadMethod getSpreadMethod() const { return maSpreadMethod; }
 
             /// compare operator
-            virtual bool operator==(const SvgGradientHelper& rSvgGradientHelper) const;
+            bool operator==(const SvgGradientHelper& rSvgGradientHelper) const;
         };
     } // end of namespace primitive2d
 } // end of namespace drawinglayer
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 3a51096..73ea0c0 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -304,6 +304,10 @@ namespace drawinglayer
         {
         }
 
+        SvgGradientHelper::~SvgGradientHelper()
+        {
+        }
+
         bool SvgGradientHelper::operator==(const SvgGradientHelper& rSvgGradientHelper) const
         {
             const SvgGradientHelper& rCompare = static_cast< const SvgGradientHelper& >(rSvgGradientHelper);
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 574d743..7b9d474 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -1279,8 +1279,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));
@@ -1322,8 +1324,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));


More information about the Libreoffice-commits mailing list