summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-07 22:14:41 +0100
committerThomas Martitz <kugel@rockbox.org>2014-01-07 22:14:41 +0100
commitd146970ca1e5c9b0641301d50823d29b2e25c9e4 (patch)
tree30f738042a8d81e9336b594d1d52ec75e428d3b2 /apps/plugins/lib
parente1c7b3b8f72becc9079c04253a2985f577850a48 (diff)
downloadrockbox-d146970ca1e5c9b0641301d50823d29b2e25c9e4.zip
rockbox-d146970ca1e5c9b0641301d50823d29b2e25c9e4.tar.gz
rockbox-d146970ca1e5c9b0641301d50823d29b2e25c9e4.tar.bz2
rockbox-d146970ca1e5c9b0641301d50823d29b2e25c9e4.tar.xz
lcd/grey: Enable viewport fg_pattern and bg_pattern for all bitmap targets.
Greylib performed a horrible hack and stored fg and bg patterns in other struct viewport fields. One of them was just removed. So instead of this hack simply enable the *_pattern fields for mono targets as well, so that greylib can use them normally. Change-Id: Ib0842ebcc97f5bf9d9382b4471903afa2f96f39f
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/grey.h4
-rw-r--r--apps/plugins/lib/grey_draw.c25
-rw-r--r--apps/plugins/lib/grey_parm.c13
-rw-r--r--apps/plugins/lib/grey_scroll.c24
4 files changed, 26 insertions, 40 deletions
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index d63d19e..63e896b 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -198,10 +198,6 @@ struct _grey_info
struct viewport *vp; /* current viewport in use */
};
-/* Stuff these here for now. LCD depth of 1 has no 'pattern' members. */
-#define _GREY_FG_BRIGHTNESS(vp) ((vp)->flags)
-#define _GREY_BG_BRIGHTNESS(vp) ((vp)->line_height)
-
/* Global variable, defined in the plugin */
extern struct _grey_info _grey_info;
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c
index 171d273..64dabc2 100644
--- a/apps/plugins/lib/grey_draw.c
+++ b/apps/plugins/lib/grey_draw.c
@@ -34,12 +34,12 @@ extern struct viewport _grey_default_vp;
static void setpixel(unsigned char *address)
{
- *address = _GREY_FG_BRIGHTNESS(_grey_info.vp);
+ *address = _grey_info.vp->fg_pattern;
}
static void clearpixel(unsigned char *address)
{
- *address = _GREY_BG_BRIGHTNESS(_grey_info.vp);
+ *address = _grey_info.vp->bg_pattern;
}
static void flippixel(unsigned char *address)
@@ -75,7 +75,7 @@ void grey_clear_display(void)
struct viewport *vp = &_grey_default_vp;
int value = (vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
+ vp->fg_pattern : vp->bg_pattern;
rb->memset(_grey_info.curbuffer, value,
_GREY_MULUQ(_grey_info.cb_width, _grey_info.cb_height));
@@ -207,7 +207,7 @@ void grey_hline(int x1, int x2, int y)
if (vp->drawmode & DRMODE_BG)
{
fillopt = true;
- value = _GREY_BG_BRIGHTNESS(vp);
+ value = vp->bg_pattern;
}
}
else
@@ -215,7 +215,7 @@ void grey_hline(int x1, int x2, int y)
if (vp->drawmode & DRMODE_FG)
{
fillopt = true;
- value = _GREY_FG_BRIGHTNESS(vp);
+ value = vp->fg_pattern;
}
}
if (!fillopt && vp->drawmode != DRMODE_COMPLEMENT)
@@ -386,7 +386,7 @@ void grey_fillrect(int x, int y, int width, int height)
if (vp->drawmode & DRMODE_BG)
{
fillopt = true;
- value = _GREY_BG_BRIGHTNESS(vp);
+ value = vp->bg_pattern;
}
}
else
@@ -394,7 +394,7 @@ void grey_fillrect(int x, int y, int width, int height)
if (vp->drawmode & DRMODE_FG)
{
fillopt = true;
- value = _GREY_FG_BRIGHTNESS(vp);
+ value = vp->fg_pattern;
}
}
@@ -544,7 +544,7 @@ void grey_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
break;
case DRMODE_BG:
- bg = _GREY_BG_BRIGHTNESS(vp);
+ bg = vp->bg_pattern;
do
{
if (!(data & 0x01))
@@ -557,7 +557,7 @@ void grey_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
break;
case DRMODE_FG:
- fg = _GREY_FG_BRIGHTNESS(vp);
+ fg = vp->fg_pattern;
do
{
if (data & 0x01)
@@ -570,8 +570,8 @@ void grey_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
break;
case DRMODE_SOLID:
- fg = _GREY_FG_BRIGHTNESS(vp);
- bg = _GREY_BG_BRIGHTNESS(vp);
+ fg = vp->fg_pattern;
+ bg = vp->bg_pattern;
do
{
*dst_col = (data & 0x01) ? fg : bg;
@@ -699,8 +699,7 @@ void grey_ub_clear_display(void)
{
struct viewport *vp = &_grey_default_vp;
int value = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) :
- _GREY_BG_BRIGHTNESS(vp)];
+ vp->fg_pattern : vp->bg_pattern];
rb->memset(_grey_info.values, value,
_GREY_MULUQ(_grey_info.width, _grey_info.height));
diff --git a/apps/plugins/lib/grey_parm.c b/apps/plugins/lib/grey_parm.c
index 9b4ba8c..d2dfde4 100644
--- a/apps/plugins/lib/grey_parm.c
+++ b/apps/plugins/lib/grey_parm.c
@@ -79,25 +79,25 @@ int grey_get_drawmode(void)
/* Set the foreground shade for subsequent drawing operations */
void grey_set_foreground(unsigned brightness)
{
- _GREY_FG_BRIGHTNESS(_grey_info.vp) = brightness;
+ _grey_info.vp->fg_pattern = brightness;
}
/* Return the current foreground shade */
unsigned grey_get_foreground(void)
{
- return _GREY_FG_BRIGHTNESS(_grey_info.vp);
+ return _grey_info.vp->fg_pattern;
}
/* Set the background shade for subsequent drawing operations */
void grey_set_background(unsigned brightness)
{
- _GREY_BG_BRIGHTNESS(_grey_info.vp) = brightness;
+ _grey_info.vp->bg_pattern = brightness;
}
/* Return the current background shade */
unsigned grey_get_background(void)
{
- return _GREY_BG_BRIGHTNESS(_grey_info.vp);
+ return _grey_info.vp->bg_pattern;
}
/* Set draw mode, foreground and background shades at once */
@@ -177,8 +177,8 @@ void grey_viewport_set_fullscreen(struct viewport *vp,
vp->y = 0;
vp->width = _grey_info.width;
vp->height = _grey_info.height;
- _GREY_FG_BRIGHTNESS(vp) = 0;
- _GREY_BG_BRIGHTNESS(vp) = 255;
+ vp->fg_pattern = 0;
+ vp->bg_pattern = 255;
vp->drawmode = DRMODE_SOLID;
vp->font = FONT_SYSFIXED;
@@ -258,4 +258,3 @@ void grey_framebuffer_set_pos(int x, int y, int width, int height)
grey_update_clip_rect();
}
-
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c
index 78e5725..a9ce45d 100644
--- a/apps/plugins/lib/grey_scroll.c
+++ b/apps/plugins/lib/grey_scroll.c
@@ -48,8 +48,7 @@ void grey_scroll_left(int count)
data = _grey_info.buffer;
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = _grey_info.width - count;
- blank = (vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern;
do
{
@@ -77,8 +76,7 @@ void grey_scroll_right(int count)
data = _grey_info.buffer;
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = _grey_info.width - count;
- blank = (vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern;
do
{
@@ -104,8 +102,7 @@ void grey_scroll_up(int count)
shift = _GREY_MULUQ(_grey_info.width, count);
length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
- blank = (vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern;
rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
length);
@@ -127,8 +124,7 @@ void grey_scroll_down(int count)
shift = _GREY_MULUQ(_grey_info.width, count);
length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
- blank = (vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern;
rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
length);
@@ -155,8 +151,7 @@ void grey_ub_scroll_left(int count)
length = (_grey_info.width - count) << _GREY_BSHIFT;
count <<= _GREY_BSHIFT;
blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) :
- _GREY_BG_BRIGHTNESS(vp)];
+ vp->fg_pattern : vp->bg_pattern];
do
{
rb->memmove(data, data + count, length);
@@ -189,8 +184,7 @@ void grey_ub_scroll_right(int count)
length = (_grey_info.width - count) << _GREY_BSHIFT;
count <<= _GREY_BSHIFT;
blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) :
- _GREY_BG_BRIGHTNESS(vp)];
+ vp->fg_pattern : vp->bg_pattern];
do
{
rb->memmove(data + count, data, length);
@@ -220,8 +214,7 @@ void grey_ub_scroll_up(int count)
dst = _grey_info.values;
end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width);
blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) :
- _GREY_BG_BRIGHTNESS(vp)];
+ vp->fg_pattern : vp->bg_pattern];
#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \
|| (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
@@ -296,8 +289,7 @@ void grey_ub_scroll_down(int count)
start = _grey_info.values;
dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width);
blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
- _GREY_FG_BRIGHTNESS(vp) :
- _GREY_BG_BRIGHTNESS(vp)];
+ vp->fg_pattern : vp->bg_pattern];
#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \
|| (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)