[Libreoffice-commits] core.git: vcl/headless vcl/inc

Julien Nabet serval2412 at yahoo.fr
Thu Nov 23 06:06:15 UTC 2017


 vcl/headless/svpframe.cxx     |    7 +++----
 vcl/headless/svpvd.cxx        |    7 +++----
 vcl/inc/headless/svpframe.hxx |    3 ++-
 vcl/inc/headless/svpvd.hxx    |    4 ++--
 4 files changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 4ccddab6ef74cb07c2998eaf420785eeceda5a8d
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Nov 22 20:39:13 2017 +0100

    Replace some lists by vectors in vcl/headless
    
    +use for range loops when loops included "std::list"
    
    Change-Id: Ic261571ef64b1a710233ff949c4feeb3cc4756cd
    Reviewed-on: https://gerrit.libreoffice.org/45109
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 12fbf88ba63b..711806226c49 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -156,7 +156,7 @@ SalGraphics* SvpSalFrame::AcquireGraphics()
 void SvpSalFrame::ReleaseGraphics( SalGraphics* pGraphics )
 {
     SvpSalGraphics* pSvpGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics);
-    m_aGraphics.remove( pSvpGraphics );
+    m_aGraphics.erase(std::remove(m_aGraphics.begin(), m_aGraphics.end(), pSvpGraphics), m_aGraphics.end());
     delete pSvpGraphics;
 }
 
@@ -275,10 +275,9 @@ void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u
                                                 aFrameSize.getY());
 
         // update device in existing graphics
-        for( std::list< SvpSalGraphics* >::iterator it = m_aGraphics.begin();
-             it != m_aGraphics.end(); ++it )
+        for (auto const& graphic : m_aGraphics)
         {
-             (*it)->setSurface(m_pSurface, aFrameSize);
+             graphic->setSurface(m_pSurface, aFrameSize);
         }
     }
     if( m_bVisible )
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index 660185da1d41..cf78ebc8eb7d 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -45,7 +45,7 @@ SalGraphics* SvpSalVirtualDevice::AcquireGraphics()
 
 void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics )
 {
-    m_aGraphics.remove( dynamic_cast<SvpSalGraphics*>(pGraphics) );
+    m_aGraphics.erase(std::remove(m_aGraphics.begin(), m_aGraphics.end(), dynamic_cast<SvpSalGraphics*>(pGraphics)), m_aGraphics.end());
     delete pGraphics;
 }
 
@@ -96,9 +96,8 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY,
 #endif
 
         // update device in existing graphics
-        for( std::list< SvpSalGraphics* >::iterator it = m_aGraphics.begin();
-             it != m_aGraphics.end(); ++it )
-            (*it)->setSurface(m_pSurface, m_aFrameSize);
+        for (auto const& graphic : m_aGraphics)
+            graphic->setSurface(m_pSurface, m_aFrameSize);
     }
     return true;
 }
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index eed5efec0c66..16de568794f8 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -26,6 +26,7 @@
 #include <salframe.hxx>
 
 #include <list>
+#include <vector>
 
 #ifdef IOS
 #define SvpSalInstance AquaSalInstance
@@ -52,7 +53,7 @@ class VCL_DLLPUBLIC SvpSalFrame : public SalFrame
 
     SystemEnvData                       m_aSystemChildData;
 
-    std::list< SvpSalGraphics* >        m_aGraphics;
+    std::vector< SvpSalGraphics* >      m_aGraphics;
 
     static SvpSalFrame*       s_pFocusFrame;
 public:
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index 7ac156305abd..704488cdfae0 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -22,7 +22,7 @@
 
 #include <salvd.hxx>
 
-#include <list>
+#include <vector>
 
 class SvpSalGraphics;
 typedef struct _cairo_surface cairo_surface_t;
@@ -33,7 +33,7 @@ class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice
     cairo_surface_t*                    m_pSurface;
     basegfx::B2IVector                  m_aFrameSize;
     double                              m_fScale;
-    std::list< SvpSalGraphics* >        m_aGraphics;
+    std::vector< SvpSalGraphics* >      m_aGraphics;
 
 public:
     SvpSalVirtualDevice(DeviceFormat eFormat, double fScale)


More information about the Libreoffice-commits mailing list