[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - cppcanvas/source

Andrzej Hunt andrzej.hunt at collabora.com
Wed Jan 1 12:04:11 PST 2014


 cppcanvas/source/mtfrenderer/emfplus.cxx |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

New commits:
commit f5b984e416a05df220e339da2e9cda95ab660d85
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)
    Reviewed-on: https://gerrit.libreoffice.org/7248
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 01a77d6..5eefdf6 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -620,6 +620,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;
@@ -641,14 +654,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;
             }
@@ -786,8 +792,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};
@@ -1393,7 +1401,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;
 


More information about the Libreoffice-commits mailing list