kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0092-EMF-actually-use-lineJoin-attribute-for-polygons.patch

f0633d
From f5b984e416a05df220e339da2e9cda95ab660d85 Mon Sep 17 00:00:00 2001
f0633d
From: Andrzej Hunt <andrzej.hunt@collabora.com>
f0633d
Date: Wed, 1 Jan 2014 17:36:54 +0000
f0633d
Subject: [PATCH 092/109] EMF+: actually use lineJoin attribute for polygons.
f0633d
MIME-Version: 1.0
f0633d
Content-Type: text/plain; charset=UTF-8
f0633d
Content-Transfer-Encoding: 8bit
f0633d
f0633d
Change-Id: I5b369703333332598353d9817f0253bbe5fc3601
f0633d
(cherry picked from commit 9b1ceabd5f696500d4fe2acb89170bd987966a9b)
f0633d
Reviewed-on: https://gerrit.libreoffice.org/7248
f0633d
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
f0633d
Tested-by: Caolán McNamara <caolanm@redhat.com>
f0633d
---
f0633d
 cppcanvas/source/mtfrenderer/emfplus.cxx | 28 ++++++++++++++++++----------
f0633d
 1 file changed, 18 insertions(+), 10 deletions(-)
f0633d
f0633d
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
f0633d
index 01a77d6..5eefdf6 100644
f0633d
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
f0633d
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
f0633d
@@ -620,6 +620,19 @@ namespace cppcanvas
f0633d
             return rendering::PathCapType::BUTT;
f0633d
         }
f0633d
 
f0633d
+        sal_Int8 lcl_convertLineJoinType(sal_uInt32 nEmfLineJoin)
f0633d
+        {
f0633d
+            switch (nEmfLineJoin)
f0633d
+            {
f0633d
+                case EmfPlusLineJoinTypeMiter:        // fall-through
f0633d
+                case EmfPlusLineJoinTypeMiterClipped: return rendering::PathJoinType::MITER;
f0633d
+                case EmfPlusLineJoinTypeBevel:        return rendering::PathJoinType::BEVEL;
f0633d
+                case EmfPlusLineJoinTypeRound:        return rendering::PathJoinType::ROUND;
f0633d
+            }
f0633d
+            assert(false); // Line Join type isn't in specification.
f0633d
+            return 0;
f0633d
+        }
f0633d
+
f0633d
         struct EMFPCustomLineCap : public EMFPObject
f0633d
         {
f0633d
             sal_uInt32 type;
f0633d
@@ -641,14 +654,7 @@ namespace cppcanvas
f0633d
             {
f0633d
                 aAttributes.StartCapType = lcl_convertStrokeCap(strokeStartCap);
f0633d
                 aAttributes.EndCapType = lcl_convertStrokeCap(strokeEndCap);
f0633d
-
f0633d
-                switch (strokeJoin)
f0633d
-                {
f0633d
-                    case EmfPlusLineJoinTypeMiter:        // fall-through
f0633d
-                    case EmfPlusLineJoinTypeMiterClipped: aAttributes.JoinType = rendering::PathJoinType::MITER; break;
f0633d
-                    case EmfPlusLineJoinTypeBevel:        aAttributes.JoinType = rendering::PathJoinType::BEVEL; break;
f0633d
-                    case EmfPlusLineJoinTypeRound:        aAttributes.JoinType = rendering::PathJoinType::ROUND; break;
f0633d
-                }
f0633d
+                aAttributes.JoinType = lcl_convertLineJoinType(strokeJoin);
f0633d
 
f0633d
                 aAttributes.MiterLimit = miterLimit;
f0633d
             }
f0633d
@@ -786,8 +792,10 @@ namespace cppcanvas
f0633d
                 rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX());
f0633d
             }
f0633d
 
f0633d
-            void SetStrokeDashing(rendering::StrokeAttributes& rStrokeAttributes)
f0633d
+            void SetStrokeAttributes(rendering::StrokeAttributes& rStrokeAttributes)
f0633d
             {
f0633d
+                rStrokeAttributes.JoinType = lcl_convertLineJoinType(lineJoin);
f0633d
+
f0633d
                 if (dashStyle != EmfPlusLineStyleSolid)
f0633d
                 {
f0633d
                     const float dash[] = {3, 3};
f0633d
@@ -1393,7 +1401,7 @@ namespace cppcanvas
f0633d
                 // but eg. dashing has to be additionally set only on the
f0633d
                 // polygon
f0633d
                 rendering::StrokeAttributes aPolygonAttributes(aCommonAttributes);
f0633d
-                pen->SetStrokeDashing(aPolygonAttributes);
f0633d
+                pen->SetStrokeAttributes(aPolygonAttributes);
f0633d
 
f0633d
                 basegfx::B2DPolyPolygon aFinalPolyPolygon;
f0633d
 
f0633d
-- 
f0633d
1.8.4.2
f0633d