Re: [AD] Bug with transparent ellipses

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


On Sun, 2006-09-03 at 15:42 -0600, Trent Gamblin wrote:
> The following code segfaults in Linux with 4.2.0:
> 
> #include <allegro.h>
> 
> int main(void)
> {
>     allegro_init();
>     set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
>     BITMAP* bmp = create_bitmap(640, 480);
>     drawing_mode(DRAW_MODE_TRANS, 0, 0, 0);
>     ellipsefill(bmp, 0, 0, 10, 10, 0);
>     drawing_mode(DRAW_MODE_SOLID, 0, 0, 0);
>     destroy_bitmap(bmp);
>     allegro_exit();
>     return 0;
> }
> 
> 
> It looks like Allegro is not doing bounds checking, but it works fine if 
> you remove
> the drawing_mode calls. I haven't tested with other primitives. Also 
> haven't tried this
> 4.3 so this may be fixed already.
> 

The docs say this:
"In DRAW_MODE_TRANS, the global color_map table or truecolor blender
functions are used to overlay pixels on top of the existing image. This
must only be used after you have set up the color mapping table (for 256
color modes) or blender functions (for truecolor modes). Because it
involves reading as well as writing the bitmap memory, translucent
drawing is very slow if you draw directly to video RAM, so wherever
possible you should use a memory bitmap instead."

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.

-- 
Elias Pschernig





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