From c6cefaec2794ce21a45f3f9b981d1e125f32ce0e Mon Sep 17 00:00:00 2001 From: coppro Date: Sat, 3 Feb 2007 04:33:37 +0000 Subject: [PATCH] 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 --- src/render/symbol/filter.cpp | 8 +++++++- src/script/context.hpp | 2 +- src/script/parser.cpp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/render/symbol/filter.cpp b/src/render/symbol/filter.cpp index 4cae4f26..870b4315 100644 --- a/src/render/symbol/filter.cpp +++ b/src/render/symbol/filter.cpp @@ -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 diff --git a/src/script/context.hpp b/src/script/context.hpp index d3227b30..c2d3cffc 100644 --- a/src/script/context.hpp +++ b/src/script/context.hpp @@ -70,7 +70,7 @@ class Context { Variable value; ///< Old value of that variable. }; private: - /// Variables, indexed by integer naem (using string_to_variable) + /// Variables, indexed by integer name (using string_to_variable) VectorIntMap variables; /// Shadowed variable bindings vector shadowed; diff --git a/src/script/parser.cpp b/src/script/parser.cpp index 1152f0f5..2dad2210 100644 --- a/src/script/parser.cpp +++ b/src/script/parser.cpp @@ -292,7 +292,7 @@ void parseExpr(TokenIterator& input, Script& script, Precedence minPrec); /// Parse an expression, possibly with operators applied. Optionally adds an instruction at the end. /** @param input Read tokens from the input - * @param scrip Add resulting instructions to the script + * @param script Add resulting instructions to the script * @param minPrec Minimum precedence level for operators * @param closeWith Add this instruction at the end * @param closeWithData Data for the instruction at the end