summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-10-01 23:56:57 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-10-09 22:07:49 +0100
commitf8e968991d0d94e3b1c5c5611c3d69a9c032d7da (patch)
tree2bb2d70d7d0cf3d2c16f65fe54e4d888a34e6875
parenteaccdeeae2ff57efe1859ba80b7558b328e16a10 (diff)
downloadrockbox-f8e968991d.tar.gz
rockbox-f8e968991d.zip
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
-rw-r--r--firmware/drivers/lcd-1bit-vert.c37
-rw-r--r--firmware/drivers/lcd-2bit-horz.c42
-rw-r--r--firmware/drivers/lcd-2bit-vert.c42
-rw-r--r--firmware/drivers/lcd-2bit-vi.c42
-rw-r--r--firmware/drivers/lcd-bitmap-common.c46
-rw-r--r--firmware/drivers/lcd-color-common.c41
6 files changed, 46 insertions, 204 deletions
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index ed66ee7e0c..9c69b82e51 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -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 ***/
static void setpixel(int x, int y)
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index 1b192377f6..cf7e20d4a8 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -105,16 +105,6 @@ void lcd_init(void)
/*** 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)
{
lcd_current_viewport->fg_pattern = brightness;
@@ -137,38 +127,6 @@ unsigned lcd_get_background(void)
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 ***/
static void setpixel(int x, int y)
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c
index 9e1eb0ed37..c4bdba67cb 100644
--- a/firmware/drivers/lcd-2bit-vert.c
+++ b/firmware/drivers/lcd-2bit-vert.c
@@ -107,16 +107,6 @@ void lcd_init(void)
/*** 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)
{
lcd_current_viewport->fg_pattern = brightness;
@@ -139,38 +129,6 @@ unsigned lcd_get_background(void)
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 ***/
static void setpixel(int x, int y)
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c
index 976af8f62d..99bd32c77b 100644
--- a/firmware/drivers/lcd-2bit-vi.c
+++ b/firmware/drivers/lcd-2bit-vi.c
@@ -136,16 +136,6 @@ unsigned lcd_remote_color_to_native(unsigned color)
}
#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)
{
CURRENT_VP->fg_pattern = brightness;
@@ -168,38 +158,6 @@ unsigned LCDFN(get_background)(void)
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 ***/
static void setpixel(int x, int y)
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index cc42248b2d..6a3fd5f825 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -164,6 +164,52 @@ static bool LCDFN(clip_viewport_rect)(int *x, int *y, int *width, int *height,
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
**/
diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c
index a1d2f47c22..cce0bbbf4e 100644
--- a/firmware/drivers/lcd-color-common.c
+++ b/firmware/drivers/lcd-color-common.c
@@ -111,16 +111,6 @@ void lcd_clear_display(void)
/*** 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)
{
lcd_current_viewport->fg_pattern = color;
@@ -141,37 +131,6 @@ unsigned lcd_get_background(void)
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)
{