[Libreoffice-commits] core.git: include/vcl vcl/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 25 11:35:13 UTC 2020


 include/vcl/outdev.hxx         |   10 +++++++
 vcl/source/outdev/polyline.cxx |   54 ++++++++++++++++++++++++++++-------------
 2 files changed, 47 insertions(+), 17 deletions(-)

New commits:
commit 32020eb33ba9501510acb449bc84cfaa85bc0bd0
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Sep 24 19:43:58 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Sep 25 13:34:34 2020 +0200

    don't write metafile action twice in DrawPolyLineDirect()
    
    All other functions calling it already do so, so write it only when
    called from the outside.
    
    Change-Id: If17d973a5d6b3797db46e91a1ec36606a89c5d07
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103353
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index d3a1668c81bc..14b03507dfe3 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -826,6 +826,16 @@ private:
 
     ///@}
 
+    bool                        DrawPolyLineDirectInternal(
+                                    const basegfx::B2DHomMatrix& rObjectTransform,
+                                    const basegfx::B2DPolygon& rB2DPolygon,
+                                    double fLineWidth = 0.0,
+                                    double fTransparency = 0.0,
+                                    const std::vector< double >* = nullptr, // MM01
+                                    basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::NONE,
+                                    css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
+                                    double fMiterMinimumAngle = basegfx::deg2rad(15.0),
+                                    bool bBypassAACheck = false);
 
     /** @name Polygon functions
      */
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index 672854a9ed55..2a405e5eaf5a 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -56,7 +56,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly )
         InitLineColor();
 
     // use b2dpolygon drawing if possible
-    if(DrawPolyLineDirect(
+    if(DrawPolyLineDirectInternal(
         basegfx::B2DHomMatrix(),
         rPoly.getB2DPolygon()))
     {
@@ -171,7 +171,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
         InitLineColor();
 
     // use b2dpolygon drawing if possible
-    if(DrawPolyLineDirect(
+    if(DrawPolyLineDirectInternal(
         basegfx::B2DHomMatrix(),
         rB2DPolygon,
         fLineWidth,
@@ -228,7 +228,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
         // to avoid optical gaps
         for(auto const& rPolygon : aAreaPolyPolygon)
         {
-            (void)DrawPolyLineDirect(
+            (void)DrawPolyLineDirectInternal(
                 basegfx::B2DHomMatrix(),
                 rPolygon,
                 0.0,
@@ -310,6 +310,40 @@ bool OutputDevice::DrawPolyLineDirect(
     css::drawing::LineCap eLineCap,
     double fMiterMinimumAngle,
     bool bBypassAACheck)
+{
+    if(DrawPolyLineDirectInternal(rObjectTransform, rB2DPolygon, fLineWidth, fTransparency,
+        pStroke, eLineJoin, eLineCap, fMiterMinimumAngle, bBypassAACheck))
+    {
+        // Worked, add metafile action (if recorded). This is done only here,
+        // because this function is public, other OutDev functions already add metafile
+        // actions, so they call the internal function directly.
+        if( mpMetaFile )
+        {
+            LineInfo aLineInfo;
+            if( fLineWidth != 0.0 )
+                aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
+            // Transport known information, might be needed
+            aLineInfo.SetLineJoin(eLineJoin);
+            aLineInfo.SetLineCap(eLineCap);
+            // MiterMinimumAngle does not exist yet in LineInfo
+            const tools::Polygon aToolsPolygon( rB2DPolygon );
+            mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) );
+        }
+        return true;
+    }
+    return false;
+}
+
+bool OutputDevice::DrawPolyLineDirectInternal(
+    const basegfx::B2DHomMatrix& rObjectTransform,
+    const basegfx::B2DPolygon& rB2DPolygon,
+    double fLineWidth,
+    double fTransparency,
+    const std::vector< double >* pStroke, // MM01
+    basegfx::B2DLineJoin eLineJoin,
+    css::drawing::LineCap eLineCap,
+    double fMiterMinimumAngle,
+    bool bBypassAACheck)
 {
     assert(!is_double_buffered_window());
 
@@ -358,20 +392,6 @@ bool OutputDevice::DrawPolyLineDirect(
 
         if( bDrawSuccess )
         {
-            // worked, add metafile action (if recorded) and return true
-            if( mpMetaFile )
-            {
-                LineInfo aLineInfo;
-                if( fLineWidth != 0.0 )
-                    aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
-                // Transport known information, might be needed
-                aLineInfo.SetLineJoin(eLineJoin);
-                aLineInfo.SetLineCap(eLineCap);
-                // MiterMinimumAngle does not exist yet in LineInfo
-                const tools::Polygon aToolsPolygon( rB2DPolygon );
-                mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) );
-            }
-
             if (mpAlphaVDev)
                 mpAlphaVDev->DrawPolyLineDirect(rObjectTransform, rB2DPolygon, fLineWidth,
                                                 fTransparency, pStroke, eLineJoin, eLineCap,


More information about the Libreoffice-commits mailing list