diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-06 08:20:12 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-06 08:20:12 +0000 |
commit | fafd18c0f2cae9e47f7def42253ccf4a84bcbc37 (patch) | |
tree | 833506146a3257d1ca7477d14f9729848c66e3f2 /apps | |
parent | a1dfe6441d1fda2eedf492952d6180ebbf96482d (diff) |
Use pointer to viewport
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22980 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/screens.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/apps/screens.c b/apps/screens.c index 478338de55..5162cc4d14 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -544,10 +544,10 @@ bool set_time_screen(const char* title, struct tm *tm) unsigned int statusbar_height = 0; unsigned int separator_width, weekday_width; unsigned int prev_line_height; - static unsigned char daysinmonth[] = + static unsigned char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; unsigned char buffer[20]; - struct viewport vp[NB_SCREENS]; + struct viewport viewports[NB_SCREENS]; int nb_lines; /* 6 possible cursor possitions, 2 values stored for each: x, y */ @@ -602,17 +602,19 @@ bool set_time_screen(const char* title, struct tm *tm) FOR_NB_SCREENS(s) { - viewport_set_defaults(&vp[s], s); - screens[s].set_viewport(&vp[s]); - nb_lines = viewport_get_nb_lines(&vp[s]); - + struct viewport *vp = &viewports[s]; + + viewport_set_defaults(vp, s); + screens[s].set_viewport(vp); + nb_lines = viewport_get_nb_lines(vp); + /* minimum lines needed is 2 + title line */ if (nb_lines < 4) { - vp[s].font = FONT_SYSFIXED; - nb_lines = viewport_get_nb_lines(&vp[s]); + vp->font = FONT_SYSFIXED; + nb_lines = viewport_get_nb_lines(vp); } - + /* recalculate the positions and offsets */ if (nb_lines >= 3) screens[s].getstringsize(title, NULL, &prev_line_height); @@ -640,7 +642,7 @@ bool set_time_screen(const char* title, struct tm *tm) } /* draw the screen */ - screens[s].set_viewport(&vp[s]); + screens[s].set_viewport(vp); screens[s].clear_viewport(); /* display the screen title */ screens[s].puts_scroll(0, 0, title); @@ -656,12 +658,12 @@ bool set_time_screen(const char* title, struct tm *tm) for(i=0; i<6; i++) { if (cursorpos == (int)i) - vp[s].drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); + vp->drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); - screens[s].putsxy(cursor[i][INDEX_X], + screens[s].putsxy(cursor[i][INDEX_X], cursor[i][INDEX_Y], ptr[i]); - vp[s].drawmode = DRMODE_SOLID; + vp->drawmode = DRMODE_SOLID; screens[s].putsxy(cursor[i/4 +1][INDEX_X] - separator_width, cursor[0][INDEX_Y], SEPARATOR); |