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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 28 10:07:31 UTC 2020


 slideshow/source/engine/transitions/figurewipe.cxx                   |   20 +++++-----
 slideshow/source/engine/transitions/figurewipe.hxx                   |   12 +++---
 slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx |   15 ++-----
 slideshow/source/engine/transitions/slidetransitionfactory.cxx       |   15 +++----
 4 files changed, 27 insertions(+), 35 deletions(-)

New commits:
commit 429ef3e94af588626df17baf96ac1e085d993947
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Apr 28 08:48:00 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Apr 28 12:07:01 2020 +0200

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

diff --git a/slideshow/source/engine/transitions/figurewipe.cxx b/slideshow/source/engine/transitions/figurewipe.cxx
index 1445eeb25139..f64145d5532e 100644
--- a/slideshow/source/engine/transitions/figurewipe.cxx
+++ b/slideshow/source/engine/transitions/figurewipe.cxx
@@ -34,7 +34,7 @@ namespace slideshow::internal {
     return res;
 }
 
-FigureWipe * FigureWipe::createTriangleWipe()
+std::shared_ptr<FigureWipe> FigureWipe::createTriangleWipe()
 {
     const double s60 = sin( basegfx::deg2rad(60.0) );
     const double s30 = sin( basegfx::deg2rad(30.0) );
@@ -43,10 +43,10 @@ FigureWipe * FigureWipe::createTriangleWipe()
     figure.append( ::basegfx::B2DPoint( 0.0, -0.5 - s60 ) );
     figure.append( ::basegfx::B2DPoint( -0.5 - s30, 0.5 ) );
     figure.setClosed(true);
-    return new FigureWipe(figure);
+    return std::make_shared<FigureWipe>(figure);
 }
 
-FigureWipe * FigureWipe::createArrowHeadWipe()
+std::shared_ptr<FigureWipe> FigureWipe::createArrowHeadWipe()
 {
     const double s60 = sin( basegfx::deg2rad(60.0) );
     const double s30 = sin( basegfx::deg2rad(30.0) );
@@ -57,10 +57,10 @@ FigureWipe * FigureWipe::createArrowHeadWipe()
     figure.append( ::basegfx::B2DPoint( -0.5 - s30 - off, 0.5 + off ) );
     figure.append( ::basegfx::B2DPoint( 0.0, 0.5 ) );
     figure.setClosed(true);
-    return new FigureWipe(figure);
+    return std::make_shared<FigureWipe>(figure);
 }
 
-FigureWipe * FigureWipe::createPentagonWipe()
+std::shared_ptr<FigureWipe> FigureWipe::createPentagonWipe()
 {
     const double s = sin( basegfx::deg2rad(18.0) );
     const double c = cos( basegfx::deg2rad(18.0) );
@@ -71,10 +71,10 @@ FigureWipe * FigureWipe::createPentagonWipe()
     figure.append( ::basegfx::B2DPoint( -0.5 - s, 0.5 - c ) );
     figure.append( ::basegfx::B2DPoint( -0.5, 0.5 ) );
     figure.setClosed(true);
-    return new FigureWipe(figure);
+    return std::make_shared<FigureWipe>(figure);
 }
 
-FigureWipe * FigureWipe::createHexagonWipe()
+std::shared_ptr<FigureWipe> FigureWipe::createHexagonWipe()
 {
     const double s = sin( basegfx::deg2rad(30.0) );
     const double c = cos( basegfx::deg2rad(30.0) );
@@ -86,10 +86,10 @@ FigureWipe * FigureWipe::createHexagonWipe()
     figure.append( ::basegfx::B2DPoint( -0.5 - s, 0.0 ) );
     figure.append( ::basegfx::B2DPoint( -0.5, c ) );
     figure.setClosed(true);
-    return new FigureWipe(figure);
+    return std::make_shared<FigureWipe>(figure);
 }
 
-FigureWipe * FigureWipe::createStarWipe( sal_Int32 nPoints )
+std::shared_ptr<FigureWipe> FigureWipe::createStarWipe( sal_Int32 nPoints )
 {
     const double v = M_PI / nPoints;
     const ::basegfx::B2DPoint p_( 0.0, -M_SQRT2 );
@@ -109,7 +109,7 @@ FigureWipe * FigureWipe::createStarWipe( sal_Int32 nPoints )
         figure.append(p);
     }
     figure.setClosed(true);
-    return new FigureWipe(figure);
+    return std::make_shared<FigureWipe>(figure);
 }
 
 }
diff --git a/slideshow/source/engine/transitions/figurewipe.hxx b/slideshow/source/engine/transitions/figurewipe.hxx
index 92f0735cfeaa..f5dc91bde155 100644
--- a/slideshow/source/engine/transitions/figurewipe.hxx
+++ b/slideshow/source/engine/transitions/figurewipe.hxx
@@ -29,15 +29,15 @@ namespace internal {
 class FigureWipe : public ParametricPolyPolygon
 {
 public:
-    static FigureWipe * createTriangleWipe();
-    static FigureWipe * createArrowHeadWipe();
-    static FigureWipe * createStarWipe( sal_Int32 nPoints );
-    static FigureWipe * createPentagonWipe();
-    static FigureWipe * createHexagonWipe();
+    static std::shared_ptr<FigureWipe> createTriangleWipe();
+    static std::shared_ptr<FigureWipe> createArrowHeadWipe();
+    static std::shared_ptr<FigureWipe> createStarWipe( sal_Int32 nPoints );
+    static std::shared_ptr<FigureWipe> createPentagonWipe();
+    static std::shared_ptr<FigureWipe> createHexagonWipe();
 
     virtual ::basegfx::B2DPolyPolygon operator () ( double t ) override;
-private:
     explicit FigureWipe( ::basegfx::B2DPolygon const & figure ) : m_figure(figure) {}
+private:
     const ::basegfx::B2DPolygon m_figure;
 };
 
diff --git a/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx b/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx
index f95d4e3f72fc..773f76aeaeb3 100644
--- a/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx
+++ b/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx
@@ -208,17 +208,13 @@ namespace slideshow::internal
                         nSubType == FANINVERTICAL ||
                         nSubType == FANINHORIZONTAL );
             case TRIANGLEWIPE:
-                return ParametricPolyPolygonSharedPtr(
-                    FigureWipe::createTriangleWipe() );
+                return FigureWipe::createTriangleWipe();
             case ARROWHEADWIPE:
-                return ParametricPolyPolygonSharedPtr(
-                    FigureWipe::createArrowHeadWipe() );
+                return FigureWipe::createArrowHeadWipe();
             case PENTAGONWIPE:
-                return ParametricPolyPolygonSharedPtr(
-                    FigureWipe::createPentagonWipe() );
+                return FigureWipe::createPentagonWipe();
             case HEXAGONWIPE:
-                return ParametricPolyPolygonSharedPtr(
-                    FigureWipe::createHexagonWipe() );
+                return FigureWipe::createHexagonWipe();
             case STARWIPE: {
                 sal_Int32 points;
                 switch (nSubType) {
@@ -232,8 +228,7 @@ namespace slideshow::internal
                     points = 4;
                     break;
                 }
-                return ParametricPolyPolygonSharedPtr(
-                    FigureWipe::createStarWipe(points) );
+                return FigureWipe::createStarWipe(points);
             }
             case MISCDIAGONALWIPE: {
                 switch (nSubType) {
diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
index 6594d310bb40..ec67e434cb7c 100644
--- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx
+++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
@@ -853,8 +853,8 @@ NumberAnimationSharedPtr createPluginTransition(
     const SoundPlayerSharedPtr&              pSoundPlayer,
     EventMultiplexer&                        rEventMultiplexer)
 {
-    std::unique_ptr<PluginSlideChange> pTransition(
-        new PluginSlideChange(
+    auto pTransition =
+        std::make_shared<PluginSlideChange>(
             nTransitionType,
             nTransitionSubType,
             pLeavingSlide,
@@ -863,14 +863,11 @@ NumberAnimationSharedPtr createPluginTransition(
             rScreenUpdater,
             xFactory,
             pSoundPlayer,
-            rEventMultiplexer ));
+            rEventMultiplexer );
 
-    if( pTransition->Success() )
-        return NumberAnimationSharedPtr( pTransition.release() );
-    else
-    {
-        return NumberAnimationSharedPtr();
-    }
+    if( !pTransition->Success() )
+        return nullptr;
+    return pTransition;
 }
 
 } // anon namespace


More information about the Libreoffice-commits mailing list