diff options
author | Manuel Reimer <manuel.reimer@gmx.de> | 2014-11-11 20:50:00 +0100 |
---|---|---|
committer | Manuel Reimer <manuel.reimer@gmx.de> | 2014-11-11 20:50:00 +0100 |
commit | 234c8559905800413ba281c9cd8c6c1bc612f4c5 (patch) | |
tree | 8869f9c57ece70b50db5d3d7de91d83e65c6a362 /libcore | |
parent | 7762e99dd097f40cfbeaba3ac58c3eab7b92de7d (diff) | |
download | vdr-plugin-skindesigner-234c8559905800413ba281c9cd8c6c1bc612f4c5.tar.gz vdr-plugin-skindesigner-234c8559905800413ba281c9cd8c6c1bc612f4c5.tar.bz2 |
Added support for SVG channellogos
Diffstat (limited to 'libcore')
-rw-r--r-- | libcore/imagecache.c | 41 | ||||
-rw-r--r-- | libcore/imageloader.c | 4 |
2 files changed, 19 insertions, 26 deletions
diff --git a/libcore/imagecache.c b/libcore/imagecache.c index 62691e6..7eabbca 100644 --- a/libcore/imagecache.c +++ b/libcore/imagecache.c @@ -140,27 +140,18 @@ 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, "png"); } void cImageCache::CacheIcon(eImageType type, string name, int width, int height) { @@ -329,21 +320,23 @@ bool cImageCache::LoadLogo(const cChannel *channel) { return false; string channelID = StrToLowerCase(*(channel->GetChannelID().ToString())); string logoLower = StrToLowerCase(channel->Name()); - bool success = false; - - if (FileExists(logoPath.c_str(), channelID.c_str(), *config.logoExtension)) - return LoadImage(logoPath.c_str(), channelID.c_str(), *config.logoExtension); - if (FileExists(logoPath.c_str(), logoLower.c_str(), *config.logoExtension)) - return LoadImage(logoPath.c_str(), logoLower.c_str(), *config.logoExtension); + 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()); - return LoadImage(*separatorPath, nameLower.c_str(), *config.logoExtension); + return LoadImage(separatorPath, nameLower.c_str(), "png"); } bool cImageCache::LoadSkinpart(string name) { diff --git a/libcore/imageloader.c b/libcore/imageloader.c index b752a99..1f4a31f 100644 --- a/libcore/imageloader.c +++ b/libcore/imageloader.c @@ -101,7 +101,6 @@ void cImageLoader::DeterminateChannelLogoSize(int &width, int &height) { else logoPath = config.logoPath; - cString logoExt = config.logoExtension; DIR *folder = NULL; struct dirent *file; folder = opendir(logoPath); @@ -109,7 +108,8 @@ void cImageLoader::DeterminateChannelLogoSize(int &width, int &height) { return; while ( (file = readdir(folder)) ) { - if (endswith(file->d_name, *logoExt)) { + if (endswith(file->d_name, ".png") || + endswith(file->d_name, ".svg")) { std::stringstream filePath; filePath << *logoPath << file->d_name; if (LoadImage(filePath.str().c_str())) { |