forked from len0rd/rockbox
lcd: Move parameter handling calls to lcd-bitmap-common.c
No need to reimplement the same drawmode, getwidth, etc, calls for each pixel format. Change-Id: Ibbe32814f72e1492c190ba578cec303c1cf29b12
This commit is contained in:
parent
eaccdeeae2
commit
f8e968991d
6 changed files with 46 additions and 204 deletions
|
@ -108,43 +108,6 @@ void LCDFN(init)(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** parameter handling ***/
|
|
||||||
|
|
||||||
void LCDFN(set_drawmode)(int mode)
|
|
||||||
{
|
|
||||||
CURRENT_VP->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(get_drawmode)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->drawmode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getwidth)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getheight)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LCDFN(setfont)(int newfont)
|
|
||||||
{
|
|
||||||
CURRENT_VP->font = newfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getfont)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->font;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
|
|
||||||
{
|
|
||||||
return font_getstringsize(str, w, h, CURRENT_VP->font);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** low-level drawing functions ***/
|
/*** low-level drawing functions ***/
|
||||||
|
|
||||||
static void setpixel(int x, int y)
|
static void setpixel(int x, int y)
|
||||||
|
|
|
@ -105,16 +105,6 @@ void lcd_init(void)
|
||||||
|
|
||||||
/*** parameter handling ***/
|
/*** parameter handling ***/
|
||||||
|
|
||||||
void lcd_set_drawmode(int mode)
|
|
||||||
{
|
|
||||||
lcd_current_viewport->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_get_drawmode(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->drawmode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_set_foreground(unsigned brightness)
|
void lcd_set_foreground(unsigned brightness)
|
||||||
{
|
{
|
||||||
lcd_current_viewport->fg_pattern = brightness;
|
lcd_current_viewport->fg_pattern = brightness;
|
||||||
|
@ -137,38 +127,6 @@ unsigned lcd_get_background(void)
|
||||||
return lcd_current_viewport->bg_pattern;
|
return lcd_current_viewport->bg_pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness)
|
|
||||||
{
|
|
||||||
lcd_set_drawmode(mode);
|
|
||||||
lcd_set_foreground(fg_brightness);
|
|
||||||
lcd_set_background(bg_brightness);
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getwidth(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getheight(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_setfont(int newfont)
|
|
||||||
{
|
|
||||||
lcd_current_viewport->font = newfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getfont(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->font;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getstringsize(const unsigned char *str, int *w, int *h)
|
|
||||||
{
|
|
||||||
return font_getstringsize(str, w, h, lcd_current_viewport->font);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** low-level drawing functions ***/
|
/*** low-level drawing functions ***/
|
||||||
|
|
||||||
static void setpixel(int x, int y)
|
static void setpixel(int x, int y)
|
||||||
|
|
|
@ -107,16 +107,6 @@ void lcd_init(void)
|
||||||
|
|
||||||
/*** parameter handling ***/
|
/*** parameter handling ***/
|
||||||
|
|
||||||
void lcd_set_drawmode(int mode)
|
|
||||||
{
|
|
||||||
lcd_current_viewport->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_get_drawmode(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->drawmode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_set_foreground(unsigned brightness)
|
void lcd_set_foreground(unsigned brightness)
|
||||||
{
|
{
|
||||||
lcd_current_viewport->fg_pattern = brightness;
|
lcd_current_viewport->fg_pattern = brightness;
|
||||||
|
@ -139,38 +129,6 @@ unsigned lcd_get_background(void)
|
||||||
return lcd_current_viewport->bg_pattern;
|
return lcd_current_viewport->bg_pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness)
|
|
||||||
{
|
|
||||||
lcd_set_drawmode(mode);
|
|
||||||
lcd_set_foreground(fg_brightness);
|
|
||||||
lcd_set_background(bg_brightness);
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getwidth(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getheight(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_setfont(int newfont)
|
|
||||||
{
|
|
||||||
lcd_current_viewport->font = newfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getfont(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->font;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getstringsize(const unsigned char *str, int *w, int *h)
|
|
||||||
{
|
|
||||||
return font_getstringsize(str, w, h, lcd_current_viewport->font);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** low-level drawing functions ***/
|
/*** low-level drawing functions ***/
|
||||||
|
|
||||||
static void setpixel(int x, int y)
|
static void setpixel(int x, int y)
|
||||||
|
|
|
@ -136,16 +136,6 @@ unsigned lcd_remote_color_to_native(unsigned color)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void LCDFN(set_drawmode)(int mode)
|
|
||||||
{
|
|
||||||
CURRENT_VP->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(get_drawmode)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->drawmode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LCDFN(set_foreground)(unsigned brightness)
|
void LCDFN(set_foreground)(unsigned brightness)
|
||||||
{
|
{
|
||||||
CURRENT_VP->fg_pattern = brightness;
|
CURRENT_VP->fg_pattern = brightness;
|
||||||
|
@ -168,38 +158,6 @@ unsigned LCDFN(get_background)(void)
|
||||||
return CURRENT_VP->bg_pattern;
|
return CURRENT_VP->bg_pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LCDFN(set_drawinfo)(int mode, unsigned fg_brightness,
|
|
||||||
unsigned bg_brightness)
|
|
||||||
{
|
|
||||||
LCDFN(set_drawmode)(mode);
|
|
||||||
LCDFN(set_foreground)(fg_brightness);
|
|
||||||
LCDFN(set_background)(bg_brightness);
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getwidth)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getheight)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->height;
|
|
||||||
}
|
|
||||||
void LCDFN(setfont)(int newfont)
|
|
||||||
{
|
|
||||||
CURRENT_VP->font = newfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getfont)(void)
|
|
||||||
{
|
|
||||||
return CURRENT_VP->font;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
|
|
||||||
{
|
|
||||||
return font_getstringsize(str, w, h, CURRENT_VP->font);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** low-level drawing functions ***/
|
/*** low-level drawing functions ***/
|
||||||
|
|
||||||
static void setpixel(int x, int y)
|
static void setpixel(int x, int y)
|
||||||
|
|
|
@ -164,6 +164,52 @@ static bool LCDFN(clip_viewport_rect)(int *x, int *y, int *width, int *height,
|
||||||
return *width > 0 && *height > 0;
|
return *width > 0 && *height > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*** parameter handling ***/
|
||||||
|
|
||||||
|
void LCDFN(set_drawmode)(int mode)
|
||||||
|
{
|
||||||
|
LCDFN(current_viewport)->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||||
|
}
|
||||||
|
|
||||||
|
int LCDFN(get_drawmode)(void)
|
||||||
|
{
|
||||||
|
return LCDFN(current_viewport)->drawmode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LCDFN(getwidth)(void)
|
||||||
|
{
|
||||||
|
return LCDFN(current_viewport)->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LCDFN(getheight)(void)
|
||||||
|
{
|
||||||
|
return LCDFN(current_viewport)->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LCDFN(setfont)(int newfont)
|
||||||
|
{
|
||||||
|
LCDFN(current_viewport)->font = newfont;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LCDFN(getfont)(void)
|
||||||
|
{
|
||||||
|
return LCDFN(current_viewport)->font;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
|
||||||
|
{
|
||||||
|
return font_getstringsize(str, w, h, LCDFN(current_viewport)->font);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if LCDM(DEPTH) > 1
|
||||||
|
void LCDFN(set_drawinfo)(int mode, unsigned foreground, unsigned background)
|
||||||
|
{
|
||||||
|
LCDFN(set_drawmode)(mode);
|
||||||
|
LCDFN(set_foreground)(foreground);
|
||||||
|
LCDFN(set_background)(background);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* draws the borders of the current viewport
|
* draws the borders of the current viewport
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -111,16 +111,6 @@ void lcd_clear_display(void)
|
||||||
|
|
||||||
/*** parameter handling ***/
|
/*** parameter handling ***/
|
||||||
|
|
||||||
void lcd_set_drawmode(int mode)
|
|
||||||
{
|
|
||||||
lcd_current_viewport->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_get_drawmode(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->drawmode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_set_foreground(unsigned color)
|
void lcd_set_foreground(unsigned color)
|
||||||
{
|
{
|
||||||
lcd_current_viewport->fg_pattern = color;
|
lcd_current_viewport->fg_pattern = color;
|
||||||
|
@ -141,37 +131,6 @@ unsigned lcd_get_background(void)
|
||||||
return lcd_current_viewport->bg_pattern;
|
return lcd_current_viewport->bg_pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color)
|
|
||||||
{
|
|
||||||
lcd_set_drawmode(mode);
|
|
||||||
lcd_current_viewport->fg_pattern = fg_color;
|
|
||||||
lcd_current_viewport->bg_pattern = bg_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getwidth(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getheight(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_setfont(int newfont)
|
|
||||||
{
|
|
||||||
lcd_current_viewport->font = newfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getfont(void)
|
|
||||||
{
|
|
||||||
return lcd_current_viewport->font;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lcd_getstringsize(const unsigned char *str, int *w, int *h)
|
|
||||||
{
|
|
||||||
return font_getstringsize(str, w, h, lcd_current_viewport->font);
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_set_backdrop(fb_data* backdrop)
|
void lcd_set_backdrop(fb_data* backdrop)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue