INTEGRATION: CWS impress69 (1.2.434); FILE MERGED
2005/10/14 11:01:29 af 1.2.434.2: RESYNC: (1.2-1.3); FILE MERGED 2005/09/21 15:49:25 af 1.2.434.1: #i54916# Support for bitmap compression.
This commit is contained in:
parent
6cf7d1a923
commit
211f4fa463
1 changed files with 55 additions and 26 deletions
|
@ -4,9 +4,9 @@
|
|||
*
|
||||
* $RCSfile: SlsCacheCompactor.hxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: rt $ $Date: 2005-09-09 06:09:56 $
|
||||
* last change: $Author: rt $ $Date: 2005-10-24 07:40:12 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -37,43 +37,72 @@
|
|||
#define SD_SLIDESORTER_CACHE_COMPACTOR_HXX
|
||||
|
||||
#include <sal/types.h>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <memory>
|
||||
|
||||
namespace sd { namespace slidesorter { namespace cache {
|
||||
|
||||
class BitmapCache;
|
||||
class BitmapCompressor;
|
||||
|
||||
/** This trivial compaction operation does not do anything. It especially
|
||||
does not remove or scale down older bitmaps. Use this operator for
|
||||
debugging, experiments, or when memory consumption is of no concern.
|
||||
/** This is an interface class whose implementations are created via the
|
||||
Create() factory method.
|
||||
*/
|
||||
class NoCompaction
|
||||
class CacheCompactor
|
||||
{
|
||||
public:
|
||||
void operator() (BitmapCache& rCache, sal_Int32 nMaximalSize);
|
||||
virtual ~CacheCompactor (void) {};
|
||||
|
||||
/** Create a new instance of the CacheCompactor interface class. The
|
||||
type of compaction algorithm used depends on values from the
|
||||
configuration: the SlideSorter/PreviewCache/CompactionPolicy
|
||||
property of the Impress.xcs file currently supports the values
|
||||
"None" and "Compress". With the later the CompressionPolicy
|
||||
property is evaluated which implementation of the BitmapCompress
|
||||
interface class to use as bitmap compressor.
|
||||
@param rCache
|
||||
The bitmap cache on which to operate.
|
||||
@param nMaximalCacheSize
|
||||
The total number of bytes the off-screen bitmaps in the cache
|
||||
may have. When the Run() method is (indirectly) called the
|
||||
compactor tries to reduce that summed size of off-screen bitmaps
|
||||
under this number. However, it is not guaranteed that this
|
||||
works in all cases.
|
||||
*/
|
||||
static ::std::auto_ptr<CacheCompactor> Create (
|
||||
BitmapCache& rCache,
|
||||
sal_Int32 nMaximalCacheSize);
|
||||
|
||||
/** Request a compaction of the off-screen previews in the bitmap
|
||||
cache. This calls via a timer the Run() method.
|
||||
*/
|
||||
virtual void RequestCompaction (void);
|
||||
|
||||
protected:
|
||||
BitmapCache& mrCache;
|
||||
sal_Int32 mnMaximalCacheSize;
|
||||
|
||||
CacheCompactor(
|
||||
BitmapCache& rCache,
|
||||
sal_Int32 nMaximalCacheSize);
|
||||
|
||||
/** This method actually tries to reduce the total number of bytes used
|
||||
by the off-screen preview bitmaps.
|
||||
*/
|
||||
virtual void Run (void) = 0;
|
||||
|
||||
private:
|
||||
/** This timer is used to collect calles to RequestCompaction() and
|
||||
eventually call Run().
|
||||
*/
|
||||
Timer maCompactionTimer;
|
||||
bool mbIsCompactionRunning;
|
||||
DECL_LINK(CompactionCallback, Timer*);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/** Make room for new bitmaps by removing seldomly used ones.
|
||||
*/
|
||||
class CompactionByRemoval
|
||||
{
|
||||
public:
|
||||
void operator() (BitmapCache& rCache, sal_Int32 nMaximalSize);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/** Make room for new new bitmaps by reducing the resolution of old ones.
|
||||
*/
|
||||
class CompactionByReduction
|
||||
{
|
||||
public:
|
||||
void operator() (BitmapCache& rCache, sal_Int32 nMaximalSize);
|
||||
};
|
||||
|
||||
} } } // end of namespace ::sd::slidesorter::cache
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue