author | alwin <alwin> | 2004-04-19 09:16:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-19 09:16:15 (UTC) |
commit | e3ca538f7ce2e7b7df2f29f263778acc342d51db (patch) (side-by-side diff) | |
tree | cb3e3c769ae12542d24eff7d17168635ddef65af /noncore/graphics/opie-eye/lib/imagecache.cpp | |
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/imagecache.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/lib/imagecache.cpp | 6 |
1 files changed, 6 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 @@ -41,47 +41,53 @@ QImage* PImageCache::cachedImage( const QString& _path, int ori, int max ) { currentView()->dirLister()->image( _path, PDirLister::Factor( ori ), max ); } return img; } void PImageCache::insertImage( const QString& _path, const QImage* img, int ori, int max ) { QString path = QString("%1_%2:" ).arg( ori ).arg( max ); path += _path; insert( path, img, (img->height()*img->width()*img->depth())/8 ); } PPixmapCache::PPixmapCache() { /* * 20 64x64 16 bit images */ setMaxCost( 64*64*QPixmap::defaultDepth()/8*20 ); } PPixmapCache::~PPixmapCache() { } +void PPixmapCache::setMaxImages(unsigned int aMax) +{ + m_MaxImages = aMax; + setMaxCost( 64*64*QPixmap::defaultDepth()/8*m_MaxImages); +} + PPixmapCache* PPixmapCache::self() { if ( !_pxmCache ) _pxmCache = new PPixmapCache; return _pxmCache; } QPixmap* PPixmapCache::cachedImage( const QString& _path, int width, int height ) { QString path = QString( "%1_%2:" ).arg( width ).arg( height ); path += _path; QPixmap* pxm = find( path ); return pxm; } void PPixmapCache::insertImage( const QString& _path, const QPixmap* pix, int width, int height ) { QString path = QString("%1_%2:" ).arg( width ).arg( height ); path += _path; insert( path, pix, (pix->height()*pix->width()*pix->depth())/8 ); } |