Add a center flag, next to the rtl flag, for viewports. That results in any text being drawn centered. It overrides the RTL flag if set.

Simplify splashes and time menu by using it.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23105 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-10-11 12:21:27 +00:00
parent e171294c1d
commit a79dc87761
5 changed files with 34 additions and 49 deletions

View file

@ -82,15 +82,20 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
unsigned short ch;
unsigned short *ucs;
struct font* pf = font_get(current_vp->font);
int vp_flags = current_vp->flags;
ucs = bidi_l2v(str, 1);
if (VP_IS_RTL(current_vp))
if ((vp_flags & VP_FLAG_ALIGNMENT_MASK) != 0)
{
int w;
LCDFN(getstringsize)(str, &w, NULL);
x = current_vp->width - w - x;
/* center takes precedence */
if (vp_flags & VP_FLAG_CENTER_ALIGN)
x = ((current_vp->width - w)/ 2) + x;
else
x = current_vp->width - w - x;
}
while ((ch = *ucs++) != 0 && x < current_vp->width)