| [AD] crash in allegro wip (cvs of today) | 
[ Thread Index | 
Date Index
| More lists.liballeg.org/allegro-developers Archives
] 
This crash has been around for quite around, but I got to describe it
only today...
You get a sigsegv in linux (I don't know for other oses...) when
making a blit() call with a bitmap created in 8bpp (with
create_bitmap_ex) to a 16bpp screen.  I attach a modified version of
exmem.c to this email which demonstrates the problem.
Of course this problem does NOT occur with allegro 3.9.33.
/*
 *    Example program for the Allegro library, by Shawn Hargreaves.
 *
 *    This program demonstrates the use of memory bitmaps. It creates
 *    a small temporary bitmap in memory, draws some circles onto it,
 *    and then blits lots of copies of it onto the screen.
 */
#include "allegro.h"
int main()
{
   BITMAP *memory_bitmap;
   int x, y;
   allegro_init();
   install_keyboard(); 
   set_color_depth(16);
   set_gfx_mode(GFX_SAFE, 320, 200, 0, 0);
   set_palette(desktop_palette);
   /* make a memory bitmap sized 20x20 */
   memory_bitmap = create_bitmap_ex(8,20, 20);
   /* draw some circles onto it */
   clear(memory_bitmap);
   for (x=0; x<16; x++)
      circle(memory_bitmap, 10, 10, x, palette_color[x]);
   /* blit lots of copies of it onto the screen */
   acquire_screen();
   for (y=0; y<SCREEN_H; y+=20)
      for (x=0; x<SCREEN_W; x+=20)
	 blit(memory_bitmap, screen, 0, 0, x, y, 20, 20);
   release_screen();
   /* free the memory bitmap */
   destroy_bitmap(memory_bitmap);
   readkey();
   return 0;
}
END_OF_MAIN();