|
From: Felix B. <fbe...@us...> - 2010-05-07 05:09:48
|
Module: performous
Branch: master
Commit: 4eb77bb33e33ff4138aef10b6668caeeab0f6a1b
Author: Felix Bertram <fl...@be...>
Date: Thu May 6 22:06:43 2010 -0700
FoFiX songs often come with album art that has a PNG extension
but is actually in JPEG format. This fix catches the exception
thrown by the PNG loader and then tries to reload the picture
as JPEG. This is not pretty - but recoding the artwork is also
not an option.
---
game/surface.cc | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/game/surface.cc b/game/surface.cc
index dd23d7e..be71e13 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -32,7 +32,12 @@ template <typename T> void loader(T& target, fs::path name) {
std::for_each(ext.begin(), ext.end(), static_cast<int(*)(int)>(std::tolower));
if (ext == ".svg") loadSVG(target, filename);
- else if (ext == ".png") loadPNG(target, filename);
+ else if (ext == ".png") {
+ try {loadPNG(target, filename);}
+ // FIXME: there is probably a cleaner way to do this
+ // FoFiX songs often come with album art that is JPEG with a PNG extension
+ catch (...) {loadJPEG(target, filename);}
+ }
else loadJPEG(target, filename);
}
|