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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 27 16:31:37 UTC 2020


 vcl/source/app/settings.cxx         |    3 ++-
 vcl/source/gdi/WidgetDefinition.cxx |    2 +-
 vcl/source/gdi/region.cxx           |   28 ++++++++++++++--------------
 3 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit c275184ae37d145f428a459a07917e127bd67577
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Apr 27 11:01:47 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 27 18:30:58 2020 +0200

    loplugin:makeshared in vcl
    
    Change-Id: I990fafa8b01e94aef58d6cad30bc13de539ea496
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92968
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index f54f05814258..8db54992b80f 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -596,7 +596,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
     mnUseFlatBorders(rData.mnUseFlatBorders),
     mbPreferredUseImagesInMenus(rData.mbPreferredUseImagesInMenus),
     mnMinThumbSize(rData.mnMinThumbSize),
-    mIconThemeScanner(rData.mIconThemeScanner?new vcl::IconThemeScanner(*rData.mIconThemeScanner):nullptr),
     mIconThemeSelector(std::make_shared<vcl::IconThemeSelector>(*rData.mIconThemeSelector)),
     mIconTheme(rData.mIconTheme),
     mbSkipDisabledInMenus(rData.mbSkipDisabledInMenus),
@@ -618,6 +617,8 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
     maPersonaFooterBitmap( rData.maPersonaFooterBitmap ),
     maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor )
 {
+    if (rData.mIconThemeScanner)
+        mIconThemeScanner = std::make_shared<vcl::IconThemeScanner>(*rData.mIconThemeScanner);
 }
 
 void ImplStyleData::SetStandardStyles()
diff --git a/vcl/source/gdi/WidgetDefinition.cxx b/vcl/source/gdi/WidgetDefinition.cxx
index 3db9214c45ce..3c93f1ac5601 100644
--- a/vcl/source/gdi/WidgetDefinition.cxx
+++ b/vcl/source/gdi/WidgetDefinition.cxx
@@ -176,7 +176,7 @@ void WidgetDefinitionState::addDrawImage(OUString const& sSource)
 
 void WidgetDefinitionState::addDrawExternal(OUString const& sSource)
 {
-    auto pCommand(std::make_unique<WidgetDrawActionExternal>());
+    auto pCommand(std::make_shared<WidgetDrawActionExternal>());
     pCommand->msSource = sSource;
     mpWidgetDrawActions.push_back(std::move(pCommand));
 }
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 42fc0c0b1c4a..460a30d5203a 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -84,12 +84,12 @@ namespace
             A new RegionBand object is returned that contains the bands that
             represent the given poly-polygon.
     */
-    std::unique_ptr<RegionBand> ImplRectilinearPolygonToBands(const tools::PolyPolygon& rPolyPoly)
+    std::shared_ptr<RegionBand> ImplRectilinearPolygonToBands(const tools::PolyPolygon& rPolyPoly)
     {
         OSL_ASSERT(ImplIsPolygonRectilinear (rPolyPoly));
 
         // Create a new RegionBand object as container of the bands.
-        std::unique_ptr<RegionBand> pRegionBand( std::make_unique<RegionBand>() );
+        std::shared_ptr<RegionBand> pRegionBand( std::make_shared<RegionBand>() );
         long nLineId = 0;
 
         // Iterate over all polygons.
@@ -182,12 +182,12 @@ namespace
     /** Convert a general polygon (one for which ImplIsPolygonRectilinear()
         returns <FALSE/>) to bands.
     */
-    std::unique_ptr<RegionBand> ImplGeneralPolygonToBands(const tools::PolyPolygon& rPolyPoly, const tools::Rectangle& rPolygonBoundingBox)
+    std::shared_ptr<RegionBand> ImplGeneralPolygonToBands(const tools::PolyPolygon& rPolyPoly, const tools::Rectangle& rPolygonBoundingBox)
     {
         long nLineID = 0;
 
         // initialisation and creation of Bands
-        std::unique_ptr<RegionBand> pRegionBand( std::make_unique<RegionBand>() );
+        std::shared_ptr<RegionBand> pRegionBand( std::make_shared<RegionBand>() );
         pRegionBand->CreateBandRange(rPolygonBoundingBox.Top(), rPolygonBoundingBox.Bottom());
 
         // insert polygons
@@ -231,9 +231,9 @@ bool vcl::Region::IsEmpty() const
 }
 
 
-static std::unique_ptr<RegionBand> ImplCreateRegionBandFromPolyPolygon(const tools::PolyPolygon& rPolyPolygon)
+static std::shared_ptr<RegionBand> ImplCreateRegionBandFromPolyPolygon(const tools::PolyPolygon& rPolyPolygon)
 {
-    std::unique_ptr<RegionBand> pRetval;
+    std::shared_ptr<RegionBand> pRetval;
 
     if(rPolyPolygon.Count())
     {
@@ -558,7 +558,7 @@ void vcl::Region::Union( const tools::Rectangle& rRect )
         return;
     }
 
-    std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+    std::shared_ptr<RegionBand> pNew = std::make_shared<RegionBand>(*pCurrent);
 
     // get justified rectangle
     const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -649,7 +649,7 @@ void vcl::Region::Intersect( const tools::Rectangle& rRect )
         return;
     }
 
-    std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+    std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
 
     // get justified rectangle
     const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -728,7 +728,7 @@ void vcl::Region::Exclude( const tools::Rectangle& rRect )
         return;
     }
 
-    std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+    std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
 
     // get justified rectangle
     const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -811,7 +811,7 @@ void vcl::Region::XOr( const tools::Rectangle& rRect )
     }
 
     // only region band mode possibility left here or null/empty
-    std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*getRegionBand()));
+    std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*getRegionBand()));
 
     // get justified rectangle
     const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -906,7 +906,7 @@ void vcl::Region::Union( const vcl::Region& rRegion )
     }
 
     // prepare source and target
-    std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+    std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
 
     // union with source
     pNew->Union(*pSource);
@@ -1024,7 +1024,7 @@ void vcl::Region::Intersect( const vcl::Region& rRegion )
     else
     {
         // prepare new regionBand
-        std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+        std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
 
         // intersect with source
         pNew->Intersect(*pSource);
@@ -1108,7 +1108,7 @@ void vcl::Region::Exclude( const vcl::Region& rRegion )
     }
 
     // prepare source and target
-    std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+    std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
 
     // union with source
     const bool bSuccess(pNew->Exclude(*pSource));
@@ -1195,7 +1195,7 @@ bool vcl::Region::XOr( const vcl::Region& rRegion )
     }
 
     // prepare source and target
-    std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+    std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
 
     // union with source
     pNew->XOr(*pSource);


More information about the Libreoffice-commits mailing list