diff options
| author | louis <louis.braun@gmx.de> | 2014-12-06 10:13:06 +0100 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2014-12-06 10:13:06 +0100 |
| commit | 974ca74366af7ab022c1fb79c4d36e1e0b4e4d14 (patch) | |
| tree | c45276da41b4117fa920c2fbebcc1ee8b50efaaa /libcore/imagecache.c | |
| parent | 7b538a7be703c70625b38644dfc8d6c04f11af2c (diff) | |
| parent | 28fd2f5e1a5c88a91caeb4c7bd363dbaffad3789 (diff) | |
| download | vdr-plugin-skindesigner-974ca74366af7ab022c1fb79c4d36e1e0b4e4d14.tar.gz vdr-plugin-skindesigner-974ca74366af7ab022c1fb79c4d36e1e0b4e4d14.tar.bz2 | |
Merge branch 'master' of projects.vdr-developer.org:vdr-plugin-skindesigner
Diffstat (limited to 'libcore/imagecache.c')
| -rw-r--r-- | libcore/imagecache.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/libcore/imagecache.c b/libcore/imagecache.c index cfaf255..4d68722 100644 --- a/libcore/imagecache.c +++ b/libcore/imagecache.c @@ -3,9 +3,10 @@ #include <map> #include <fstream> #include <sys/stat.h> -#include "imagecache.h" +#include "imagecreator.h" #include "../config.h" #include "helpers.h" +#include "imagecache.h" cMutex cImageCache::mutex; @@ -300,6 +301,37 @@ cImage *cImageCache::GetSkinpart(string name, int width, int height) { return NULL; } +void cImageCache::CacheEllipse(int id, int width, int height, tColor color, int quadrant) { + esyslog("skindesigner: caching ellipse %d, w %d, h %d, color %x, quadrant %d", id, width, height, color, quadrant); + GetEllipse(id, width, height, color, quadrant); +} + +cImage *cImageCache::GetEllipse(int id, int width, int height, tColor color, int quadrant) { + if (width < 1 || width > 1920 || height < 1 || height > 1080) + return NULL; + cMutexLock MutexLock(&mutex); + map<int, cImage*>::iterator hit = cairoImageCache.find(id); + if (hit != cairoImageCache.end()) { + return (cImage*)hit->second; + } else { + cImageCreator ic; + if (!ic.InitCairoImage(width, height)) + return NULL; + ic.DrawEllipse(color, quadrant); + cImage *ellipse = ic.GetImage(); + cairoImageCache.insert(pair<int, cImage*>(id, ellipse)); + hit = cairoImageCache.find(id); + if (hit != cairoImageCache.end()) { + return (cImage*)hit->second; + } + } + return NULL; +} + +/**************************************************************************************** +* PRIVATE FUNCTIONS +****************************************************************************************/ + bool cImageCache::LoadIcon(eImageType type, string name) { cString subdir(""); if (type == itMenuIcon) @@ -361,11 +393,17 @@ void cImageCache::Clear(void) { } channelLogoCache.clear(); - for(map<std::string, cImage*>::const_iterator it = skinPartsCache.begin(); it != skinPartsCache.end(); it++) { + for(map<string, cImage*>::const_iterator it = skinPartsCache.begin(); it != skinPartsCache.end(); it++) { cImage *img = (cImage*)it->second; delete img; } skinPartsCache.clear(); + + for(map<int, cImage*>::const_iterator it = cairoImageCache.begin(); it != cairoImageCache.end(); it++) { + cImage *img = (cImage*)it->second; + delete img; + } + cairoImageCache.clear(); } void cImageCache::Debug(bool full) { |
