author | alwin <alwin> | 2004-04-19 09:16:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-19 09:16:15 (UTC) |
commit | e3ca538f7ce2e7b7df2f29f263778acc342d51db (patch) (unidiff) | |
tree | cb3e3c769ae12542d24eff7d17168635ddef65af /noncore/graphics/opie-eye/lib | |
parent | 0b59a16b5a5a179c46ddb3f8c585dbca59b2826e (diff) | |
download | opie-e3ca538f7ce2e7b7df2f29f263778acc342d51db.zip opie-e3ca538f7ce2e7b7df2f29f263778acc342d51db.tar.gz opie-e3ca538f7ce2e7b7df2f29f263778acc342d51db.tar.bz2 |
re-enabled the cache as designed.
for that, pixcache has now a method setting the size of cache (parameter count
of pix) and it will switched between the different views.
setPixmap is overloaded that way, that we don't store the pix inside the
item but calling calcRect which is accessing the cached pixmap. voila.
Zecke: Should we make a configure item where users can setup how much
pix-previews should cache? Should we setup a thumbnail cache like .xvpics?
Diffstat (limited to 'noncore/graphics/opie-eye/lib') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/lib/imagecache.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/imagecache.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/lib/imagecache.cpp b/noncore/graphics/opie-eye/lib/imagecache.cpp index 3b74a83..f1042a4 100644 --- a/noncore/graphics/opie-eye/lib/imagecache.cpp +++ b/noncore/graphics/opie-eye/lib/imagecache.cpp | |||
@@ -59,12 +59,18 @@ PPixmapCache::PPixmapCache() { | |||
59 | setMaxCost( 64*64*QPixmap::defaultDepth()/8*20 ); | 59 | setMaxCost( 64*64*QPixmap::defaultDepth()/8*20 ); |
60 | } | 60 | } |
61 | 61 | ||
62 | PPixmapCache::~PPixmapCache() { | 62 | PPixmapCache::~PPixmapCache() { |
63 | } | 63 | } |
64 | 64 | ||
65 | void PPixmapCache::setMaxImages(unsigned int aMax) | ||
66 | { | ||
67 | m_MaxImages = aMax; | ||
68 | setMaxCost( 64*64*QPixmap::defaultDepth()/8*m_MaxImages); | ||
69 | } | ||
70 | |||
65 | PPixmapCache* PPixmapCache::self() { | 71 | PPixmapCache* PPixmapCache::self() { |
66 | if ( !_pxmCache ) | 72 | if ( !_pxmCache ) |
67 | _pxmCache = new PPixmapCache; | 73 | _pxmCache = new PPixmapCache; |
68 | 74 | ||
69 | return _pxmCache; | 75 | return _pxmCache; |
70 | } | 76 | } |
diff --git a/noncore/graphics/opie-eye/lib/imagecache.h b/noncore/graphics/opie-eye/lib/imagecache.h index 076ecd3..939247a 100644 --- a/noncore/graphics/opie-eye/lib/imagecache.h +++ b/noncore/graphics/opie-eye/lib/imagecache.h | |||
@@ -25,17 +25,22 @@ public: | |||
25 | 25 | ||
26 | 26 | ||
27 | class PPixmapCache : public QCache<QPixmap> { | 27 | class PPixmapCache : public QCache<QPixmap> { |
28 | private: | 28 | private: |
29 | PPixmapCache(); | 29 | PPixmapCache(); |
30 | ~PPixmapCache(); | 30 | ~PPixmapCache(); |
31 | |||
32 | unsigned int m_MaxImages; | ||
33 | |||
31 | public: | 34 | public: |
32 | static PPixmapCache *self(); | 35 | static PPixmapCache *self(); |
33 | QPixmap* cachedImage( const QString& path, int width, int height ); | 36 | QPixmap* cachedImage( const QString& path, int width, int height ); |
34 | void insertImage( const QString& path, const QPixmap &, int width, int height ); | 37 | void insertImage( const QString& path, const QPixmap &, int width, int height ); |
35 | void insertImage( const QString& path, const QPixmap *, int width, int height ); | 38 | void insertImage( const QString& path, const QPixmap *, int width, int height ); |
39 | void setMaxImages(unsigned int aMax); | ||
40 | unsigned int maxImages()const{return m_MaxImages;} | ||
36 | }; | 41 | }; |
37 | 42 | ||
38 | inline void PPixmapCache::insertImage( const QString& path, const QPixmap& p, int width, int height ) { | 43 | inline void PPixmapCache::insertImage( const QString& path, const QPixmap& p, int width, int height ) { |
39 | insertImage( path, new QPixmap( p ), width, height ); | 44 | insertImage( path, new QPixmap( p ), width, height ); |
40 | } | 45 | } |
41 | 46 | ||