Re: [AD] minor issues

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


Chris wrote:

Milan Mimica wrote:

sure, it's:
memset(bmp->line[0], 0, bitmap_color_depth(bmp) / CHAR_BITS * bmp->w * bmp->h);


Actually:

memset(bmp->line[0], 0, (bitmap_color_depth(bmp)+7) / 8 * bmp->w * bmp->h);


There's a BYTES_PER_PIXEL() macro in internal/aintern.h. I don't remember if it's possible for a stride (i.e. bmp->line[1] - bmp->line[0]) to be different from BYTES_PER_PIXEL(bpp) * bmp->w in Allegro.

Peter




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