[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] truecolor fonts
- From: Milan Mimica <milan.mimica@xxxxxxxxxx>
- Date: Mon, 27 Mar 2006 21:41:17 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type; b=IjM4qO7Z8otwVVIVFNRdmzHT8WWW98MBOmLb4l7N401rVMCyl6ma5MmTZFIbiknHOtKA6mrAkqJtg3RqhUSWuVarzI32zFFmuPDZsHWSp7/W61SkBhITuxQHpzMXMEvXeqng0AVKJGMFNuyhBVV5NJKaXSgQ6Ca3u0Rl55iYEdM=
Peter Hull wrote:
In this part:
+
+ if (fad->format == GL_RGBA) {
+ clear_to_color(bmp, bitmap_mask_color(bmp));
+ }
+ else {
+ clear_bitmap(bmp);
+ }
Would just
+ clear_to_color(bmp, bitmap_mask_color(bmp));
work?
No. Paletted color fonts use 24 bitmaps.
Regardless of this, attached a patch some corrections.
--
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 19:39:16 -0000
@@ -389,7 +389,13 @@ static FONT_AGL_DATA* copy_glyph_range(F
free(coords);
return NULL;
}
- clear_bitmap(bmp);
+
+ if (fad->format == GL_RGBA8) {
+ 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);
@@ -1818,6 +1842,9 @@ static int aglf_check_texture(BITMAP *bm
|| format == 1) {
flags |= AGL_TEXTURE_ALPHA_ONLY;
}
+
+ if (format == GL_RGBA8)
+ flags |= AGL_TEXTURE_MASKED;
return allegro_gl_check_texture_ex(flags, bmp, format);
}
@@ -1837,7 +1864,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);
TRACE("* Texture ID is: %u\n", texture);