[Libreoffice-commits] core.git: drawinglayer/inc drawinglayer/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Thu Aug 17 01:29:15 UTC 2017


 drawinglayer/inc/emfplushelper.hxx           |    1 
 drawinglayer/source/tools/emfphelperdata.cxx |  103 +++++++++++++--------------
 drawinglayer/source/tools/emfphelperdata.hxx |    4 -
 drawinglayer/source/tools/emfppen.hxx        |    1 
 4 files changed, 54 insertions(+), 55 deletions(-)

New commits:
commit 791f93e01a847f475cd3f1ad5bf947ee1a45314e
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Wed Aug 16 21:41:53 2017 +0200

    Fixup source layout in emf+ parser
    
    Non-functional change, cleaning up dog's breakfast in the
    grandfathered binary parser.
    
    Change-Id: If3592959b1580e869413910460ccf5b6c9f6f25d
    Reviewed-on: https://gerrit.libreoffice.org/41230
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/drawinglayer/inc/emfplushelper.hxx b/drawinglayer/inc/emfplushelper.hxx
index 03fbeb43f71e..060bd04dc054 100644
--- a/drawinglayer/inc/emfplushelper.hxx
+++ b/drawinglayer/inc/emfplushelper.hxx
@@ -25,7 +25,6 @@
 #include <memory>
 #include <wmfemfhelper.hxx>
 
- /// predefines
 namespace emfplushelper { struct EmfPlusHelperData; }
 namespace wmfemfhelper { class TargetHolders; }
 namespace drawinglayer { namespace geometry { class ViewInformation2D; }}
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 17f27f33180f..3aaf19b60c30 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -343,7 +343,7 @@ namespace emfplushelper
             const EMFPPen* pen = static_cast<EMFPPen*>(maEMFPObjects[brushIndexOrColor & 0xff].get());
             if (pen)
             {
-            color = pen->GetColor().getBColor();
+                color = pen->GetColor().getBColor();
             }
         }
         return color;
@@ -394,22 +394,22 @@ namespace emfplushelper
             basegfx::B2DLineJoin lineJoin = basegfx::B2DLineJoin::Round;
             if (pen->penDataFlags & 0x00000008) // additional line join information
             {
-            lineJoin = static_cast<basegfx::B2DLineJoin>(EMFPPen::lcl_convertLineJoinType(pen->lineJoin));
+                lineJoin = static_cast<basegfx::B2DLineJoin>(EMFPPen::lcl_convertLineJoinType(pen->lineJoin));
             }
 
             // we need a line cap attribute
             css::drawing::LineCap lineCap = css::drawing::LineCap_BUTT;
             if (pen->penDataFlags & 0x00000002) // additional line cap information
             {
-            lineCap = static_cast<css::drawing::LineCap>(EMFPPen::lcl_convertStrokeCap(pen->startCap));
-            SAL_WARN_IF(pen->startCap != pen->endCap, "cppcanvas.emf", "emf+ pen uses different start and end cap");
+                lineCap = static_cast<css::drawing::LineCap>(EMFPPen::lcl_convertStrokeCap(pen->startCap));
+                SAL_WARN_IF(pen->startCap != pen->endCap, "cppcanvas.emf", "emf+ pen uses different start and end cap");
             }
             // transform the pen width
             double adjustedPenWidth = pen->penWidth;
             if (!pen->penWidth) // no width specified, then use default value
             {
                 adjustedPenWidth = pen->penUnit == 0 ? 0.18f   // 0.18f is determined by comparison with MSO  (case of Unit == World)
-                                                        : 0.05f;  // 0.05f is taken from old EMF+ implementation (case of Unit == Pixel etc.)
+                    : 0.05f;  // 0.05f is taken from old EMF+ implementation (case of Unit == Pixel etc.)
             }
 
             // transform and compare to 5 (the value 5 is determined by comparison to MSO)
@@ -445,7 +445,6 @@ namespace emfplushelper
             mrPropertyHolders.Current().setFillColor(::Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff).getBColor());
             mrPropertyHolders.Current().setFillColorActive(true);
             mrPropertyHolders.Current().setLineColorActive(false);
