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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 22 12:45:48 UTC 2021


 filter/source/msfilter/msdffimp.cxx  |    4 ++--
 include/filter/msfilter/msdffimp.hxx |    7 +++----
 sw/source/filter/ww8/ww8par.cxx      |    2 +-
 vcl/source/gdi/svmconverter.cxx      |    6 +++---
 4 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 54f6de1b07c7dc167f5013e70f49541ec505931f
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Aug 21 17:17:39 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 22 14:45:21 2021 +0200

    no need to use unique_ptr for LineInfo
    
    it is already a COW type
    
    Change-Id: I32866e6741748be587cdb8af83143bc70e82318e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120820
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 2ef2e35522d0..8981ceb56fdc 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -303,7 +303,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
     }
 
     LineInfo            aLineInfo( LineStyle::NONE, 0 );
-    std::stack<std::unique_ptr<LineInfo>> aLIStack;
+    std::stack<LineInfo, std::vector<LineInfo>> aLIStack;
     ScopedVclPtrInstance< VirtualDevice > aFontVDev;
     rtl_TextEncoding    eActualCharSet = osl_getThreadTextEncoding();
     bool                bFatLine = false;
@@ -1003,7 +1003,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
 
             case GDI_PUSH_ACTION:
             {
-                aLIStack.push(std::make_unique<LineInfo>(aLineInfo));
+                aLIStack.push(aLineInfo);
                 rMtf.AddAction( new MetaPushAction( PushFlags::ALL ) );
 
                 // #106172# Track font relevant data in shadow VDev
@@ -1014,7 +1014,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
             case GDI_POP_ACTION:
             {
 
-                std::unique_ptr<LineInfo> xLineInfo;
+                std::optional<LineInfo> xLineInfo;
                 if (!aLIStack.empty())
                 {
                     xLineInfo = std::move(aLIStack.top());
commit d9f2486bee13cc1710ef66bf5e64e30f2f702772
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Aug 21 18:26:22 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 22 14:45:06 2021 +0200

    no need to use unique_ptr for Polygon
    
    it is already a COW type
    
    Change-Id: I74ffb129aa63cd9c56794997d72e32002f8b45fa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120822
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index e24b342f6f3e..dade5bcd999e 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5525,7 +5525,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
             bool bOk = nElemSizeVert && (rSt.remainingSize() / nElemSizeVert >= nNumElemVert);
             if (bOk)
             {
-                pTextImpRec->pWrapPolygon.reset(new tools::Polygon(nNumElemVert));
+                pTextImpRec->pWrapPolygon = tools::Polygon(nNumElemVert);
                 for (sal_uInt16 i = 0; i < nNumElemVert; ++i)
                 {
                     sal_Int32 nX(0), nY(0);
@@ -7501,7 +7501,7 @@ SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
         pClientDataBuffer = nullptr;
 
     if (rCopy.pWrapPolygon)
-        pWrapPolygon.reset( new tools::Polygon(*rCopy.pWrapPolygon) );
+        pWrapPolygon = rCopy.pWrapPolygon;
 }
 
 SvxMSDffImportRec::~SvxMSDffImportRec()
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index d3c6657c7b90..e1437faf6c90 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -23,6 +23,7 @@
 #include <cstring>
 #include <map>
 #include <memory>
+#include <optional>
 #include <set>
 #include <utility>
 #include <vector>
@@ -44,6 +45,7 @@
 #include <tools/gen.hxx>
 #include <tools/ref.hxx>
 #include <tools/solar.h>
+#include <tools/poly.hxx>
 #include <vcl/graph.hxx>
 
 class Color;
@@ -52,9 +54,6 @@ class SotStorage;
 class SvStream;
 class SdrObject;
 class SdrOle2Obj;
-namespace tools {
-    class Polygon;
-}
 class SdrModel;
 class SwFlyFrameFormat;
 
@@ -218,7 +217,7 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
     static const int RELTO_DEFAULT = 2;
 
     SdrObject*      pObj;
-    std::unique_ptr<tools::Polygon>
+    std::optional<tools::Polygon>
                     pWrapPolygon;
     std::unique_ptr<char[]>
                     pClientAnchorBuffer;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index a6559a681a8c..146de94a0230 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1031,7 +1031,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
             }
             if (bOk)
             {
-                pImpRec->pWrapPolygon.reset( new tools::Polygon(nNumElemVert) );
+                pImpRec->pWrapPolygon = tools::Polygon(nNumElemVert);
                 for (sal_uInt16 i = 0; i < nNumElemVert; ++i)
                 {
                     sal_Int32 nX(0), nY(0);


More information about the Libreoffice-commits mailing list