diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-02-11 21:59:14 +0100 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-02-11 21:59:14 +0100 |
commit | 01ced85236b625635231bb548e04469252ae98df (patch) | |
tree | 519538ac726b9956bdc6690c54842a04054c0da9 /imagecache.c | |
parent | 847cb778ddcab6ccf458db6ef4ae5e68a31038d1 (diff) | |
download | skin-flatplus-01ced85236b625635231bb548e04469252ae98df.tar.gz skin-flatplus-01ced85236b625635231bb548e04469252ae98df.tar.bz2 |
add first implementation of imagescaler + imagecache
Diffstat (limited to 'imagecache.c')
-rw-r--r-- | imagecache.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/imagecache.c b/imagecache.c new file mode 100644 index 00000000..b220f6e2 --- /dev/null +++ b/imagecache.c @@ -0,0 +1,52 @@ +#include "imagecache.h" + +cImageCache::cImageCache() { + +} + +cImageCache::~cImageCache() { + +} + +void cImageCache::Create(void) { + for(int i = 0; i < MAX_IMAGE_CACHE; i++) { + CacheImage[i] = NULL; + CacheName[i] = ""; + CacheWidth[i] = -1; + CacheHeight[i] = -1; + } + + InsertIndex = 0; +} + +void cImageCache::Clear(void) { + for(int i = 0; i < MAX_IMAGE_CACHE; i++) { + if( CacheImage[i] != NULL ) + delete CacheImage[i]; + } + + InsertIndex = 0; +} + +cImage* cImageCache::GetImage(std::string Name, int Width, int Height) { + for(int index = 0; index < MAX_IMAGE_CACHE; index++ ) { + if( CacheName[index] == Name && CacheWidth[index] == Width && CacheHeight[index] == Height ) + return CacheImage[index]; + } + return NULL; +} + +void cImageCache::InsertImage(cImage *Image, std::string Name, int Width, int Height) { + CacheImage[InsertIndex] = Image; + CacheName[InsertIndex] = Name; + CacheWidth[InsertIndex] = Width; + CacheHeight[InsertIndex] = Height; + + dsyslog("imagecache InsertImage"); + + InsertIndex++; + if( InsertIndex >= MAX_IMAGE_CACHE ) { + InsertIndex = 0; + dsyslog("imagecache overflow"); + } +} |