-
         }
         else // use Brush
         {
@@ -498,9 +497,9 @@ namespace emfplushelper
                 // temporal solution: create a solid colored polygon
                 // TODO create a 'real' hatching primitive
                 mrTargetHolders.Current().append(
-                new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
-                    polygon,
-                    fillColor.getBColor()));
+                    new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+                        polygon,
+                        fillColor.getBColor()));
             }
             else if (brush->type == BrushTypeTextureFill)
             {
@@ -532,7 +531,7 @@ namespace emfplushelper
 
                 if (brush->blendPositions)
                 {
-                     SAL_INFO("cppcanvas.emf", "EMF+\t\tuse blend");
+                    SAL_INFO("cppcanvas.emf", "EMF+\t\tuse blend");
 
                     // store the blendpoints in the vector
                     for (int i = 0; i < brush->blendPoints; i++)
@@ -559,7 +558,8 @@ namespace emfplushelper
                     SAL_INFO("cppcanvas.emf", "EMF+\t\tuse color blend");
 
                     // store the colorBlends in the vector
-                    for (int i = 0; i < brush->colorblendPoints; i++) {
+                    for (int i = 0; i < brush->colorblendPoints; i++)
+                    {
                         double aBlendPoint;
                         basegfx::BColor aColor;
                         if (brush->type == BrushTypeLinearGradient)
@@ -606,14 +606,14 @@ namespace emfplushelper
 
                     // create the same one used for SVG
                     mrTargetHolders.Current().append(
-                         new drawinglayer::primitive2d::SvgLinearGradientPrimitive2D(
-                             aTextureTransformation,
-                             polygon,
-                             aVector,
-                             aStartPoint,
-                             aEndPoint,
-                             false,                  // do not use UnitCoordinates
-                             drawinglayer::primitive2d::SpreadMethod::Pad));
+                        new drawinglayer::primitive2d::SvgLinearGradientPrimitive2D(
+                            aTextureTransformation,
+                            polygon,
+                            aVector,
+                            aStartPoint,
+                            aEndPoint,
+                            false,                  // do not use UnitCoordinates
+                            drawinglayer::primitive2d::SpreadMethod::Pad));
                 }
                 else // BrushTypePathGradient
                 {
@@ -622,15 +622,15 @@ namespace emfplushelper
 
                     // create the same one used for SVG
                     mrTargetHolders.Current().append(
-                         new drawinglayer::primitive2d::SvgRadialGradientPrimitive2D(
-                             aTextureTransformation,
-                             polygon,
-                             aVector,
-                             aCenterPoint,
-                             0.5,                   // relative radius
-                             true,                  // use UnitCoordinates to stretch the gradient
-                             drawinglayer::primitive2d::SpreadMethod::Repeat,
-                             nullptr));
+                        new drawinglayer::primitive2d::SvgRadialGradientPrimitive2D(
+                            aTextureTransformation,
+                            polygon,
+                            aVector,
+                            aCenterPoint,
+                            0.5,                   // relative radius
+                            true,                  // use UnitCoordinates to stretch the gradient
+                            drawinglayer::primitive2d::SpreadMethod::Repeat,
+                            nullptr));
                 }
             }
         }
@@ -1154,7 +1154,7 @@ namespace emfplushelper
                             EMFPFont *font = static_cast< EMFPFont* >( maEMFPObjects[flags & 0xff].get() );
                             if (!stringFormat || !font)
                             {
-                              break;
+                                break;
                             }
                             mrPropertyHolders.Current().setFont(vcl::Font(font->family , Size(font->emSize,font->emSize)));
                             // done reading
@@ -1184,15 +1184,15 @@ namespace emfplushelper
                             basegfx::BColor color;
                             if (flags & 0x8000) // we use a color
                             {
-                              color = Color(0xff - (brushId >> 24), (brushId >> 16) & 0xff, (brushId >> 8) & 0xff, brushId & 0xff).getBColor();
+                                color = Color(0xff - (brushId >> 24), (brushId >> 16) & 0xff, (brushId >> 8) & 0xff, brushId & 0xff).getBColor();
                             }
                             else // we use a pen
                             {
-                              const EMFPPen* pen = static_cast<EMFPPen*>(maEMFPObjects[brushId & 0xff].get());
-                              if (pen)
-                              {
-                                color = pen->GetColor().getBColor();
-                              }
+                                const EMFPPen* pen = static_cast<EMFPPen*>(maEMFPObjects[brushId & 0xff].get());
+                                if (pen)
+                                {
+                                    color = pen->GetColor().getBColor();
+                                }
                             }
                             mrPropertyHolders.Current().setTextColor(color);
                             mrPropertyHolders.Current().setTextColorActive(true);
@@ -1200,14 +1200,14 @@ namespace emfplushelper
                             std::vector<double> emptyVector;
                             mrTargetHolders.Current().append(
                                 new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
-                                  transformMatrix,
-                                  text,
-                                  0,             // text always starts at 0
-                                  stringLength,
-                                  emptyVector,   // EMF-PLUS has no DX-array
-                                  fontAttribute,
-                                  locale,
-                                  color));
+                                    transformMatrix,
+                                    text,
+                                    0,             // text always starts at 0
+                                    stringLength,
+                                    emptyVector,   // EMF-PLUS has no DX-array
+                                    fontAttribute,
+                                    locale,
+                                    color));
                         }
                         else
                         {
@@ -1432,11 +1432,11 @@ namespace emfplushelper
                         int combineMode = (flags >> 8) & 0xf;
 
                         SAL_INFO("cppcanvas.emf", "EMF+ SetClipRect combine mode: " << combineMode);
-    #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
                         if (combineMode > 1) {
                             SAL_INFO("cppcanvas.emf", "EMF+ TODO combine mode > 1");
                         }
-    #endif
+#endif
 
                         float dx, dy, dw, dh;
                         ReadRectangle(rMS, dx, dy, dw, dh);
@@ -1446,11 +1446,12 @@ namespace emfplushelper
 
                         ::basegfx::B2DPolyPolygon polyPolygon(
                             ::basegfx::B2DPolygon(
-                                ::basegfx::tools::createPolygonFromRect(::basegfx::B2DRectangle(
-                                    mappedPoint.getX(),
-                                    mappedPoint.getY(),
-                                    mappedPoint.getX() + mappedSize.getX(),
-                                    mappedPoint.getY() + mappedSize.getY()))));
+                                ::basegfx::tools::createPolygonFromRect(
+                                    ::basegfx::B2DRectangle(
+                                        mappedPoint.getX(),
+                                        mappedPoint.getY(),
+                                        mappedPoint.getX() + mappedSize.getX(),
+                                        mappedPoint.getY() + mappedSize.getY()))));
 
                         // use existing tooling from wmfemfhelper
                         HandleNewClipRegion(polyPolygon, mrTargetHolders, mrPropertyHolders);
@@ -1550,7 +1551,7 @@ namespace emfplushelper
                             EMFPFont *font = static_cast< EMFPFont* >( maEMFPObjects[flags & 0xff].get() );
                             if (!font)
                             {
-                              break;
+                                break;
                             }
                             // done reading
 
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index 74e886b7daaa..c36626139b4d 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -218,8 +218,8 @@ namespace emfplushelper
         SvMemoryStream              mMStream;
 
         /* emf+ graphic state stack */
-        GraphicStateMap         mGSStack;
-        GraphicStateMap         mGSContainerStack;
+        GraphicStateMap             mGSStack;
+        GraphicStateMap             mGSContainerStack;
 
         /// data holders
         wmfemfhelper::TargetHolders&    mrTargetHolders;
diff --git a/drawinglayer/source/tools/emfppen.hxx b/drawinglayer/source/tools/emfppen.hxx
index 7b8f67d41d87..754f89dec0c6 100644
--- a/drawinglayer/source/tools/emfppen.hxx
+++ b/drawinglayer/source/tools/emfppen.hxx
@@ -69,7 +69,6 @@ namespace emfplushelper
 
         static sal_Int8 lcl_convertStrokeCap(sal_uInt32 nEmfStroke);
         static sal_Int8 lcl_convertLineJoinType(sal_uInt32 nEmfLineJoin);
-
     };
 }
 


More information about the Libreoffice-commits mailing list