Fixed symbol change crash. The symbol change menu still hovers around being completely out of date from the actual symbol, and the changes don't nessecarilly take place on the card either. Perhaps a caching problem?

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@195 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
coppro
2007-02-03 04:33:37 +00:00
parent 3c4790cac9
commit c6cefaec27
3 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -15,10 +15,16 @@
// ----------------------------------------------------------------------------- : Symbol filtering
void filter_symbol(Image& symbol, const SymbolFilter& filter) {
if (!symbol.HasAlpha()) symbol.InitAlpha();
Byte* data = symbol.GetData();
Byte* alpha = symbol.GetAlpha();
UInt width = symbol.GetWidth(), height = symbol.GetHeight();
// HACK: wxGTK seems to fail sometimes if you ask it to allocate the alpha channel.
// This manually allocates the memory and gives it to the image to handle.
if (!alpha) {
alpha = (Byte*) malloc (sizeof(Byte) * width * height);
memset(alpha, 255, width * height);
symbol.SetAlpha(alpha);
}
for (UInt y = 0 ; y < width ; ++y) {
for (UInt x = 0 ; x < height ; ++x) {
// Determine set