mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
hack to fix completely transparent images
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@161 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -51,6 +51,27 @@ void ChoiceThumbnailRequest::store(const Image& img) {
|
||||
il->Add(wxBitmap(16,16),*wxBLACK);
|
||||
}
|
||||
if (img.Ok()) {
|
||||
#ifdef __WXMSW__
|
||||
// for some reason windows doesn't like completely transparent images if they do not have a mask
|
||||
// HACK:
|
||||
if (img.GetWidth() == 16 && img.GetHeight() == 16) {
|
||||
// is the image empty?
|
||||
bool empty = true;
|
||||
int* b = (int*)img.GetAlpha();
|
||||
int* e = b + 16*16/sizeof(int);
|
||||
while (b != e) {
|
||||
if (*b++) {
|
||||
empty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if so, use a mask instead
|
||||
if (empty) {
|
||||
const_cast<Image&>(img).ConvertAlphaToMask();
|
||||
}
|
||||
}
|
||||
// Hack ends here
|
||||
#endif
|
||||
if (id == il->GetImageCount()) {
|
||||
il->Add(img);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user