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 19:44:45 +0200 |
commit | 9bd87273788216260ffb394889cf9a05540688f1 (patch) | |
tree | a8dcfbf8b9711f8badd05fb64147c32ff7b040f4 | |
parent | ed8d18338f705fe249c88f1e735d1b45a408b2f7 (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>
(cherry picked from commit 2e7c94f5054dec4ab19c44209136c886793f0acb)
Reviewed-on: https://gerrit.libreoffice.org/36531
-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 7ab9819026e0..a23de4d60a5b 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"; @@ -1904,19 +1905,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; @@ -1935,15 +1946,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: |