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

Julien Nabet serval2412 at yahoo.fr
Wed Sep 6 21:43:28 UTC 2017


 svtools/source/graphic/grfcache.cxx |   22 +++++++++++-----------
 svtools/source/graphic/grfcache.hxx |   10 +++++-----
 2 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit df34535d0a835ac8f7cd19e011965a8790e0c7ae
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Sep 6 22:24:13 2017 +0200

    Replace some lists by vectors in svtools
    
    Change-Id: Ibd0bf4a4045fa079827e211b2f5668900c8188ef
    Reviewed-on: https://gerrit.libreoffice.org/42029
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index c5995a141b22..1f99b841cea8 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -863,7 +863,7 @@ void GraphicCache::AddGraphicObject(
           && !maGraphicCache.empty()
         )
         {
-            GraphicCacheEntryList::iterator it = maGraphicCache.begin();
+            GraphicCacheEntryVector::iterator it = maGraphicCache.begin();
             while(  !bInserted
                  && ( it != maGraphicCache.end() )
                  )
@@ -882,7 +882,7 @@ void GraphicCache::AddGraphicObject(
 
         if( !bInserted )
         {
-            GraphicCacheEntryList::iterator it = maGraphicCache.begin();
+            GraphicCacheEntryVector::iterator it = maGraphicCache.begin();
             std::unique_ptr< GraphicID > apID;
 
             if( !pID )
@@ -905,7 +905,7 @@ void GraphicCache::AddGraphicObject(
                         // since pEntry->TryToSwapIn can modify our current list, we have to
                         // iterate from beginning to add a reference to the appropriate
                         // CacheEntry object; after this, quickly jump out of the outer iteration
-                        for( GraphicCacheEntryList::iterator jt = maGraphicCache.begin();
+                        for( GraphicCacheEntryVector::iterator jt = maGraphicCache.begin();
                              !bInserted && jt != maGraphicCache.end();
                              ++jt
                         )
@@ -949,7 +949,7 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj )
 {
     // Release cached object
     bool    bRemoved = false;
-    GraphicCacheEntryList::iterator it = maGraphicCache.begin();
+    GraphicCacheEntryVector::iterator it = maGraphicCache.begin();
     while (!bRemoved && it != maGraphicCache.end())
     {
         bRemoved = (*it)->ReleaseGraphicObjectReference( rObj );
@@ -958,7 +958,7 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj )
         {
             // if graphic cache entry has no more references,
             // the corresponding display cache object can be removed
-            GraphicDisplayCacheEntryList::iterator it2 = maDisplayCache.begin();
+            GraphicDisplayCacheEntryVector::iterator it2 = maDisplayCache.begin();
             while( it2 != maDisplayCache.end() )
             {
                 GraphicDisplayCacheEntry* pDisplayEntry = *it2;
@@ -1029,7 +1029,7 @@ void GraphicCache::SetCacheTimeout( sal_uLong nTimeoutSeconds )
             aReleaseTime.addTime( ::salhelper::TTimeValue( nTimeoutSeconds, 0 ) );
         }
 
-        for( GraphicDisplayCacheEntryList::const_iterator it = maDisplayCache.begin();
+        for( GraphicDisplayCacheEntryVector::const_iterator it = maDisplayCache.begin();
              it != maDisplayCache.end(); ++it )
         {
             (*it)->SetReleaseTime( aReleaseTime );
@@ -1054,7 +1054,7 @@ bool GraphicCache::IsInDisplayCache( OutputDevice const * pOut, const Point& rPt
 
     if( pCacheEntry )
     {
-        for( GraphicDisplayCacheEntryList::const_iterator it = maDisplayCache.begin();
+        for( GraphicDisplayCacheEntryVector::const_iterator it = maDisplayCache.begin();
              !bFound && ( it != maDisplayCache.end() ); ++it )
         {
             if( (*it)->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) )
@@ -1155,7 +1155,7 @@ bool GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt, co
     const Size                  aSzPixel( pOut->LogicToPixel( rSz ) );
     const GraphicCacheEntry*    pCacheEntry = ImplGetCacheEntry( rObj );
     GraphicDisplayCacheEntry*   pDisplayCacheEntry = nullptr;
-    GraphicDisplayCacheEntryList::iterator it = maDisplayCache.begin();
+    GraphicDisplayCacheEntryVector::iterator it = maDisplayCache.begin();
     bool                    bRet = false;
 
     while( !bRet && it != maDisplayCache.end() )
@@ -1194,7 +1194,7 @@ bool GraphicCache::ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree )
 
     if( nSizeToFree )
     {
-        GraphicDisplayCacheEntryList::iterator it = maDisplayCache.begin();
+        GraphicDisplayCacheEntryVector::iterator it = maDisplayCache.begin();
 
         if( nSizeToFree > mnUsedDisplaySize )
             nSizeToFree = mnUsedDisplaySize;
@@ -1221,7 +1221,7 @@ GraphicCacheEntry* GraphicCache::ImplGetCacheEntry( const GraphicObject& rObj )
     GraphicCacheEntry* pRet = nullptr;
 
     for(
-        GraphicCacheEntryList::iterator it = maGraphicCache.begin();
+        GraphicCacheEntryVector::iterator it = maGraphicCache.begin();
         !pRet && it != maGraphicCache.end();
         ++it
     ) {
@@ -1238,7 +1238,7 @@ IMPL_LINK( GraphicCache, ReleaseTimeoutHdl, Timer*, pTimer, void )
     pTimer->Stop();
 
     ::salhelper::TTimeValue           aCurTime;
-    GraphicDisplayCacheEntryList::iterator it = maDisplayCache.begin();
+    GraphicDisplayCacheEntryVector::iterator it = maDisplayCache.begin();
 
     osl_getSystemTime( &aCurTime );
 
diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx
index 48c2624521bd..7287192e4d54 100644
--- a/svtools/source/graphic/grfcache.hxx
+++ b/svtools/source/graphic/grfcache.hxx
@@ -22,7 +22,7 @@
 
 #include <vcl/graph.hxx>
 #include <vcl/timer.hxx>
-#include <list>
+#include <vector>
 
 
 class GraphicAttr;
@@ -33,12 +33,12 @@ class GraphicObject;
 class GraphicCache
 {
 private:
-    typedef std::list< GraphicCacheEntry* > GraphicCacheEntryList;
-    typedef std::list< GraphicDisplayCacheEntry* > GraphicDisplayCacheEntryList;
+    typedef std::vector< GraphicCacheEntry* > GraphicCacheEntryVector;
+    typedef std::vector< GraphicDisplayCacheEntry* > GraphicDisplayCacheEntryVector;
 
     Timer                   maReleaseTimer;
-    GraphicCacheEntryList   maGraphicCache;
-    GraphicDisplayCacheEntryList maDisplayCache;
+    GraphicCacheEntryVector   maGraphicCache;
+    GraphicDisplayCacheEntryVector maDisplayCache;
     sal_uLong               mnReleaseTimeoutSeconds;
     sal_uLong               mnMaxDisplaySize;
     sal_uLong               mnMaxObjDisplaySize;


More information about the Libreoffice-commits mailing list