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

Jochen Nitschke j.nitschke+logerrit at ok.de
Sat Jun 30 21:08:01 UTC 2018


 vcl/opengl/RenderList.cxx  |    6 +++---
 vcl/source/gdi/animate.cxx |   11 +++--------
 2 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit efd08467b41365dff4a270393efb588de765eaef
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sat Jun 30 20:37:47 2018 +0200

    cppcheck: variableScope
    
    and use unique_ptr for vector elements
    
    Change-Id: I5421a53e96928699fd451d4ff3e2eef0bf847f42
    Reviewed-on: https://gerrit.libreoffice.org/56772
    Tested-by: Jenkins
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 71028e5b41c5..6896b1736a48 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -326,7 +326,6 @@ void Animation::ImplRestartTimer( sal_uLong nTimeout )
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
 {
     const size_t nAnimCount = maList.size();
-    std::vector< AInfo* > aAInfoList;
 
     if( nAnimCount )
     {
@@ -335,14 +334,15 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
 
         if( maNotifyLink.IsSet() )
         {
+            std::vector< std::unique_ptr<AInfo> > aAInfoList;
             // create AInfo-List
             for(auto const & i : maViewList)
-                aAInfoList.push_back( i->createAInfo() );
+                aAInfoList.emplace_back( i->createAInfo() );
 
             maNotifyLink.Call( this );
 
             // set view state from AInfo structure
-            for(AInfo* pAInfo : aAInfoList)
+            for(auto& pAInfo : aAInfoList)
             {
                 if( !pAInfo->pViewData )
                 {
@@ -358,11 +358,6 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
                 pView->setMarked( true );
             }
 
-            // delete AInfo structures
-            for(AInfo* i : aAInfoList)
-                delete i;
-            aAInfoList.clear();
-
             // delete all unmarked views and reset marked state
             for( size_t i = 0; i < maViewList.size(); )
             {
commit a272704cb04fee27a5934433fe59a006b2ddaf0e
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sat Jun 30 20:38:05 2018 +0200

    cppcheck: variableScope
    
    Change-Id: Icd99a9e6791840f7701745b93a0f414bf61e2955
    Reviewed-on: https://gerrit.libreoffice.org/56773
    Tested-by: Jenkins
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/vcl/opengl/RenderList.cxx b/vcl/opengl/RenderList.cxx
index 927de11525b9..903c492c0d35 100644
--- a/vcl/opengl/RenderList.cxx
+++ b/vcl/opengl/RenderList.cxx
@@ -284,9 +284,6 @@ void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon,
 
     checkOverlapping(rPolyPolygon.getB2DRange());
 
-    RenderParameters& rLineRenderParameter = maRenderEntries.back().maLineParameters;
-    RenderParameters& rTriangleRenderParameter = maRenderEntries.back().maTriangleParameters;
-
     if (nFillColor != SALCOLOR_NONE)
     {
         basegfx::B2DTrapezoidVector aTrapezoidVector;
@@ -294,6 +291,8 @@ void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon,
 
         if (!aTrapezoidVector.empty())
         {
+            RenderParameters& rTriangleRenderParameter = maRenderEntries.back().maTriangleParameters;
+
             for (basegfx::B2DTrapezoid & rTrapezoid : aTrapezoidVector)
             {
                 GLfloat topX1 = rTrapezoid.getTopXLeft();
@@ -314,6 +313,7 @@ void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon,
 
     if (nLineColor != SALCOLOR_NONE || bUseAA)
     {
+        RenderParameters& rLineRenderParameter = maRenderEntries.back().maLineParameters;
         Color nColor = (nLineColor == SALCOLOR_NONE) ? nFillColor : nLineColor;
 
         vcl::LineBuilder aBuilder(rLineRenderParameter.maVertices, rLineRenderParameter.maIndices,


More information about the Libreoffice-commits mailing list