Re: [AD] Bug with transparent ellipses

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> So I'd say, you simply forgot to set up those tables/functions. We
> probably should ASSERT for that in debug mode though - I'll try to come
> up with a patch to add such an ASSERT.
> 

Here it is. Syntax is somewhat ugly, but I think it should always work,
and that way there's no need to add an ASSERT at all the places this
macro is used.

All it does is, it makes the program cleanly shut down with al_assert,
instead of crashing on the NULL pointer access.

-- 
Elias Pschernig
Index: src/c/cdefs8.h
===================================================================
--- src/c/cdefs8.h	(revision 7510)
+++ src/c/cdefs8.h	(working copy)
@@ -37,7 +37,11 @@
 
 /* Blender for putpixel (DRAW_MODE_TRANS).  */
 #define PP_BLENDER             unsigned char*
+#ifdef DEBUGMODE
+#define MAKE_PP_BLENDER(c)     (!color_map && (al_assert(__FILE__, __LINE__), 0), (color_map->data[(c) & 0xFF]))
+#else
 #define MAKE_PP_BLENDER(c)     (color_map->data[(c) & 0xFF])
+#endif
 #define PP_BLEND(b,o,n)        ((b)[(o) & 0xFF])
 
 /* Blender for draw_trans_*_sprite.  */


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/