[AD] truecolor fonts

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


This one fixes truecolor fonts displaying. Based on some patch from Elias.


--
Milan Mimica
http://sparklet.sf.net
Index: src/fontconv.c
===================================================================
RCS file: /cvsroot/allegrogl/alleggl/src/fontconv.c,v
retrieving revision 1.39
diff -u -p -r1.39 fontconv.c
--- src/fontconv.c	21 Jan 2006 16:43:35 -0000	1.39
+++ src/fontconv.c	27 Mar 2006 16:56:54 -0000
@@ -389,7 +389,13 @@ static FONT_AGL_DATA* copy_glyph_range(F
 		free(coords);
 		return NULL;
 	}
-	clear_bitmap(bmp);
+	
+	if (fad->format == GL_RGBA) {
+		clear_to_color(bmp, bitmap_mask_color(bmp));
+	}
+	else {
+		clear_bitmap(bmp);
+	}
 
 	/* blit every glyph from the range to the new bitmap */				
 	w = 0;
@@ -1525,7 +1525,12 @@ static int draw_glyphs(BITMAP *bmp, FONT
 		destroy_bitmap(rgbbmp);
 	}
 	else {
-		clear_bitmap(bmp);	
+		if (format == GL_RGBA8) {
+			clear_to_color(bmp, bitmap_mask_color(bmp));
+		}
+		else {
+			clear_bitmap(bmp);	
+		}
 
 		for (i = 0; i < end - beg; i++) {
 			usetc(buf + usetc(buf, glyphs[i].glyph_num + beg), 0);
@@ -1837,6 +1861,10 @@ static GLuint aglf_upload_texture(BITMAP
 	 || format == 1) {
 		flags |= AGL_TEXTURE_ALPHA_ONLY;
 	}
+	
+	if (format == GL_RGBA8)
+		flags |= AGL_TEXTURE_MASKED;
+	 
 
 	TRACE("* Want texture format: 0x%x\n", format);
 	texture = allegro_gl_make_texture_ex(flags, bmp, format);


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