diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-04-08 01:10:05 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-04-13 13:28:05 +0200 |
commit | 2e7c94f5054dec4ab19c44209136c886793f0acb (patch) | |
tree | 2382e64c7915d0c49f38242614b1e419967d3e63 /cppcanvas/source | |
parent | 9b693d896bf9a08cd8987e483f5269d6f2be1fd3 (diff) |
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@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'cppcanvas/source')
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfplus.cxx | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 73c488c2abba..618eddfa7915 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -75,7 +75,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 @@ -154,6 +154,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 EmfPlusRecordTypeDrawBeziers: return "EmfPlusRecordTypeDrawBeziers"; @@ -888,19 +889,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; @@ -919,15 +930,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: |