projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add demo application.
[bertos.git]
/
gfx
/
text_format.c
diff --git
a/gfx/text_format.c
b/gfx/text_format.c
index e1452d8a0015f0f354d1f40c4b9c1b0e7b236ca9..54dab7c866e373e8c7a6d1c596237b50ace63aee 100755
(executable)
--- a/
gfx/text_format.c
+++ b/
gfx/text_format.c
@@
-15,6
+15,15
@@
/*#*
*#* $Log$
/*#*
*#* $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.
*#*
*#* 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
{
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;
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;
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
{
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;
}
_formatted_write(fmt, (void (*)(char, void *))text_charWidth, &twd, ap);
return twd.width;
}