summaryrefslogtreecommitdiff
path: root/imagecache.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-12-29 18:13:45 +0100
committerlouis <louis.braun@gmx.de>2013-12-29 18:13:45 +0100
commiteede61ade5b226480ebbe1e29235df58170a24bd (patch)
tree72098ad56f9d6902eeee75bc5fb4d5d02eb84340 /imagecache.c
parent06ed8b3567bee43f47659b17baf084fed352ddb4 (diff)
downloadvdr-plugin-tvguide-eede61ade5b226480ebbe1e29235df58170a24bd.tar.gz
vdr-plugin-tvguide-eede61ade5b226480ebbe1e29235df58170a24bd.tar.bz2
Added possibility to search for reruns in case of a timer conflict
Diffstat (limited to 'imagecache.c')
-rw-r--r--imagecache.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/imagecache.c b/imagecache.c
index 3b897b9..90af108 100644
--- a/imagecache.c
+++ b/imagecache.c
@@ -2,10 +2,10 @@
#include <sstream>
#include <map>
#include <vdr/channels.h>
-#include "imagecache.h"
#include "config.h"
#include "imagescaler.h"
#include "tools.h"
+#include "imagecache.h"
cImageCache::cImageCache() : cImageMagickWrapper() {
tempStaticLogo = NULL;
@@ -372,6 +372,27 @@ cImage *cImageCache::GetLogo(const cChannel *channel) {
return NULL;
}
+cImage *cImageCache::GetIcon(std::string name, int width, int height) {
+ std::stringstream iconName;
+ iconName << name << width << "x" << height;
+ std::map<std::string, cImage*>::iterator hit = iconCache.find(iconName.str());
+ if (hit != iconCache.end()) {
+ return (cImage*)hit->second;
+ } else {
+ std::stringstream iconPath;
+ iconPath << "recmenuicons/" << name;
+ bool success = LoadIcon(iconPath.str());
+ if (success) {
+ cImage *image = CreateImage(width, height);
+ iconCache.insert(std::pair<std::string, cImage*>(iconName.str(), image));
+ hit = iconCache.find(iconName.str());
+ if (hit != iconCache.end()) {
+ return (cImage*)hit->second;
+ }
+ }
+ }
+ return NULL;
+}
void cImageCache::InsertIntoOsdElementCache(eOsdElementType type, int width, int height) {
cImage *image = CreateImage(width, height, false);
@@ -578,7 +599,7 @@ std::string cImageCache::GetCacheSize(eCacheType type) {
sizeByte += img->Width() * img->Height() * sizeof(tColor);
}
numImages = osdElementCache.size();
- } else if ((type == ctGrid) || (type == ctLogo) || (type == ctChannelGroup)) {
+ } else if ((type == ctGrid) || (type == ctLogo) || (type == ctChannelGroup) || (type == ctIcon)) {
std::map<std::string, cImage*> *cache;
if (type == ctGrid)
cache = &gridCache;
@@ -586,6 +607,8 @@ std::string cImageCache::GetCacheSize(eCacheType type) {
cache = &logoCache;
else if (type == ctChannelGroup)
cache = &groupsCache;
+ else if (type == ctIcon)
+ cache = &iconCache;
for(std::map<std::string, cImage*>::const_iterator it = cache->begin(); it != cache->end(); it++) {
cImage *img = (cImage*)it->second;
@@ -622,6 +645,12 @@ void cImageCache::Clear(void) {
delete img;
}
logoCache.clear();
+
+ for(std::map<std::string, cImage*>::const_iterator it = iconCache.begin(); it != iconCache.end(); it++) {
+ cImage *img = (cImage*)it->second;
+ delete img;
+ }
+ iconCache.clear();
if (tempStaticLogo)
delete tempStaticLogo;