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

2013-11-26 Thread Jan Holesovsky
 cppcanvas/source/mtfrenderer/emfplus.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e6685ba6808a1315ebf0c8f988ef8533be193857
Author: Jan Holesovsky ke...@collabora.com
Date:   Tue Nov 19 10:02:12 2013 +0100

EMF+: Stroke size is always supposed to be absolute.

Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx

Change-Id: I7221311e5dee6384dc2d1c071bf6f1c61811895a
Reviewed-on: https://gerrit.libreoffice.org/6801
Reviewed-by: Andras Timar andras.ti...@collabora.com
Tested-by: Andras Timar andras.ti...@collabora.com

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 6ca731a..b0acbd3 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -609,7 +609,7 @@ namespace cppcanvas
 void SetStrokeAttributes (rendering::StrokeAttributes 
rStrokeAttributes, ImplRenderer rR, const OutDevState rState)
 {
 EMFP_DEBUG (if (width == 0.0) printf (EMF+\tTODO: pen with 
zero width - using minimal which might not be correct\n));
-rStrokeAttributes.StrokeWidth = (rState.mapModeTransform * 
rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX ();
+rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform 
* rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX());
 }
 
 void Read (SvStream s, ImplRenderer rR, sal_Int32, sal_Int32 )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-11-26 Thread Jan Holesovsky
 cppcanvas/source/mtfrenderer/emfplus.cxx |   51 +--
 1 file changed, 49 insertions(+), 2 deletions(-)

New commits:
commit d1f3dc8b43f65c6c16b6f58f3d5ee84f22001163
Author: Jan Holesovsky ke...@collabora.com
Date:   Fri Nov 22 12:01:15 2013 +0100

EMF+: Implement line dashing.

Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx

Change-Id: I9eb21c0a8b5baa5b0080845f61b12fc65034d959
Reviewed-on: https://gerrit.libreoffice.org/6803
Reviewed-by: Andras Timar andras.ti...@collabora.com
Tested-by: Andras Timar andras.ti...@collabora.com

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index b0acbd3..4968a6f 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -92,6 +92,13 @@
 #define EmfPlusRegionInitialStateEmpty 0x1002
 #define EmfPlusRegionInitialStateInfinite 0x1003
 
+const sal_Int32 EmfPlusLineStyleSolid = 0x;
+const sal_Int32 EmfPlusLineStyleDash = 0x0001;
+const sal_Int32 EmfPlusLineStyleDot = 0x0002;
+const sal_Int32 EmfPlusLineStyleDashDot = 0x0003;
+const sal_Int32 EmfPlusLineStyleDashDotDot = 0x0004;
+const sal_Int32 EmfPlusLineStyleCustom = 0x0005;
+
 #if OSL_DEBUG_LEVEL  1
 #define EMFP_DEBUG(x) x
 #else
@@ -610,6 +617,34 @@ namespace cppcanvas
 {
 EMFP_DEBUG (if (width == 0.0) printf (EMF+\tTODO: pen with 
zero width - using minimal which might not be correct\n));
 rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform 
* rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX());
+
+// set dashing
+if (dashStyle != EmfPlusLineStyleSolid)
+{
+const float dash[] = {3, 3};
+const float dot[] = {1, 3};
+const float dashdot[] = {3, 3, 1, 3};
+const float dashdotdot[] = {3, 3, 1, 3, 1, 3};
+
+sal_Int32 nLen = 0;
+const float *pPattern;
+switch (dashStyle)
+{
+case EmfPlusLineStyleDash:   nLen = 
SAL_N_ELEMENTS(dash); pPattern = dash; break;
+case EmfPlusLineStyleDot:nLen = 
SAL_N_ELEMENTS(dot); pPattern = dot; break;
+case EmfPlusLineStyleDashDot:nLen = 
SAL_N_ELEMENTS(dashdot); pPattern = dashdot; break;
+case EmfPlusLineStyleDashDotDot: nLen = 
SAL_N_ELEMENTS(dashdotdot); pPattern = dashdotdot; break;
+case EmfPlusLineStyleCustom: nLen = 
dashPatternLen; pPattern = dashPattern; break;
+}
+if (nLen  0)
+{
+uno::Sequencedouble aDashArray(nLen);
+for (int i = 0; i  nLen; ++i)
+aDashArray[i] = pPattern[i];
+
+rStrokeAttributes.DashArray = aDashArray;
+}
+}
 }
 
 void Read (SvStream s, ImplRenderer rR, sal_Int32, sal_Int32 )
