diff options
author | louis <louis.braun@gmx.de> | 2014-11-15 11:15:48 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2014-11-15 11:15:48 +0100 |
commit | 0ed710a86884136a7bd772322f13f0b176a5dc22 (patch) | |
tree | cd4ae6f14b29988d35ce67acb9012c610348bc95 /libcore/imagecache.c | |
parent | f225c38103013faf38512cc61362cf9bb9088ba6 (diff) | |
parent | 7a69d868c422218817f1c92a6666ee6c83825d23 (diff) | |
download | vdr-plugin-skindesigner-0.0.5.tar.gz vdr-plugin-skindesigner-0.0.5.tar.bz2 |
Version 0.0.5 - added SVG Support0.0.5
Diffstat (limited to 'libcore/imagecache.c')
-rw-r--r-- | libcore/imagecache.c | 76 |
1 files changed, 33 insertions, 43 deletions
diff --git a/libcore/imagecache.c b/libcore/imagecache.c index 9ad9918..369322e 100644 --- a/libcore/imagecache.c +++ b/libcore/imagecache.c @@ -7,14 +7,13 @@ #include "../config.h" #include "helpers.h" -using namespace Magick; cMutex cImageCache::mutex; string cImageCache::items[16] = { "Schedule", "Channels", "Timers", "Recordings", "Setup", "Commands", "OSD", "EPG", "DVB", "LNB", "CAM", "Recording", "Replay", "Miscellaneous", "Plugins", "Restart"}; -cImageCache::cImageCache() : cImageMagickWrapper() { +cImageCache::cImageCache() { tempStaticLogo = NULL; } @@ -141,27 +140,19 @@ bool cImageCache::LogoExists(string channelID) { if (!channel) return false; string logoLower = StrToLowerCase(channel->Name()); - string logoExt = *config.logoExtension; - bool logoExists = FileExists(logoPath.c_str(), logoLower, logoExt); - if (logoExists) { - return true; - } - logoExists = FileExists(logoPath.c_str(), channelID, logoExt); - if (logoExists) { - return true; - } - return false; + + return (FileExists(logoPath.c_str(), logoLower, "svg") || + FileExists(logoPath.c_str(), logoLower, "png") || + FileExists(logoPath.c_str(), channelID, "svg") || + FileExists(logoPath.c_str(), channelID, "png")); } bool cImageCache::SeparatorLogoExists(string name) { string separatorPath = *cString::sprintf("%sseparatorlogos/", logoPath.c_str()); string nameLower = StrToLowerCase(name.c_str()); - string logoExt = *config.logoExtension; - bool logoExists = FileExists(separatorPath, nameLower, logoExt); - if (logoExists) { - return true; - } - return false; + + return (FileExists(separatorPath, nameLower, "svg") || + FileExists(separatorPath, nameLower, "png")); } void cImageCache::CacheIcon(eImageType type, string name, int width, int height) { @@ -312,18 +303,17 @@ cImage *cImageCache::GetSkinpart(string name, int width, int height) { } bool cImageCache::LoadIcon(eImageType type, string name) { - bool success = false; cString subdir(""); if (type == itMenuIcon) subdir = "menuicons"; else if (type == itIcon) subdir = "icons"; cString subIconPath = cString::sprintf("%s%s/", iconPath.c_str(), *subdir); - success = LoadImage(name, *subIconPath, "png"); - if (success) { - return true; - } - return false; + + if (FileExists(*subIconPath, name, "svg")) + return LoadImage(*subIconPath, name, "svg"); + else + return LoadImage(*subIconPath, name, "png"); } bool cImageCache::LoadLogo(const cChannel *channel) { @@ -331,33 +321,33 @@ bool cImageCache::LoadLogo(const cChannel *channel) { return false; string channelID = StrToLowerCase(*(channel->GetChannelID().ToString())); string logoLower = StrToLowerCase(channel->Name()); - bool success = false; - success = LoadImage(channelID.c_str(), logoPath.c_str(), *config.logoExtension); - if (success) - return true; - success = LoadImage(logoLower.c_str(), logoPath.c_str(), *config.logoExtension); - if (success) - return true; + + if (FileExists(logoPath.c_str(), channelID.c_str(), "svg")) + return LoadImage(logoPath.c_str(), channelID.c_str(), "svg"); + if (FileExists(logoPath.c_str(), channelID.c_str(), "png")) + return LoadImage(logoPath.c_str(), channelID.c_str(), "png"); + if (FileExists(logoPath.c_str(), logoLower.c_str(), "svg")) + return LoadImage(logoPath.c_str(), logoLower.c_str(), "svg"); + if (FileExists(logoPath.c_str(), logoLower.c_str(), "png")) + return LoadImage(logoPath.c_str(), logoLower.c_str(), "png"); + return false; } bool cImageCache::LoadSeparatorLogo(string name) { - cString separatorPath = cString::sprintf("%sseparatorlogos/", logoPath.c_str()); + string separatorPath = *cString::sprintf("%sseparatorlogos/", logoPath.c_str()); string nameLower = StrToLowerCase(name.c_str()); - bool success = false; - success = LoadImage(nameLower.c_str(), *separatorPath, *config.logoExtension); - if (success) - return true; - return false; + if (FileExists(separatorPath, nameLower.c_str(), "svg")) + return LoadImage(separatorPath, nameLower.c_str(), "svg"); + else + return LoadImage(separatorPath, nameLower.c_str(), "png"); } bool cImageCache::LoadSkinpart(string name) { - bool success = false; - success = LoadImage(name, skinPartsPath.c_str(), "png"); - if (success) { - return true; - } - return false; + if (FileExists(skinPartsPath.c_str(), name, "svg")) + return LoadImage(skinPartsPath.c_str(), name, "svg"); + else + return LoadImage(skinPartsPath.c_str(), name, "png"); } void cImageCache::Clear(void) { |