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

Bartosz Kosiorek gang65 at poczta.onet.pl
Fri Apr 28 21:01:38 UTC 2017


 cppcanvas/source/mtfrenderer/emfplus.cxx |   33 +++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

New commits:
commit bafb6b59cf590f939753fc0009b8328c280837a9
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Sat Apr 8 01:10:05 2017 +0200

    tdf#107034 EMF+ Add support for import EmfPlusDrawPie record
    
    The EmfPlusDrawPie record specifies drawing a section of the interior of an ellipse.
    
    Change-Id: Icd9d64117cc612d348c531932931f31e4d04e567
    Reviewed-on: https://gerrit.libreoffice.org/36286
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
    (cherry picked from commit 2e7c94f5054dec4ab19c44209136c886793f0acb)
    Reviewed-on: https://gerrit.libreoffice.org/36530
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index a03b02d2b8b3..888b40a30431 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -65,7 +65,7 @@ namespace
 #define EmfPlusRecordTypeFillEllipse 0x400E
 #define EmfPlusRecordTypeDrawEllipse 0x400F
 #define EmfPlusRecordTypeFillPie 0x4010
-//TODO EmfPlusRecordTypeDrawPie 0x4011
+#define EmfPlusRecordTypeDrawPie 0x4011
 //TODO EmfPlusRecordTypeDrawArc 0x4012
 //TODO EmfPlusRecordTypeFillRegion 0x4013
 #define EmfPlusRecordTypeFillPath 0x4014
@@ -220,6 +220,7 @@ const char* emfTypeToName(sal_uInt16 type)
         case EmfPlusRecordTypeFillEllipse: return "EmfPlusRecordTypeFillEllipse";
         case EmfPlusRecordTypeDrawEllipse: return "EmfPlusRecordTypeDrawEllipse";
         case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
+        case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
         case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
         case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
         case EmfPlusRecordTypeDrawImage: return "EmfPlusRecordTypeDrawImage";
@@ -1898,19 +1899,29 @@ namespace cppcanvas
                         processObjectRecord (rMF, flags, dataSize);
                         break;
                     case EmfPlusRecordTypeFillPie:
+                    case EmfPlusRecordTypeDrawPie:
                         {
-                            sal_uInt32 brushIndexOrColor;
                             float startAngle, sweepAngle;
 
-                            rMF.ReadUInt32( brushIndexOrColor ).ReadFloat( startAngle ).ReadFloat( sweepAngle );
+                            // Silent MSVC warning C4701: potentially uninitialized local variable 'brushIndexOrColor' used
+                            sal_uInt32 brushIndexOrColor = 999;
 
-                            SAL_INFO("cppcanvas.emf", "EMF+ FillPie colorOrIndex: " << brushIndexOrColor << " startAngle: " << startAngle << " sweepAngle: " << sweepAngle);
+                            if ( type == EmfPlusRecordTypeFillPie )
+                            {
+                                rMF.ReadUInt32( brushIndexOrColor );
+                                SAL_INFO("cppcanvas.emf", "EMF+ FillPie colorOrIndex: " << brushIndexOrColor);
+                            }
+                            else
+                            {
+                                SAL_INFO("cppcanvas.emf", "EMF+ DrawPie");
+                            }
+                            rMF.ReadFloat( startAngle ).ReadFloat( sweepAngle );
 
                             float dx, dy, dw, dh;
 
                             ReadRectangle (rMF, dx, dy, dw, dh, bool(flags & 0x4000));
 
-                            SAL_INFO("cppcanvas.emf", "EMF+ RectData: " << dx << "," << dy << " " << dw << "x" << dh);
+                            SAL_INFO("cppcanvas.emf", "EMF+\t RectData: " << dx << "," << dy << " " << dw << "x" << dh);
 
                             startAngle = 2*M_PI*startAngle/360;
                             sweepAngle = 2*M_PI*sweepAngle/360;
@@ -1929,15 +1940,21 @@ namespace cppcanvas
                             if (sweepAngle < 0)
                                 std::swap (endAngle, startAngle);
 
-                            SAL_INFO("cppcanvas.emf", "EMF+ adjusted angles: start " <<
-                                     (360.0*startAngle/M_PI) << ", end: " << (360.0*endAngle/M_PI));
+                            SAL_INFO("cppcanvas.emf", "EMF+\t adjusted angles: start " <<
+                                     (360.0*startAngle/M_PI) << ", end: " << (360.0*endAngle/M_PI) <<
+                                     " startAngle: " << startAngle << " sweepAngle: " << sweepAngle);
 
                             B2DPolygon polygon = basegfx::tools::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX (), mappedSize.getY (), startAngle, endAngle);
                             polygon.append (mappedCenter);
                             polygon.setClosed (true);
 
                             B2DPolyPolygon polyPolygon (polygon);
-                            EMFPPlusFillPolygon (polyPolygon, rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
+                            if ( type == EmfPlusRecordTypeFillPie )
+                                EMFPPlusFillPolygon( polyPolygon,
+                                                     rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor );
+                            else
+                                EMFPPlusDrawPolygon( polyPolygon,
+                                                     rFactoryParms, rState, rCanvas, flags & 0xff );
                         }
                         break;
                     case EmfPlusRecordTypeFillPath:


More information about the Libreoffice-commits mailing list