diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2010-10-10 23:15:05 +0000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2010-10-10 23:15:05 +0000 |
| commit | 8a0152bd4ae638c1fe4917b855fcb9fc6a15202c (patch) | |
| tree | 7a3a81bf30d49a3c072d89485f79207bc7d2c29e /apps/gui | |
| parent | 752c91b50dcf36e4476cf89cceb6493e2fd4c586 (diff) | |
| download | rockbox-8a0152bd4ae638c1fe4917b855fcb9fc6a15202c.zip rockbox-8a0152bd4ae638c1fe4917b855fcb9fc6a15202c.tar.gz rockbox-8a0152bd4ae638c1fe4917b855fcb9fc6a15202c.tar.bz2 rockbox-8a0152bd4ae638c1fe4917b855fcb9fc6a15202c.tar.xz | |
Two new lcd/multi screen api convinience functions: draw_viewport(), fill_viewport().
They work as the drawrect/fillrect pendants but work on a viewport basis; pass NULL to draw the current viewport (the one set with set_viewport()).
In conjunction with action_get_touchscreen_press_in_vp() it should be less of a pain to draw buttons and get presses on them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28239 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
| -rw-r--r-- | apps/gui/buttonbar.c | 5 | ||||
| -rw-r--r-- | apps/gui/splash.c | 4 | ||||
| -rw-r--r-- | apps/gui/statusbar.c | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/apps/gui/buttonbar.c b/apps/gui/buttonbar.c index 84d4946..db94362 100644 --- a/apps/gui/buttonbar.c +++ b/apps/gui/buttonbar.c @@ -66,16 +66,17 @@ static void gui_buttonbar_draw_button(struct gui_buttonbar * buttonbar, int num) struct viewport vp = bb_vp[display->screen_type]; button_width = display->lcdwidth/BUTTONBAR_MAX_BUTTONS; - vp.width = button_width; + vp.width = button_width-1; vp.x = button_width * num; display->set_viewport(&vp); - display->fillrect(0, 0, button_width - 1, vp.height); + display->fill_viewport(NULL); if(buttonbar->caption[num][0] != 0) { display->getstringsize(buttonbar->caption[num], &fw, &fh); display->putsxy((button_width - fw)/2, (vp.height-fh)/2, buttonbar->caption[num]); } + display->set_viewport(NULL); } void gui_buttonbar_set(struct gui_buttonbar * buttonbar, diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 10dee12..8c5f57f 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -163,7 +163,7 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap) #endif vp.drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); - screen->fillrect(0, 0, vp.width, vp.height); + screen->fill_viewport(NULL); #if LCD_DEPTH > 1 if (screen->depth > 1) @@ -174,7 +174,7 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap) #endif vp.drawmode = DRMODE_SOLID; - screen->drawrect(0, 0, vp.width, vp.height); + screen->draw_viewport(NULL); /* prepare putting the text */ y = RECT_SPACING; diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 73ccfa7..a05a11a 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -280,7 +280,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw, struct vi { display->set_viewport(vp); display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); - display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); + display->fill_viewport(NULL); display->set_drawmode(DRMODE_SOLID); if (bar->info.battery_state) |