diff options
author | Rüdiger Timm <rt@openoffice.org> | 2006-05-04 06:49:13 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2006-05-04 06:49:13 +0000 |
commit | 5291ab39074477fab48b6d0e73d21fc36481f361 (patch) | |
tree | afa47cb7c71123b33a0f1d8ba33e0bb9efb77e8f /goodies/source | |
parent | 93422129fb9416f440d7ac297777d93716119dae (diff) |
INTEGRATION: CWS thbpp3 (1.19.52); FILE MERGED
2006/03/06 17:53:53 thb 1.19.52.1: #131696# Asserting bmp/mask size inconsistencies; checking return value of GraphicCache::ImplGetCacheEntry() before dereffing the ptr
Diffstat (limited to 'goodies/source')
-rw-r--r-- | goodies/source/graphic/grfcache.cxx | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/goodies/source/graphic/grfcache.cxx b/goodies/source/graphic/grfcache.cxx index d71602e6d72e..d36a7fbf71b7 100644 --- a/goodies/source/graphic/grfcache.cxx +++ b/goodies/source/graphic/grfcache.cxx @@ -4,9 +4,9 @@ * * $RCSfile: grfcache.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: rt $ $Date: 2005-10-19 12:43:49 $ + * last change: $Author: rt $ $Date: 2006-05-04 07:49:13 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -689,14 +689,24 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) void GraphicCache::GraphicObjectWasSwappedOut( const GraphicObject& rObj ) { - ImplGetCacheEntry( rObj )->GraphicObjectWasSwappedOut( rObj ); + // notify cache that rObj is swapped out (and can thus be pruned + // from the cache) + GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj ); + + if( pEntry ) + pEntry->GraphicObjectWasSwappedOut( rObj ); } // ----------------------------------------------------------------------------- BOOL GraphicCache::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) { - return( ImplGetCacheEntry( rObj )->FillSwappedGraphicObject( rObj, rSubstitute ) ); + GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj ); + + if( !pEntry ) + return FALSE; + + return pEntry->FillSwappedGraphicObject( rObj, rSubstitute ); } // ----------------------------------------------------------------------------- @@ -808,9 +818,12 @@ BOOL GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const //GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) ( (GraphicCache*) this )->maDisplayCache.First(); // -Wall removed .... BOOL bFound = FALSE; - for( long i = 0, nCount = maDisplayCache.Count(); !bFound && ( i < nCount ); i++ ) - if( ( (GraphicDisplayCacheEntry*) maDisplayCache.GetObject( i ) )->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) ) - bFound = TRUE; + if( pCacheEntry ) + { + for( long i = 0, nCount = maDisplayCache.Count(); !bFound && ( i < nCount ); i++ ) + if( ( (GraphicDisplayCacheEntry*) maDisplayCache.GetObject( i ) )->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) ) + bFound = TRUE; + } return bFound; } |