From ed30996f8fdae4f98d699c711c5b4c7b16e56888 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 7 Jun 2013 15:00:17 +0100 Subject: fdo#65502 - EmfFillPie fix. Change-Id: I395ef5f5175b9a2d758f4023605b8e2d4dce859f --- cppcanvas/source/mtfrenderer/emfplus.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index dfc9b3177c97..14670a4ad6f1 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -1342,18 +1342,19 @@ namespace cppcanvas B2DPoint mappedCenter (Map (dx + dw/2, dy + dh/2)); B2DSize mappedSize( MapSize (dw/2, dh/2)); - double endAngle = startAngle + sweepAngle; + float endAngle = startAngle + sweepAngle; + startAngle = fmod (startAngle, M_PI*2); + if (startAngle < 0) + startAngle += M_PI*2; + endAngle = fmod (endAngle, M_PI*2); if (endAngle < 0) endAngle += M_PI*2; - endAngle = fmod (endAngle, M_PI*2); - if (sweepAngle < 0) { - double tmp = startAngle; - startAngle = endAngle; - endAngle = tmp; - } + if (sweepAngle < 0) + std::swap (endAngle, startAngle); - SAL_INFO("cppcanvas.emf", "EMF+ angles: " << startAngle << "," << sweepAngle << " ---> " << startAngle << "," << endAngle); + SAL_INFO("cppcanvas.emf", "EMF+ adjusted angles: start " << + (360.0*startAngle/M_PI) << ", end: " << (360.0*endAngle/M_PI)); B2DPolygon polygon = tools::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX (), mappedSize.getY (), startAngle, endAngle); polygon.append (mappedCenter); -- cgit