summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/grey_draw.c
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/grey_draw.c
parente1c7b3b8f72becc9079c04253a2985f577850a48 (diff)
downloadrockbox-d146970ca1e5c9b0641301d50823d29b2e25c9e4.tar.gz
rockbox-d146970ca1e5c9b0641301d50823d29b2e25c9e4.zip
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/grey_draw.c')
-rw-r--r--apps/plugins/lib/grey_draw.c25
1 files changed, 12 insertions, 13 deletions
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;
34 34
35static void setpixel(unsigned char *address) 35static void setpixel(unsigned char *address)
36{ 36{
37 *address = _GREY_FG_BRIGHTNESS(_grey_info.vp); 37 *address = _grey_info.vp->fg_pattern;
38} 38}
39 39
40static void clearpixel(unsigned char *address) 40static void clearpixel(unsigned char *address)
41{ 41{
42 *address = _GREY_BG_BRIGHTNESS(_grey_info.vp); 42 *address = _grey_info.vp->bg_pattern;
43} 43}
44 44
45static void flippixel(unsigned char *address) 45static void flippixel(unsigned char *address)
@@ -75,7 +75,7 @@ void grey_clear_display(void)
75 struct viewport *vp = &_grey_default_vp; 75 struct viewport *vp = &_grey_default_vp;
76 76
77 int value = (vp->drawmode & DRMODE_INVERSEVID) ? 77 int value = (vp->drawmode & DRMODE_INVERSEVID) ?
78 _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); 78 vp->fg_pattern : vp->bg_pattern;
79 79
80 rb->memset(_grey_info.curbuffer, value, 80 rb->memset(_grey_info.curbuffer, value,
81 _GREY_MULUQ(_grey_info.cb_width, _grey_info.cb_height)); 81 _GREY_MULUQ(_grey_info.cb_width, _grey_info.cb_height));
@@ -207,7 +207,7 @@ void grey_hline(int x1, int x2, int y)
207 if (vp->drawmode & DRMODE_BG) 207 if (vp->drawmode & DRMODE_BG)
208 { 208 {
209 fillopt = true; 209 fillopt = true;
210 value = _GREY_BG_BRIGHTNESS(vp); 210 value = vp->bg_pattern;
211 } 211 }
212 } 212 }
213 else 213 else
@@ -215,7 +215,7 @@ void grey_hline(int x1, int x2, int y)
215 if (vp->drawmode & DRMODE_FG) 215 if (vp->drawmode & DRMODE_FG)
216 { 216 {
217 fillopt = true; 217 fillopt = true;
218 value = _GREY_FG_BRIGHTNESS(vp); 218 value = vp->fg_pattern;
219 } 219 }
220 } 220 }
221 if (!fillopt && vp->drawmode != DRMODE_COMPLEMENT) 221 if (!fillopt && vp->drawmode != DRMODE_COMPLEMENT)
@@ -386,7 +386,7 @@ void grey_fillrect(int x, int y, int width, int height)
386 if (vp->drawmode & DRMODE_BG) 386 if (vp->drawmode & DRMODE_BG)
387 { 387 {
388 fillopt = true; 388 fillopt = true;
389 value = _GREY_BG_BRIGHTNESS(vp); 389 value = vp->bg_pattern;
390 } 390 }
391 } 391 }
392 else 392 else
@@ -394,7 +394,7 @@ void grey_fillrect(int x, int y, int width, int height)
394 if (vp->drawmode & DRMODE_FG) 394 if (vp->drawmode & DRMODE_FG)
395 { 395 {
396 fillopt = true; 396 fillopt = true;
397 value = _GREY_FG_BRIGHTNESS(vp); 397 value = vp->fg_pattern;
398 398
399 } 399 }
400 } 400 }
@@ -544,7 +544,7 @@ void grey_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
544 break; 544 break;
545 545
546 case DRMODE_BG: 546 case DRMODE_BG:
547 bg = _GREY_BG_BRIGHTNESS(vp); 547 bg = vp->bg_pattern;
548 do 548 do
549 { 549 {
550 if (!(data & 0x01)) 550 if (!(data & 0x01))
@@ -557,7 +557,7 @@ void grey_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
557 break; 557 break;
558 558
559 case DRMODE_FG: 559 case DRMODE_FG:
560 fg = _GREY_FG_BRIGHTNESS(vp); 560 fg = vp->fg_pattern;
561 do 561 do
562 { 562 {
563 if (data & 0x01) 563 if (data & 0x01)
@@ -570,8 +570,8 @@ void grey_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
570 break; 570 break;
571 571
572 case DRMODE_SOLID: 572 case DRMODE_SOLID:
573 fg = _GREY_FG_BRIGHTNESS(vp); 573 fg = vp->fg_pattern;
574 bg = _GREY_BG_BRIGHTNESS(vp); 574 bg = vp->bg_pattern;
575 do 575 do
576 { 576 {
577 *dst_col = (data & 0x01) ? fg : bg; 577 *dst_col = (data & 0x01) ? fg : bg;
@@ -699,8 +699,7 @@ void grey_ub_clear_display(void)
699{ 699{
700 struct viewport *vp = &_grey_default_vp; 700 struct viewport *vp = &_grey_default_vp;
701 int value = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? 701 int value = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
702 _GREY_FG_BRIGHTNESS(vp) : 702 vp->fg_pattern : vp->bg_pattern];
703 _GREY_BG_BRIGHTNESS(vp)];
704 703
705 rb->memset(_grey_info.values, value, 704 rb->memset(_grey_info.values, value,
706 _GREY_MULUQ(_grey_info.width, _grey_info.height)); 705 _GREY_MULUQ(_grey_info.width, _grey_info.height));