From d146970ca1e5c9b0641301d50823d29b2e25c9e4 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 7 Jan 2014 22:14:41 +0100 Subject: 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 --- apps/plugins/lib/grey_draw.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'apps/plugins/lib/grey_draw.c') diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c index 171d2734cf..64dabc2fb3 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)); -- cgit v1.2.3