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:
twanvl
2006-12-24 00:41:46 +00:00
parent 40606d975e
commit 77c6acf90f
2 changed files with 25 additions and 21 deletions
+21
View File
@@ -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 {