[AD] [BUG] textprintf in 24 bpp

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


I have found a bug that occurs when Allegro is compiled without ASM
support (./configure --disable-asm) : if you try to print a text with a
colored font using textprintf on a 24 bpp BITMAP then the result is
wrong. I have attached a small example (text.c) with this mail (it uses
a FONT from 'demo.dat').
Notice that it works fine if the lib is compiled with ASM support but
gives a wrong result if the lib is compiled in "pure" C (each character
is stretched and drawn three times).

	Bertrand.
#include <allegro.h>

void main(void)
{
   DATAFILE *dat;
   BITMAP *bmp16, *bmp24;
   
   allegro_init();
   install_keyboard();
   set_color_depth(16);
   set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
   
   dat = load_datafile_object("demo.dat", "TITLE_PAL");
   set_palette((RGB *)dat->dat);
   unload_datafile_object(dat);
   dat = load_datafile_object("demo.dat", "TITLE_FONT");
   
   /* Print the text in 16 bpp */
   bmp16 = create_bitmap_ex(16, 320, 200);
   textprintf(bmp16, (FONT *)dat->dat, 10, 10, -1, "ABCDEFGH");
   blit(bmp16, screen, 0,0,0,0,320,50);

   /* Print the text in 24 bpp */
   bmp24 = create_bitmap_ex(24, 320, 200);
   textprintf(bmp24, (FONT *)dat->dat, 10, 10, -1, "ABCDEFGH");
   blit(bmp24, screen, 0,0,0,51,320,50);

   while (!key[KEY_ESC]) {}
}
END_OF_MAIN();


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