mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Fixed thumbnails for choices without images
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@391 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -43,7 +43,9 @@ Image ChoiceThumbnailRequest::generate() {
|
|||||||
ChoiceValueEditor& cve = *(ChoiceValueEditor*)owner;
|
ChoiceValueEditor& cve = *(ChoiceValueEditor*)owner;
|
||||||
String name = cannocial_name_form(cve.field().choices->choiceName(id));
|
String name = cannocial_name_form(cve.field().choices->choiceName(id));
|
||||||
ScriptableImage& img = cve.style().choice_images[name];
|
ScriptableImage& img = cve.style().choice_images[name];
|
||||||
return img.generate(GeneratedImage::Options(16,16, stylesheet.get(), &cve.getSet(), ASPECT_BORDER, true), false);
|
return img.isReady()
|
||||||
|
? img.generate(GeneratedImage::Options(16,16, stylesheet.get(), &cve.getSet(), ASPECT_BORDER, true), false)
|
||||||
|
: wxImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChoiceThumbnailRequest::store(const Image& img) {
|
void ChoiceThumbnailRequest::store(const Image& img) {
|
||||||
|
|||||||
+13
-14
@@ -33,21 +33,20 @@ Image ScriptableImage::generate(const GeneratedImage::Options& options, bool cac
|
|||||||
// cached, so we are done
|
// cached, so we are done
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
// generate blank image
|
// generate
|
||||||
Image image(1,1);
|
Image image;
|
||||||
image.InitAlpha();
|
|
||||||
image.SetAlpha(0,0,0);
|
|
||||||
if (isReady()) {
|
if (isReady()) {
|
||||||
try {
|
// note: Don't catch exceptions here, we don't want to return an invalid image.
|
||||||
image = value->generate(options);
|
// We could return a blank one, but the thumbnail code does want an invalid
|
||||||
}
|
// image in case of errors.
|
||||||
catch (FileNotFoundError e) {
|
// This allows the caller to catch errors.
|
||||||
handle_error (e);
|
image = value->generate(options);
|
||||||
return image;
|
} else {
|
||||||
}
|
// error, return blank image
|
||||||
}
|
Image i(1,1);
|
||||||
else {
|
i.InitAlpha();
|
||||||
return image;
|
i.SetAlpha(0,0,0);
|
||||||
|
image = i;
|
||||||
}
|
}
|
||||||
// resize?
|
// resize?
|
||||||
int iw = image.GetWidth(), ih = image.GetHeight();
|
int iw = image.GetWidth(), ih = image.GetHeight();
|
||||||
|
|||||||
Reference in New Issue
Block a user