exception/error handling

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@137 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-21 22:09:42 +00:00
parent 2ba1d0b1b8
commit a9a93c07c3
4 changed files with 31 additions and 17 deletions
+13 -9
View File
@@ -57,15 +57,19 @@ class CardThumbnailRequest : public ThumbnailRequest {
, filename(filename)
{}
virtual Image generate() {
ImageCardList* parent = (ImageCardList*)owner;
Image image;
if (image.LoadFile(*parent->set->openIn(filename))) {
// two step anti aliased resampling
image.Rescale(36, 28); // step 1: no anti aliassing
Image image2(18, 14, false); // step 2: with anti aliassing
resample(image, image2);
return image2;
} else {
try {
ImageCardList* parent = (ImageCardList*)owner;
Image image;
if (image.LoadFile(*parent->set->openIn(filename))) {
// two step anti aliased resampling
image.Rescale(36, 28); // step 1: no anti aliassing
Image image2(18, 14, false); // step 2: with anti aliassing
resample(image, image2);
return image2;
} else {
return Image();
}
} catch (...) {
return Image();
}
}