@@ -645,7 +680,10 @@ namespace cppcanvas
 mitterLimit = 0;
 
 if (penFlags  32)
+{
 s  dashStyle;
+SAL_INFO(cppcanvas.emf, EMF+\t\tdashStyle: 0x  
std::hex  dashStyle);
+}
 else
 dashStyle = 0;
 
@@ -659,14 +697,23 @@ namespace cppcanvas
 else
 dashOffset = 0;
 
-if (penFlags  256) {
+if (penFlags  256)
+{
+dashStyle = EmfPlusLineStyleCustom;
+
 s  dashPatternLen;
+SAL_INFO(cppcanvas.emf, EMF+\t\tdashPatternLen:   
dashPatternLen);
+
 if( dashPatternLen0 || 
sal_uInt32(dashPatternLen)SAL_MAX_INT32/sizeof(float) )
 dashPatternLen = SAL_MAX_INT32/sizeof(float);
 dashPattern = new float [dashPatternLen];
 for (i = 0; i  dashPatternLen; i++)
+{
 s  dashPattern [i];
-} else
+SAL_INFO(cppcanvas.emf, EMF+\t\t\tdashPattern[  
i  ]:   dashPattern[i]);
+}
+}
+else
 dashPatternLen = 0;
 
 if (penFlags  512)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-11-26 Thread Jan Holesovsky
 cppcanvas/source/inc/implrenderer.hxx|9 
 cppcanvas/source/mtfrenderer/emfplus.cxx |  314 +++
 2 files changed, 290 insertions(+), 33 deletions(-)

New commits:
commit 3541cefc54c9cdac06b2139b16eb0f37ac9d85d8
Author: Jan Holesovsky ke...@collabora.com
Date:   Fri Nov 22 17:06:10 2013 +0100

EMF+: Parse and render custom line cap data.

Contains the following commits:

* EMF+: Small cleanup  more logging in preparation for line starts  ends.
* EMF+: Parse custom line cap data for start and end line caps.
* EMF+: Render custom line cap data.
* EMF+: Set the stroke attributes on the custom line caps.

Change-Id: If35ef1c44f34f5d5e6c50789c907105d03e96fca
Reviewed-on: https://gerrit.libreoffice.org/6806
Reviewed-by: Andras Timar andras.ti...@collabora.com
Tested-by: Andras Timar andras.ti...@collabora.com

diff --git a/cppcanvas/source/inc/implrenderer.hxx 
b/cppcanvas/source/inc/implrenderer.hxx
index 4537368..82099a2 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -272,7 +272,14 @@ static float GetSwapFloat( SvStream rSt )
 /* EMF+ */
 void processEMFPlus( MetaCommentAction* pAct, const 
ActionFactoryParameters rFactoryParms, OutDevState rState, const 
CanvasSharedPtr rCanvas );
 double setFont( sal_uInt8 objectId, const ActionFactoryParameters 
rParms, OutDevState rState );
-void EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon polygon, 
const ActionFactoryParameters rParms, OutDevState rState, const 
CanvasSharedPtr rCanvas, sal_uInt32 penIndex);
+
+/// Render LineCap, like the start or end arrow of a polygon.
+void EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon rPolygon, 
double fPolyLength,
+const ::basegfx::B2DPolyPolygon rLineCap, bool bStart,
+const com::sun::star::rendering::StrokeAttributes 
rAttributes,
+const ActionFactoryParameters rParms, OutDevState 
rState);
+
+void EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon 
polygon, const ActionFactoryParameters rParms, OutDevState rState, const 
CanvasSharedPtr rCanvas, sal_uInt32 penIndex);
 void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon polygon, 
const ActionFactoryParameters rParms, OutDevState rState, const 
CanvasSharedPtr rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
 
 ActionVector maActions;
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 4968a6f..3943bea 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -28,6 +28,7 @@
 #include basegfx/vector/b2dsize.hxx
 #include basegfx/range/b2drange.hxx
 #include basegfx/range/b2drectangle.hxx
+#include basegfx/polygon/b2dlinegeometry.hxx
 #include basegfx/polygon/b2dpolygon.hxx
 #include basegfx/polygon/b2dpolygontools.hxx
 #include basegfx/polygon/b2dpolypolygon.hxx
@@ -36,8 +37,10 @@
 #include rtl/ustring.hxx
 #include sal/alloca.h
 
-#include com/sun/star/rendering/XCanvas.hpp
+#include com/sun/star/rendering/PathCapType.hpp
+#include com/sun/star/rendering/PathJoinType.hpp
 #include com/sun/star/rendering/TexturingMode.hpp
+#include com/sun/star/rendering/XCanvas.hpp
 
 #include bitmapaction.hxx
 #include implrenderer.hxx
@@ -99,6 +102,22 @@ const sal_Int32 EmfPlusLineStyleDashDot = 0x0003;
 const sal_Int32 EmfPlusLineStyleDashDotDot = 0x0004;
 const sal_Int32 EmfPlusLineStyleCustom = 0x0005;
 
+const sal_uInt32 EmfPlusCustomLineCapDataTypeDefault = 0x;
+const sal_uInt32 EmfPlusCustomLineCapDataTypeAdjustableArrow = 0x0001;
+
+const sal_uInt32 EmfPlusCustomLineCapDataFillPath = 0x0001;
+const sal_uInt32 EmfPlusCustomLineCapDataLinePath = 0x0002;
+
+const sal_uInt32 EmfPlusLineCapTypeFlat = 0x;
+const sal_uInt32 EmfPlusLineCapTypeSquare = 0x0001;
+const sal_uInt32 EmfPlusLineCapTypeRound = 0x0002;
+const sal_uInt32 EmfPlusLineCapTypeTriangle = 0x0003;
+
+const sal_uInt32 EmfPlusLineJoinTypeMiter = 0x;
+const sal_uInt32 EmfPlusLineJoinTypeBevel = 0x0001;
+const sal_uInt32 EmfPlusLineJoinTypeRound = 0x0002;
+const sal_uInt32 EmfPlusLineJoinTypeMiterClipped = 0x0003;
+
 #if OSL_DEBUG_LEVEL  1
 #define EMFP_DEBUG(x) x
 #else
@@ -587,6 +606,137 @@ namespace cppcanvas
 }
 };
 
+/// Convert stroke caps between EMF+ and rendering API
+sal_Int8 lcl_convertStrokeCap(sal_uInt32 nEmfStroke)
+{
+switch (nEmfStroke)
+{
+case EmfPlusLineCapTypeSquare: return 
rendering::PathCapType::SQUARE;
+case EmfPlusLineCapTypeRound:  return 
rendering::PathCapType::ROUND;
+}
+
+// we have no mapping for EmfPlusLineCapTypeTriangle, so return
+// BUTT always
+return 

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

2013-06-07 Thread Fridrich Štrba
 cppcanvas/source/mtfrenderer/emfplus.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5cef424e1a46ea50da8c0dafabe226dc79b65332
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Fri Jun 7 15:33:13 2013 +0200

Transform the clipping polygon before using it

(cherry picked from commit abdbb847fa135dd758ef3ef99db4c07a2671ca47)

Change-Id: I71a00f7d4b80ef41b637889e51a414fac6883ba1
Signed-off-by: Thorsten Behrens tbehr...@suse.com

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 4282c47..897fa9517 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1770,6 +1770,7 @@ namespace cppcanvas

 
mappedPoint.getX() + mappedSize.getX(),

 
mappedPoint.getY() + mappedSize.getY() ) ) ) );
 
+polyPolygon.transform(rState.mapModeTransform);
 updateClipping (polyPolygon, rFactoryParms, 
combineMode == 1);
 
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-07 Thread Michael Meeks
 cppcanvas/source/mtfrenderer/emfplus.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 1baad113b2b5210982819f6e43d392d5533ac1ca
Author: Michael Meeks michael.me...@suse.com
Date:   Fri Jun 7 14:45:59 2013 +0100

fdo#65502 - EmfFillPie fix.

Change-Id: Ic52ae70c7879de93029ecfd8b3de85c5fbcfa9eb
Reviewed-on: https://gerrit.libreoffice.org/4189
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 897fa9517..03481ea 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1298,18 +1298,18 @@ 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);
 
-EMFP_DEBUG (printf (EMF+ angles: %f,%f  --- 
%f,%f\n, startAngle, sweepAngle, startAngle, endAngle));
+EMFP_DEBUG (printf (EMF+ adjusted angles to: %f,%f\n,
+360.0*startAngle/M_PI, 
360.0*endAngle/M_PI));
 
 B2DPolygon polygon = 
tools::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX (), 
mappedSize.getY (), startAngle, endAngle);
 polygon.append (mappedCenter);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-07 Thread Michael Stahl
 cppcanvas/source/mtfrenderer/emfplus.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 3e694124efbc136058d78038d8be00cd92281662
Author: Michael Stahl mst...@redhat.com
Date:   Fri Jun 7 20:54:33 2013 +0200

cppcanvas: try to make MSVC tinderbox happy

(cherry picked from commit 930127da85ee72ccec6b81efc18cc9878f11d88d)
Signed-off-by: Fridrich Å trba fridrich.st...@bluewin.ch

Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx

Change-Id: If4fd5a788d3907a986e27f5f53d5995c7035f685

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 03481ea..6ca731a 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1299,12 +1299,12 @@ namespace cppcanvas
 B2DSize mappedSize( MapSize (dw/2, dh/2));
 
 float endAngle = startAngle + sweepAngle;
-startAngle = fmod (startAngle, M_PI*2);
+startAngle = fmodf(startAngle, M_PI*2);
 if (startAngle  0)
-startAngle += M_PI*2;
-endAngle = fmod (endAngle, M_PI*2);
+startAngle += static_castfloat(M_PI*2);
+endAngle = fmodf(endAngle, M_PI*2);
 if (endAngle  0)
-endAngle += M_PI*2;
+endAngle += static_castfloat(M_PI*2);
 if (sweepAngle  0)
 std::swap (endAngle, startAngle);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-03-19 Thread Radek Doulik
 cppcanvas/source/inc/implrenderer.hxx|   12 ++
 cppcanvas/source/inc/outdevstate.hxx |  126 +++
 cppcanvas/source/mtfrenderer/emfplus.cxx |   49 ++
 cppcanvas/source/mtfrenderer/outdevstate.hxx |  126 ---
 4 files changed, 184 insertions(+), 129 deletions(-)

New commits:
commit 5a86702e13b3654982f1ee84da981d7fb8c442c5
Author: Radek Doulik r...@novell.com
Date:   Tue Mar 19 13:17:42 2013 +0100

implemented EmfPlusRecordTypeSave and EmfPlusRecordTypeRestore records

Change-Id: Iac87870c0f50a74b7f4db4c674adcded1494c055

Signed-off-by: Fridrich Å trba fridrich.st...@bluewin.ch

diff --git a/cppcanvas/source/inc/implrenderer.hxx 
b/cppcanvas/source/inc/implrenderer.hxx
index c2902d6..4537368 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -28,8 +28,10 @@
 
 #include canvasgraphichelper.hxx
 #include action.hxx
+#include outdevstate.hxx
 
 #include vector
+#include map
 
 class GDIMetaFile;
 class VirtualDevice;
@@ -166,6 +168,12 @@ static float GetSwapFloat( SvStream rSt )
 }
 };
 
+// EMF+
+typedef struct {
+XForm aWorldTransform;
+OutDevState aDevState;
+} EmfPlusGraphicState;
+
 class ImplRenderer : public virtual Renderer, protected 
CanvasGraphicHelper
 {
 public:
@@ -278,7 +286,6 @@ static float GetSwapFloat( SvStream rSt )
 sal_Int32   nOriginY;
 sal_Int32   nHDPI;
 sal_Int32   nVDPI;
-::PolyPolygon   aClippingPolygon;
 /* EMF+ emf header info */
 sal_Int32   nFrameLeft;
 sal_Int32   nFrameTop;
@@ -292,6 +299,9 @@ static float GetSwapFloat( SvStream rSt )
 boolmbMultipart;
 sal_uInt16  mMFlags;
 SvMemoryStream  mMStream;
+/* emf+ graphic state stack */
+::std::mapint,EmfPlusGraphicState mGSStack;
+typedef ::std::mapint,EmfPlusGraphicState::iterator EPGSSIter;
 };
 
 
diff --git a/cppcanvas/source/inc/outdevstate.hxx 
b/cppcanvas/source/inc/outdevstate.hxx
new file mode 100644
index 000..26e1026
--- /dev/null
+++ b/cppcanvas/source/inc/outdevstate.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the License); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_OUTDEVSTATE_HXX
+#define _CPPCANVAS_OUTDEVSTATE_HXX
+
+#include com/sun/star/uno/Reference.hxx
+#include com/sun/star/uno/Sequence.hxx
+
+#include com/sun/star/rendering/StringContext.hpp
+#include com/sun/star/rendering/RenderState.hpp
+#include com/sun/star/rendering/XPolyPolygon2D.hpp
+#include com/sun/star/rendering/XCanvasFont.hpp
+#include com/sun/star/rendering/TextDirection.hpp
+#include basegfx/matrix/b2dhommatrix.hxx
+#include basegfx/polygon/b2dpolypolygon.hxx
+#include vcl/fntstyle.hxx
+#include vcl/vclenum.hxx
+#include vcl/outdev.hxx
+
+
+namespace cppcanvas
+{
+namespace internal
+{
+struct OutDevState
+{
+OutDevState() :
+clip(),
+clipRect(),
+xClipPoly(),
+
+lineColor(),
+fillColor(),
+textColor(),
+textFillColor(),
+textLineColor(),
+
+xFont(),
+transform(),
+mapModeTransform(),
+fontRotation(0.0),
+
+textEmphasisMarkStyle(EMPHASISMARK_NONE),
+pushFlags(PUSH_ALL),
+
textDirection(::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT),
+textAlignment(0), // TODO(Q2): Synchronize with implrenderer
+  // and possibly new rendering::TextAlignment
+textReliefStyle(RELIEF_NONE),
+textOverlineStyle(UNDERLINE_NONE),
+textUnderlineStyle(UNDERLINE_NONE),
+textStrikeoutStyle(STRIKEOUT_NONE),
+textReferencePoint(ALIGN_BASELINE),
+
+isTextOutlineModeSet( false 

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

2013-03-15 Thread Radek Doulik
 cppcanvas/source/mtfrenderer/emfplus.cxx |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit f820b5b5b97fff0393a2c346f579384e63f7c2db
Author: Radek Doulik r...@novell.com
Date:   Fri Mar 15 14:48:05 2013 +0100

implemented EmfPlusRecordTypeFillEllipse record

(cherry picked from commit cf6b2f0ecef2c23c24114ca1a1609a4a81ade8a1)

Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx

Change-Id: Id9362d05ddae2066f2fa289640f447393d7cda84
Reviewed-on: https://gerrit.libreoffice.org/2749
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 1dbbd82..383ce31 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -53,6 +53,8 @@
 #define EmfPlusRecordTypeFillRects 16394
 #define EmfPlusRecordTypeFillPolygon 16396
 #define EmfPlusRecordTypeDrawLines 16397
+#define EmfPlusRecordTypeFillEllipse 16398
+#define EmfPlusRecordTypeDrawEllipse 16399
 #define EmfPlusRecordTypeFillPie 16400
 #define EmfPlusRecordTypeFillPath 16404
 #define EmfPlusRecordTypeDrawPath 16405
@@ -1289,7 +1291,31 @@ namespace cppcanvas
 
 EMFP_DEBUG (printf (EMF+ FillPath slot: %u\n, 
(unsigned int)index));
 
-EMFPPlusFillPolygon (((EMFPPath*) aObjects 
[index])-GetPolygon (*this), rFactoryParms, rState, rCanvas, flags  0x8000, 
brushIndexOrColor);
+EMFPPlusFillPolygon (((EMFPPath*) aObjects 
[index])-GetPolygon (*this), rFactoryParms, rState, rCanvas, flags  0x8000, 
brushIndexOrColor);
+}
+break;
+case EmfPlusRecordTypeFillEllipse:
+{
+sal_uInt32 index = flags  0xff;
+sal_uInt32 brushIndexOrColor;
+
+rMF  brushIndexOrColor;
+
+EMFP_DEBUG (printf (EMF+ FillEllipse slot: %u\n, 
(unsigned int)index));
+
+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));
+
+B2DPoint mappedCenter (Map (dx + dw/2, dy + dh/2));
+B2DSize mappedSize( MapSize (dw/2, dh/2));
+
+::basegfx::B2DPolyPolygon polyPolygon( 
::basegfx::B2DPolygon( ::basegfx::tools::createPolygonFromEllipse( 
mappedCenter, mappedSize.getX (), mappedSize.getY () ) ) );
+
+EMFPPlusFillPolygon( polyPolygon,
+ rFactoryParms, rState, rCanvas, 
flags  0x8000, brushIndexOrColor );
 }
 break;
 case EmfPlusRecordTypeFillRects:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-03-15 Thread Radek Doulik
 cppcanvas/source/inc/implrenderer.hxx|1 
 cppcanvas/source/mtfrenderer/emfplus.cxx |   80 +--
 2 files changed, 47 insertions(+), 34 deletions(-)

New commits:
commit 46d4224d1ac0ae4aab52c3bb7f4f844928cce260
Author: Radek Doulik r...@novell.com
Date:   Fri Mar 15 15:30:40 2013 +0100

implemented EmfPlusRecordTypeDrawEllipse record

(cherry picked from commit fa109b4603f06533a63ee19518c482a23976bfe8)

Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx

Change-Id: If8d7c210e437a041f3202c09f3d26d621b5af748

ops, fix build

(cherry picked from commit ebebb309403498a9438a908a26248b05cc855879)

Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx

Change-Id: If72f3c1e0d7a14779074d898c4d1eb0fe8f07871
Reviewed-on: https://gerrit.libreoffice.org/2751
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/cppcanvas/source/inc/implrenderer.hxx 
b/cppcanvas/source/inc/implrenderer.hxx
index 7d82ea7..c2902d6 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -264,6 +264,7 @@ static float GetSwapFloat( SvStream rSt )
 /* EMF+ */
 void processEMFPlus( MetaCommentAction* pAct, const 
ActionFactoryParameters rFactoryParms, OutDevState rState, const 
CanvasSharedPtr rCanvas );
 double setFont( sal_uInt8 objectId, const ActionFactoryParameters 
rParms, OutDevState rState );
+void EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon polygon, 
const ActionFactoryParameters rParms, OutDevState rState, const 
CanvasSharedPtr rCanvas, sal_uInt32 penIndex);
 void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon polygon, 
const ActionFactoryParameters rParms, OutDevState rState, const 
CanvasSharedPtr rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
 
 ActionVector maActions;
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 383ce31..de5c480 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1092,6 +1092,41 @@ namespace cppcanvas
 }
 }
 
+void ImplRenderer::EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon 
polygon, const ActionFactoryParameters rParms,
+OutDevState rState, const 
CanvasSharedPtr rCanvas, sal_uInt32 penIndex)
+{
+EMFPPen* pen = (EMFPPen*) aObjects [penIndex  0xff];
+
+SAL_WARN_IF( !pen, cppcanvas, emf+ missing pen );
+
+if (pen)
+{
+rState.isFillColorSet = false;
+rState.isLineColorSet = true;
+rState.lineColor = ::vcl::unotools::colorToDoubleSequence 
(pen-GetColor (),
+   
rCanvas-getUNOCanvas ()-getDevice()-getDeviceColorSpace());
+
+polygon.transform( rState.mapModeTransform );
+rendering::StrokeAttributes aStrokeAttributes;
+
+pen-SetStrokeAttributes (aStrokeAttributes, *this, rState);
+
+ActionSharedPtr pPolyAction(
+
internal::PolyPolyActionFactory::createPolyPolyAction(
+   
   polygon, rParms.mrCanvas, rState, aStrokeAttributes ) );
+
+if( pPolyAction )
+{
+maActions.push_back(
+MtfAction(
+  pPolyAction,
+  rParms.mrCurrActionIndex ) );
+
+rParms.mrCurrActionIndex += 
pPolyAction-getActionCount()-1;
+}
+}
+}
+
 void ImplRenderer::processObjectRecord(SvMemoryStream rObjectStream, 
sal_uInt16 flags, sal_uInt32 dataSize, sal_Bool bUseWholeStream)
 {
 sal_uInt32 index;
@@ -1294,14 +1329,15 @@ namespace cppcanvas
 EMFPPlusFillPolygon (((EMFPPath*) aObjects 
[index])-GetPolygon (*this), rFactoryParms, rState, rCanvas, flags  0x8000, 
brushIndexOrColor);
 }
 break;
+case EmfPlusRecordTypeDrawEllipse:
 case EmfPlusRecordTypeFillEllipse:
 {
-sal_uInt32 index = flags  0xff;
 sal_uInt32 brushIndexOrColor;
 
-rMF  brushIndexOrColor;
+if ( type == EmfPlusRecordTypeFillEllipse )
+rMF  brushIndexOrColor;
 
-EMFP_DEBUG (printf (EMF+ FillEllipse slot: %u\n, 
(unsigned int)index));
+EMFP_DEBUG (printf 

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

2013-03-07 Thread Fridrich Štrba
 cppcanvas/source/inc/implrenderer.hxx|2 +-
 cppcanvas/source/mtfrenderer/emfplus.cxx |   26 +++---
 2 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 99f785a595617444e0e69d66d9a2f886d9a5718e
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Thu Mar 7 10:16:56 2013 +0100

Backport of EMF+ changes from master

Change-Id: Ibfc5d700a81e661b663dfd3eb1f83e488fd1112f
Reviewed-on: https://gerrit.libreoffice.org/2581
Reviewed-by: Radek Doulík r...@novell.com
Tested-by: Radek Doulík r...@novell.com

diff --git a/cppcanvas/source/inc/implrenderer.hxx 
b/cppcanvas/source/inc/implrenderer.hxx
index 7f34ad8..7d82ea7 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -259,7 +259,7 @@ static float GetSwapFloat( SvStream rSt )
ActionVector::const_iterator o_rRangeBegin,
ActionVector::const_iterator o_rRangeEnd ) 
const;
 
-void processObjectRecord(SvMemoryStream rObjectStream, sal_uInt16 
flags, sal_Bool bUseWholeStream = sal_False);
+void processObjectRecord(SvMemoryStream rObjectStream, sal_uInt16 
flags, sal_uInt32 dataSize, sal_Bool bUseWholeStream = sal_False);
 
 /* EMF+ */
 void processEMFPlus( MetaCommentAction* pAct, const 
ActionFactoryParameters rFactoryParms, OutDevState rState, const 
CanvasSharedPtr rCanvas );
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 0c9db41..1dbbd82 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -714,7 +714,7 @@ namespace cppcanvas
 Graphic graphic;
 
 
-void Read (SvMemoryStream s, sal_Bool bUseWholeStream)
+void Read (SvMemoryStream s, sal_uInt32 dataSize, sal_Bool 
bUseWholeStream)
 {
 sal_uInt32 header, unknown;
 
@@ -736,11 +736,11 @@ namespace cppcanvas
 sal_Int32 mfType, mfSize;
 
 s  mfType  mfSize;
-EMFP_DEBUG (printf (EMF+\tmetafile type: %d dataSize: 
%d\n, mfType, mfSize));
+EMFP_DEBUG (printf (EMF+\tmetafile type: %d dataSize: %d 
real size calculated from record dataSize: %d\n, mfType, mfSize, dataSize - 
16));
 
 GraphicFilter filter;
 // workaround buggy metafiles, which have wrong mfSize set 
(n#705956 for example)
-SvMemoryStream mfStream (((char *)s.GetData()) + s.Tell(), 
bUseWholeStream ? s.remainingSize() : mfSize, STREAM_READ);
+SvMemoryStream mfStream (((char *)s.GetData()) + s.Tell(), 
bUseWholeStream ? s.remainingSize() : dataSize - 16, STREAM_READ);
 
 filter.ImportGraphic (graphic, String (), mfStream);
 
@@ -1090,7 +1090,7 @@ namespace cppcanvas
 }
 }
 
-void ImplRenderer::processObjectRecord(SvMemoryStream rObjectStream, 
sal_uInt16 flags, sal_Bool bUseWholeStream)
+void ImplRenderer::processObjectRecord(SvMemoryStream rObjectStream, 
sal_uInt16 flags, sal_uInt32 dataSize, sal_Bool bUseWholeStream)
 {
 sal_uInt32 index;
 
@@ -1145,7 +1145,7 @@ namespace cppcanvas
 {
 EMFPImage *image;
 aObjects [index] = image = new EMFPImage ();
-image-Read (rObjectStream, bUseWholeStream);
+image-Read (rObjectStream, dataSize, bUseWholeStream);
 
 break;
 }
@@ -1211,12 +1211,13 @@ namespace cppcanvas
 if (mbMultipart) {
 EMFP_DEBUG (printf (EMF+ multipart record flags: 
%04hx\n, mMFlags));
 mMStream.Seek (0);
-processObjectRecord (mMStream, mMFlags, sal_True);
+processObjectRecord (mMStream, mMFlags, dataSize, 
sal_True);
 }
 mbMultipart = false;
 }
 
 if (type != EmfPlusRecordTypeObject || !(flags  0x8000))
+{
 switch (type) {
 case EmfPlusRecordTypeHeader:
 sal_uInt32 header, version;
@@ -1235,7 +1236,7 @@ namespace cppcanvas
 EMFP_DEBUG (printf (EMF+\talready used in svtools wmf/emf 
filter parser\n));
 break;
 case EmfPlusRecordTypeObject:
-processObjectRecord (rMF, flags);
+processObjectRecord (rMF, flags, dataSize);
 break;
 case EmfPlusRecordTypeFillPie:
 {
@@ -1476,6 +1477,9 @@ namespace cppcanvas
 ReadPoint (rMF, x2, y2, flags);
 ReadPoint (rMF, x3, y3, flags);
 
+

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

2013-02-25 Thread Michael Stahl
 cppcanvas/source/mtfrenderer/emfplus.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6cf68eab5eb77b7e081ef5f8d59d196411e86567
Author: Michael Stahl mst...@redhat.com
Date:   Mon Feb 25 13:15:19 2013 +0100

fdo#59405: cppcanvas: fix infinite loop in processEMFPlus

This can be observed when inserting the bugdoc from fdo#59405.
Apparently the size and length do not agree; ensure that the
length does not underflow.

Change-Id: Idfc68919859b8284c724831de21208e4392af328
(cherry picked from commit ec0d1440cf07008a220708535848567bcbb233ea)
Reviewed-on: https://gerrit.libreoffice.org/2394
Reviewed-by: Radek Doulík r...@novell.com
Tested-by: Radek Doulík r...@novell.com

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx 
b/cppcanvas/source/mtfrenderer/emfplus.cxx
index f1b0eff..0c9db41 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1763,7 +1763,16 @@ namespace cppcanvas
 
 rMF.Seek (next);
 
-length -= size;
+if (size = length)
+{
+length -= size;
+}
+else
+{
+SAL_WARN(cppcanvas, ImplRenderer::processEMFPlus: 
+size   sizelength   length);
+length = 0;
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits