[Libreoffice-commits] .: vcl/inc vcl/unx

Joseph Powers jpowers at kemper.freedesktop.org
Wed Jul 20 05:27:47 PDT 2011


 vcl/inc/unx/salbmp.h           |    6 +++-
 vcl/unx/generic/gdi/salbmp.cxx |   59 ++++++++++++++++++++++++-----------------
 2 files changed, 40 insertions(+), 25 deletions(-)

New commits:
commit 7ae67844deb2e13d0128f9711630e4c50435a63f
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Wed Jul 20 05:26:52 2011 -0700

    Replace List with std::list< ImplBmpObj* >
    
    bool should be set to "false" & "true" not the sal_ versions of them.
    
    Special thanks go to Matúš Kukan for compiling and help fixing the patch.

diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index 42230d8..0fa69ae 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -36,6 +36,7 @@
 #include <unx/saldisp.hxx>
 #include <salbmp.hxx>
 #include <vclpluginapi.h>
+#include <list>
 
 struct  BitmapBuffer;
 class   BitmapPalette;
@@ -246,11 +247,14 @@ public:
 // - ImplSalBitmapCache -
 // ----------------------
 
+struct ImplBmpObj;
+
 class ImplSalBitmapCache
 {
 private:
+    typedef ::std::list< ImplBmpObj* > BmpList_impl;
 
-    List            maBmpList;
+    BmpList_impl    maBmpList;
     sal_uIntPtr     mnTotalSize;
 
 public:
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 0b9e69a..22a5d1e 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -826,14 +826,14 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp )
 
 bool X11SalBitmap::Create( const SalBitmap&, SalGraphics* )
 {
-    return sal_False;
+    return false;
 }
 
 // -----------------------------------------------------------------------------
 
 bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 )
 {
-    return sal_False;
+    return false;
 }
 
 // -----------------------------------------------------------------------------
@@ -1100,7 +1100,7 @@ ImplSalDDB::~ImplSalDDB()
 
 bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const
 {
-    bool bRet = sal_False;
+    bool bRet = false;
 
     if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nScreen == mnScreen)
     {
@@ -1113,7 +1113,7 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe
            )
         {
             // absolutely indentically
-            bRet = sal_True;
+            bRet = true;
         }
         else if(  rTwoRect.mnSrcWidth   == rTwoRect.mnDestWidth
                && rTwoRect.mnSrcHeight  == rTwoRect.mnDestHeight
@@ -1125,7 +1125,7 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe
                && ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight )
                )
         {
-            bRet = sal_True;
+            bRet = true;
         }
     }
 
@@ -1209,12 +1209,18 @@ ImplSalBitmapCache::~ImplSalBitmapCache()
 
 void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags )
 {
-    ImplBmpObj* pObj;
-    bool        bFound = sal_False;
-
-    for( pObj = (ImplBmpObj*) maBmpList.Last(); pObj && !bFound; pObj = (ImplBmpObj*) maBmpList.Prev() )
+    ImplBmpObj* pObj = NULL;
+    bool        bFound = false;
+
+    for(
+        BmpList_impl::iterator it = maBmpList.begin();
+        (it != maBmpList.end() ) && !bFound ;
+        ++it
+    ) {
+        pObj = *it;
         if( pObj->mpBmp == pBmp )
-            bFound = sal_True;
+            bFound = true;
+    }
 
     mnTotalSize += nMemSize;
 
@@ -1224,21 +1230,24 @@ void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uL
         pObj->mnMemSize = nMemSize, pObj->mnFlags = nFlags;
     }
     else
-        maBmpList.Insert( new ImplBmpObj( pBmp, nMemSize, nFlags ), LIST_APPEND );
+        maBmpList.push_back( new ImplBmpObj( pBmp, nMemSize, nFlags ) );
 }
 
 // -----------------------------------------------------------------------------
 
 void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp )
 {
-    for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.Last(); pObj; pObj = (ImplBmpObj*) maBmpList.Prev() )
-    {
-        if( pObj->mpBmp == pBmp )
+    for(
+        BmpList_impl::iterator it = maBmpList.begin();
+        it != maBmpList.end();
+        ++it
+    ) {
+        if( (*it)->mpBmp == pBmp )
         {
-            maBmpList.Remove( pObj );
-            pObj->mpBmp->ImplRemovedFromCache();
-            mnTotalSize -= pObj->mnMemSize;
-            delete pObj;
+            (*it)->mpBmp->ImplRemovedFromCache();
+            mnTotalSize -= (*it)->mnMemSize;
+            delete *it;
+            maBmpList.erase( it );
             break;
         }
     }
@@ -1248,13 +1257,15 @@ void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp )
 
 void ImplSalBitmapCache::ImplClear()
 {
-    for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.First(); pObj; pObj = (ImplBmpObj*) maBmpList.Next() )
-    {
-        pObj->mpBmp->ImplRemovedFromCache();
-        delete pObj;
+    for(
+        BmpList_impl::iterator it = maBmpList.begin();
+        it != maBmpList.end();
+        ++it
+    ) {
+        (*it)->mpBmp->ImplRemovedFromCache();
+        delete *it;
     }
-
-    maBmpList.Clear();
+    maBmpList.clear();
     mnTotalSize = 0;
 }
 


More information about the Libreoffice-commits mailing list