[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - cppcanvas/source

Bartosz Kosiorek gang65 at poczta.onet.pl
Tue Apr 25 16:48:38 UTC 2017


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

New commits:
commit 10182700091869e869475bbbbfddcac02753076f
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Fri Apr 14 00:04:57 2017 +0200

    tdf#107159 EMF+ Add support for EmfPlusDrawArc record
    
    EmfPlusDrawArc record specifies drawing the arc of an ellipse.
    
    Change-Id: I87788a9b14f518a383cbc5b804af635427e4c395
    Reviewed-on: https://gerrit.libreoffice.org/36537
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
    (cherry picked from commit 715df6e9f8926e511dbdee52367ec08676f71952)
    Reviewed-on: https://gerrit.libreoffice.org/36587
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 993d5c762c49..9154f92b92bf 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -68,7 +68,7 @@ namespace
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
 #define EmfPlusRecordTypeDrawPie 0x4011
-//TODO EmfPlusRecordTypeDrawArc 0x4012
+#define EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
 #define EmfPlusRecordTypeDrawPath 0x4015
@@ -225,6 +225,7 @@ const char* emfTypeToName(sal_uInt16 type)
         case EmfPlusRecordTypeDrawEllipse: return "EmfPlusRecordTypeDrawEllipse";
         case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
         case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
+        case EmfPlusRecordTypeDrawArc: return "EmfPlusRecordTypeDrawArc";
         case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
         case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
         case EmfPlusRecordTypeDrawBeziers: return "EmfPlusRecordTypeDrawBeziers";
@@ -1911,6 +1912,7 @@ namespace cppcanvas
                         break;
                     case EmfPlusRecordTypeFillPie:
                     case EmfPlusRecordTypeDrawPie:
+                    case EmfPlusRecordTypeDrawArc:
                         {
                             float startAngle, sweepAngle;
 
@@ -1922,10 +1924,14 @@ namespace cppcanvas
                                 rMF.ReadUInt32( brushIndexOrColor );
                                 SAL_INFO("cppcanvas.emf", "EMF+ FillPie colorOrIndex: " << brushIndexOrColor);
                             }
-                            else
+                            else if ( type == EmfPlusRecordTypeDrawPie )
                             {
                                 SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
                             }
+                            else
+                            {
+                                SAL_INFO("cppcanvas.emf", "EMF+ DrawArc");
+                            }
                             rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle );
 
                             float dx, dy, dw, dh;
@@ -1956,8 +1962,11 @@ namespace cppcanvas
                                      " startAngle: " << startAngle << " sweepAngle: " << sweepAngle);
 
                             B2DPolygon polygon = basegfx::tools::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX (), mappedSize.getY (), startAngle, endAngle);
-                            polygon.append (mappedCenter);
-                            polygon.setClosed (true);
+                            if ( type != EmfPlusRecordTypeDrawArc )
+                            {
+                                polygon.append (mappedCenter);
+                                polygon.setClosed (true);
+                            }
 
                             B2DPolyPolygon polyPolygon (polygon);
                             if ( type == EmfPlusRecordTypeFillPie )


More information about the Libreoffice-commits mailing list