1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2010-10-10 23:15:05 +00:00
parent 752c91b50d
commit 8a0152bd4a
9 changed files with 47 additions and 14 deletions

View file

@ -81,6 +81,28 @@ static void lcd_gradient_rect(int x1, int x2, int y, unsigned h,
}
#endif
/*
* draws the borders of the viewport, or of current_vp if vp == NULL
**/
void LCDFN(draw_viewport)(const struct viewport *vp)
{
if (vp == NULL)
LCDFN(drawrect)(0, 0, current_vp->width, current_vp->height);
else
LCDFN(drawrect)(vp->x, vp->y, vp->width, vp->height);
}
/*
* fills the rectangle formed by vp or by current_vp if vp == NULL
**/
void LCDFN(fill_viewport)(const struct viewport *vp)
{
if (vp == NULL)
LCDFN(fillrect)(0, 0, current_vp->width, current_vp->height);
else
LCDFN(fillrect)(vp->x, vp->y, vp->width, vp->height);
}
/* put a string at a given pixel position, skipping first ofs pixel columns */
static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
{

View file

@ -178,6 +178,8 @@ extern void lcd_remote_hline(int x1, int x2, int y);
extern void lcd_remote_vline(int x, int y1, int y2);
extern void lcd_remote_drawrect(int x, int y, int width, int height);
extern void lcd_remote_fillrect(int x, int y, int width, int height);
extern void lcd_remote_draw_viewport(const struct viewport *vp);
extern void lcd_remote_fill_viewport(const struct viewport *vp);
extern void lcd_remote_bitmap_part(const fb_remote_data *src, int src_x,
int src_y, int stride, int x, int y,
int width, int height);

View file

@ -507,6 +507,8 @@ extern void lcd_hline(int x1, int x2, int y);
extern void lcd_vline(int x, int y1, int y2);
extern void lcd_drawrect(int x, int y, int width, int height);
extern void lcd_fillrect(int x, int y, int width, int height);
extern void lcd_draw_viewport(const struct viewport *vp);
extern void lcd_fill_viewport(const struct viewport *vp);
extern void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
int stride, int x, int y, int width, int height);
extern void lcd_bitmap(const fb_data *src, int x, int y, int width,