[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.0' - 3 commits - cppcanvas/source

Andrzej Hunt andrzej.hunt at collabora.com
Wed Jan 1 10:06:32 PST 2014


 cppcanvas/source/mtfrenderer/emfplus.cxx |   34 +++++++++++++++++++------------
 1 file changed, 21 insertions(+), 13 deletions(-)

New commits:
commit cd83c269adf8f50e2445788109f6536a41688822
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jan 1 17:07:56 2014 +0000

    EMF+: mapping can rotate the width vector, so use resulting length.
    
    Otherwise (i.e. with non-vertical lines) the width will be incorrect,
    and can result in lines disappearing as the resulting X component
    can be tiny/approaching zero.
    
    (cherry picked from commit 83f2b3c590120a60b5e94fb1a15054ebe0745dbb)
    
    Conflicts:
    	cppcanvas/source/mtfrenderer/emfplus.cxx
    
    Change-Id: Icf3b7c10c627594600b517b8ff445f8df87c56f8

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 613accb..c8ec849 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -780,7 +780,7 @@ namespace cppcanvas
             void SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState)
             {
                 EMFP_DEBUG (if (width == 0.0) printf ("EMF+\tTODO: pen with zero width - using minimal which might not be correct\n"));
-                rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX());
+                rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getLength());
             }
 
             void SetStrokeAttributes(rendering::StrokeAttributes& rStrokeAttributes)
commit de63446b2c2a01417bf85646696d135c0a5cba02
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jan 1 17:36:54 2014 +0000

    EMF+: actually use lineJoin attribute for polygons.
    
    Change-Id: I5b369703333332598353d9817f0253bbe5fc3601
    (cherry picked from commit 9b1ceabd5f696500d4fe2acb89170bd987966a9b)

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 906401e..613accb 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -615,6 +615,19 @@ namespace cppcanvas
             return rendering::PathCapType::BUTT;
         }
 
+        sal_Int8 lcl_convertLineJoinType(sal_uInt32 nEmfLineJoin)
+        {
+            switch (nEmfLineJoin)
+            {
+                case EmfPlusLineJoinTypeMiter:        // fall-through
+                case EmfPlusLineJoinTypeMiterClipped: return rendering::PathJoinType::MITER;
+                case EmfPlusLineJoinTypeBevel:        return rendering::PathJoinType::BEVEL;
+                case EmfPlusLineJoinTypeRound:        return rendering::PathJoinType::ROUND;
+            }
+            assert(false); // Line Join type isn't in specification.
+            return 0;
+        }
+
         struct EMFPCustomLineCap : public EMFPObject
         {
             sal_uInt32 type;
@@ -636,14 +649,7 @@ namespace cppcanvas
             {
                 aAttributes.StartCapType = lcl_convertStrokeCap(strokeStartCap);
                 aAttributes.EndCapType = lcl_convertStrokeCap(strokeEndCap);
-
-                switch (strokeJoin)
-                {
-                    case EmfPlusLineJoinTypeMiter:        // fall-through
-                    case EmfPlusLineJoinTypeMiterClipped: aAttributes.JoinType = rendering::PathJoinType::MITER; break;
-                    case EmfPlusLineJoinTypeBevel:        aAttributes.JoinType = rendering::PathJoinType::BEVEL; break;
-                    case EmfPlusLineJoinTypeRound:        aAttributes.JoinType = rendering::PathJoinType::ROUND; break;
-                }
+                aAttributes.JoinType = lcl_convertLineJoinType(strokeJoin);
 
                 aAttributes.MiterLimit = miterLimit;
             }
@@ -777,8 +783,10 @@ namespace cppcanvas
                 rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX());
             }
 
-            void SetStrokeDashing(rendering::StrokeAttributes& rStrokeAttributes)
+            void SetStrokeAttributes(rendering::StrokeAttributes& rStrokeAttributes)
             {
+                rStrokeAttributes.JoinType = lcl_convertLineJoinType(lineJoin);
+
                 if (dashStyle != EmfPlusLineStyleSolid)
                 {
                     const float dash[] = {3, 3};
@@ -1389,7 +1397,7 @@ namespace cppcanvas
                 // but eg. dashing has to be additionally set only on the
                 // polygon
                 rendering::StrokeAttributes aPolygonAttributes(aCommonAttributes);
-                pen->SetStrokeDashing(aPolygonAttributes);
+                pen->SetStrokeAttributes(aPolygonAttributes);
 
                 basegfx::B2DPolyPolygon aFinalPolyPolygon;
 
commit 942af58387a4720e8c5344787fa4584ca23a6c81
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Dec 26 18:57:28 2013 +0000

    EMF+: Integer coordinate values are signed.
    
    Change-Id: I5babcec50d48dc2a6288a01685db61fbb7058680
    (cherry picked from commit d8dedc775cedf0e9daf9284bc7e3a0331ccd2963)

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index be0588d..906401e 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -174,8 +174,8 @@ namespace cppcanvas
             {
                 for (int i = 0; i < nPoints; i ++) {
                     if (pathFlags & 0x4000) {
-                        // points are stored in short 16bit integer format
-                        sal_uInt16 x, y;
+                        // points are stored in signed short 16bit integer format
+                        sal_Int16 x, y;
 
                         s >> x >> y;
                         EMFP_DEBUG (printf ("EMF+\tpoint [x,y]: %hd,%hd\n", x, y));


More information about the Libreoffice-commits mailing list