X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=gfx%2Ftext_format.c;h=54dab7c866e373e8c7a6d1c596237b50ace63aee;hb=c49c99e64ee64ad490b2aea2d6c6d8f9f6d225db;hp=e1452d8a0015f0f354d1f40c4b9c1b0e7b236ca9;hpb=c66da8dee53d20f2bc02267d798530f5fb1bf37f;p=bertos.git diff --git a/gfx/text_format.c b/gfx/text_format.c index e1452d8a..54dab7c8 100755 --- a/gfx/text_format.c +++ b/gfx/text_format.c @@ -15,6 +15,15 @@ /*#* *#* $Log$ + *#* Revision 1.8 2006/03/22 09:50:11 bernie + *#* Don't use C99 stuff. + *#* + *#* Revision 1.7 2006/03/20 17:51:55 bernie + *#* Cleanups. + *#* + *#* Revision 1.6 2006/03/13 02:05:54 bernie + *#* Mark slow paths as UNLIKELY. + *#* *#* Revision 1.5 2006/03/07 22:18:04 bernie *#* Correctly compute text width for prop fonts; Make styles a per-bitmap attribute. *#* @@ -196,8 +205,8 @@ int PGM_FUNC(text_xprintf)(struct Bitmap *bm, struct TextWidthData { - Bitmap *bitmap; - coord_t width; + Bitmap *bitmap; + coord_t width; }; /** @@ -219,9 +228,9 @@ static int text_charWidth(int c, struct TextWidthData *twd) coord_t glyph_width; - if (index < bm->font->first || index > bm->font->last) + if (UNLIKELY(!FONT_HAS_GLYPH(bm->font, index))) { - if ('?' >= bm->font->first && '?' <= bm->font->last) + if (!FONT_HAS_GLYPH(bm->font, '?')) index = '?'; else index = bm->font->first; @@ -261,7 +270,9 @@ int PGM_FUNC(text_vwidthf)( return PGM_FUNC(vsprintf)(NULL, fmt, ap) * bm->font->width; else { - struct TextWidthData twd = { bm, 0 }; + struct TextWidthData twd; + twd.bitmap = bm; + twd.width = 0; _formatted_write(fmt, (void (*)(char, void *))text_charWidth, &twd, ap); return twd.width; }