[Libreoffice-commits] .: Branch 'libreoffice-4-0' - cppcanvas/source

2013-01-22 Thread Libreoffice Gerrit user
 cppcanvas/source/mtfrenderer/emfplus.cxx |   45 +++
 1 file changed, 45 insertions(+)

New commits:
commit 8aaf1142cdfda96094ee363cd7477a97021bcb76
Author: Radek Doulik r...@novell.com
Date:   Thu Jan 10 15:58:30 2013 +0100

implemented EmfPlusRecordTypeFillPie record

Change-Id: I15e7464a6a295bb4c1313c0a65ee33b6443c61c8
Signed-off-by: Andras Timar ati...@suse.com

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 3c791d4..f1b0eff 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -29,6 +29,7 @@
 #include basegfx/range/b2drange.hxx
 #include basegfx/range/b2drectangle.hxx
 #include basegfx/polygon/b2dpolygon.hxx
+#include basegfx/polygon/b2dpolygontools.hxx
 #include basegfx/polygon/b2dpolypolygon.hxx
 #include basegfx/polygon/b2dpolypolygontools.hxx
 #include vcl/canvastools.hxx
@@ -52,6 +53,7 @@
 #define EmfPlusRecordTypeFillRects 16394
 #define EmfPlusRecordTypeFillPolygon 16396
 #define EmfPlusRecordTypeDrawLines 16397
+#define EmfPlusRecordTypeFillPie 16400
 #define EmfPlusRecordTypeFillPath 16404
 #define EmfPlusRecordTypeDrawPath 16405
 #define EmfPlusRecordTypeDrawImage 16410
@@ -93,6 +95,7 @@
 #endif
 
 using namespace ::com::sun::star;
+using namespace ::basegfx;
 
 namespace cppcanvas
 {
@@ -1234,6 +1237,48 @@ namespace cppcanvas
 case EmfPlusRecordTypeObject:
 processObjectRecord (rMF, flags);
 break;
+case EmfPlusRecordTypeFillPie:
+{
+sal_uInt32 brushIndexOrColor;
+float startAngle, sweepAngle;
+
+rMF  brushIndexOrColor  startAngle  sweepAngle;
+
+EMFP_DEBUG (printf (EMF+ FillPie colorOrIndex: %x 
startAngle: %f sweepAngle: %f\n, (unsigned int)brushIndexOrColor, startAngle, 
sweepAngle));
+
+float dx, dy, dw, dh;
+
+ReadRectangle (rMF, dx, dy, dw, dh, flags  0x4000);
+
+EMFP_DEBUG (printf (EMF+ RectData: %f,%f %fx%f\n, 
dx, dy, dw, dh));
+
+startAngle = 2*M_PI*startAngle/360;
+sweepAngle = 2*M_PI*sweepAngle/360;
+
+B2DPoint mappedCenter (Map (dx + dw/2, dy + dh/2));
+B2DSize mappedSize( MapSize (dw/2, dh/2));
+
+double endAngle = startAngle + sweepAngle;
+if (endAngle  0)
+endAngle += M_PI*2;
+endAngle = fmod (endAngle, M_PI*2);
+
+if (sweepAngle  0) {
+double tmp = startAngle;
+startAngle = endAngle;
+endAngle = tmp;
+}
+
+EMFP_DEBUG (printf (EMF+ angles: %f,%f  --- 
%f,%f\n, startAngle, sweepAngle, startAngle, endAngle));
+
+B2DPolygon polygon = 
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);
+}
+break;
 case EmfPlusRecordTypeFillPath:
 {
 sal_uInt32 index = flags  0xff;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-4-0' - cppcanvas/source

2012-12-11 Thread Libreoffice Gerrit user
 cppcanvas/source/mtfrenderer/implrenderer.cxx |   26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 6ca5bb7683af39997a267952f053d7c08a1516e8
Author: Michael Meeks michael.me...@suse.com
Date:   Tue Dec 11 10:56:58 2012 +

fdo#35680 - fix wrong gradient rendering when grouped.

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx 
b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index e8f40bd..1f3872b 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -696,10 +696,23 @@ namespace cppcanvas
 
 case GradientStyle_AXIAL:
 {
-
basegfx::tools::createLinearODFGradientInfo(aGradInfo,
+// Adapt the border so that it is suitable
+// for the axial gradient.  An axial
+// gradient consists of two linear
+// gradients.  Each of those covers half
+// of the total size.  In order to
+// compensate for the condensed display of
+// the linear gradients, we have to
+// enlarge the area taken up by the actual
+// gradient (1-fBorder).  After that we
+// have to turn the result back into a
+// border value, hence the second (left
+// most 1-...
+const double fAxialBorder (1-2*(1-fBorder));
+
basegfx::tools::createAxialODFGradientInfo(aGradInfo,
 
aBounds,
 nSteps,
-
fBorder,
+
fAxialBorder,
 
fRotation);
 // map odf to svg gradient orientation - x
 // instead of y direction
@@ -760,15 +773,6 @@ namespace cppcanvas
 break;
 }
 
-// As the texture coordinate space is relative to
-// the polygon coordinate space (NOT to the
-// polygon itself), move gradient to the start of
-// the actual polygon. If we skip this, the
-// gradient will always display at the origin, and
-// not within the polygon bound (which might be
-// miles away from the origin).
-aGradInfo.maTextureTransform.translate( aBounds.getMinX(),
-aBounds.getMinY() 
);
 ::basegfx::unotools::affineMatrixFromHomMatrix( 
aTexture.AffineTransform,
 
aGradInfo.maTextureTransform );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits