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

Matúš Kukan matus.kukan at collabora.com
Fri Dec 6 07:15:38 PST 2013


 cppcanvas/source/inc/implrenderer.hxx    |    2 +-
 cppcanvas/source/mtfrenderer/emfplus.cxx |   23 ++++++++++++++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 1f294a9ed2ced2e750befb8e98c4f1e9f7c1235e
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Fri Dec 6 14:40:50 2013 +0100

    EMF+: Fill line cap object if EmfPlusCustomLineCapDataFillPath is set.
    
    Change-Id: I7b53a8f18e1fb24b1ae0322bdf0980e431a0725f
    (cherry picked from commit 131f3230d98f24faf57d9404e333cb1fb183345b)

diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 3d0c48d..d09ed1c 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -284,7 +284,7 @@ static float GetSwapFloat( SvStream& rSt )
             /// Render LineCap, like the start or end arrow of a polygon.
             /// @return how much we should shorten the original polygon.
             double EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon& rPolygon, double fPolyLength,
-                    const ::basegfx::B2DPolyPolygon& rLineCap, bool bStart,
+                    const ::basegfx::B2DPolyPolygon& rLineCap, bool isFilled, bool bStart,
                     const com::sun::star::rendering::StrokeAttributes& rAttributes,
                     const ActionFactoryParameters& rParms, OutDevState& rState);
 
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index bbf4174..4a9d938 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -626,6 +626,7 @@ namespace cppcanvas
             sal_uInt32 strokeStartCap, strokeEndCap, strokeJoin;
             float miterLimit;
             basegfx::B2DPolyPolygon polygon;
+            bool mbIsFilled;
 
         public:
             EMFPCustomLineCap() : EMFPObject()
@@ -652,7 +653,7 @@ namespace cppcanvas
                 aAttributes.MiterLimit = miterLimit;
             }
 
-            void ReadPath(SvStream& s, ImplRenderer& rR, bool bClosed)
+            void ReadPath(SvStream& s, ImplRenderer& rR, bool bFill)
             {
                 sal_Int32 pathLength;
                 s >> pathLength;
@@ -669,7 +670,7 @@ namespace cppcanvas
                 path.Read(s, pathFlags, rR);
 
                 polygon = path.GetPolygon(rR, false);
-                polygon.setClosed(bClosed);
+                mbIsFilled = bFill;
 
                 // transformation to convert the path to what LibreOffice
                 // expects
@@ -1320,7 +1321,7 @@ namespace cppcanvas
         }
 
         double ImplRenderer::EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon& rPolygon, double fPolyLength,
-                const ::basegfx::B2DPolyPolygon& rLineCap, bool bStart, const rendering::StrokeAttributes& rAttributes,
+                const ::basegfx::B2DPolyPolygon& rLineCap, bool bIsFilled, bool bStart, const rendering::StrokeAttributes& rAttributes,
                 const ActionFactoryParameters& rParms, OutDevState& rState)
         {
             if (!rLineCap.count())
@@ -1349,6 +1350,20 @@ namespace cppcanvas
                 rParms.mrCurrActionIndex += pAction->getActionCount()-1;
             }
 
+            if (bIsFilled)
+            {
+                bool bWasFillColorSet = rState.isFillColorSet;
+                rState.isFillColorSet = true;
+                rState.fillColor = rState.lineColor;
+                ActionSharedPtr pAction2(internal::PolyPolyActionFactory::createPolyPolyAction(aArrow, rParms.mrCanvas, rState));
+                if (pAction2)
+                {
+                    maActions.push_back(MtfAction(pAction2, rParms.mrCurrActionIndex));
+                    rParms.mrCurrActionIndex += pAction2->getActionCount()-1;
+                }
+                rState.isFillColorSet = bWasFillColorSet;
+            }
+
             return rAttributes.StrokeWidth;
         }
 
@@ -1403,6 +1418,7 @@ namespace cppcanvas
                                 pen->customStartCap->SetAttributes(aAttributes);
 
                                 fStart = EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customStartCap->polygon,
+                                        pen->customStartCap->mbIsFilled,
                                         true, aAttributes, rParms, rState);
                             }
 
@@ -1413,6 +1429,7 @@ namespace cppcanvas
                                 pen->customEndCap->SetAttributes(aAttributes);
 
                                 fEnd = EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customEndCap->polygon,
+                                        pen->customEndCap->mbIsFilled,
                                         false, aAttributes, rParms, rState);
                             }
 


More information about the Libreoffice-commits mailing list