mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
changed handling of channel logos, width and height are now mandatory
This commit is contained in:
@@ -16,7 +16,6 @@ cImageLoader::~cImageLoader() {
|
||||
cImage *cImageLoader::CreateImage(int width, int height, bool preserveAspect) {
|
||||
if (!importer)
|
||||
return NULL;
|
||||
|
||||
int w, h;
|
||||
importer->GetImageSize(w, h);
|
||||
if (width == 0)
|
||||
@@ -92,43 +91,6 @@ bool cImageLoader::LoadImage(std::string Path, std::string FileName, std::string
|
||||
return LoadImage(imgFile.c_str());
|
||||
}
|
||||
|
||||
void cImageLoader::DeterminateChannelLogoSize(int &width, int &height) {
|
||||
cString logoPath;
|
||||
cString logoPathSkin = cString::sprintf("%s%s/themes/%s/logos/", *config.skinPath, Setup.OSDSkin, Setup.OSDTheme);
|
||||
|
||||
if (FolderExists(*logoPathSkin))
|
||||
logoPath = logoPathSkin;
|
||||
else
|
||||
logoPath = config.logoPath;
|
||||
|
||||
DIR *folder = NULL;
|
||||
struct dirent *file;
|
||||
folder = opendir(logoPath);
|
||||
if (!folder)
|
||||
return;
|
||||
|
||||
while ( (file = readdir(folder)) ) {
|
||||
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())) {
|
||||
int logoWidth = 0;
|
||||
int logoHeight = 0;
|
||||
importer->GetImageSize(logoWidth, logoHeight);
|
||||
if (logoWidth > 0 && logoHeight > 0) {
|
||||
width = logoWidth;
|
||||
height = logoHeight;
|
||||
delete(importer);
|
||||
importer = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Image importer for PNG
|
||||
//
|
||||
|
@@ -76,7 +76,6 @@ public:
|
||||
cImage *CreateImage(int width, int height, bool preserveAspect = true);
|
||||
bool LoadImage(std::string Path, std::string FileName, std::string Extension);
|
||||
bool LoadImage(const char *fullpath);
|
||||
void DeterminateChannelLogoSize(int &width, int &height);
|
||||
};
|
||||
|
||||
#endif //__NOPACITY_IMAGELOADER_H
|
||||
|
Reference in New Issue
Block a user