[AD] truecolor fonts

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


Truecolor font support was added recently and no wonder it is lacky.

The attached little patch fixes the problem when extracting font range or merging two truecolor fonts would result a 8-bit color font.

There is still a problem when merging a truecolor and non-truecolor font. Right now, it can result with a font with ranges of different color depth. It seems to work fine but the user wouldn't expect that. I also think we miss the userspace API to get font color depth, or at least something internal. is_color_font just isn't enough any more.

And I found this bugs just by lurking the code. You'll never be ready for a stable release :-P Just kidding, release it now.


--
Milan Mimica
http://sparklet.sf.net
--- src/font_old.c	2005-09-01 21:25:15.000000000 +0200
+++ src/font.c	2005-09-01 21:13:22.000000000 +0200
@@ -1171,7 +1171,7 @@ static FONT_COLOR_DATA *color_copy_glyph
    gl = newcf->bitmaps = _al_malloc(num * sizeof *gl);
    for (c=0; c<num; c++) {
       g = cf->bitmaps[begin - cf->begin + c];
-      gl[c] = create_bitmap_ex(8, g->w, g->h);
+      gl[c] = create_bitmap_ex(bitmap_color_depth(g), g->w, g->h);
       blit(g, gl[c], 0, 0, 0, 0, g->w, g->h);
    }
 


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