diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lib/grey.h | 4 | ||||
-rw-r--r-- | apps/plugins/lib/grey_draw.c | 25 | ||||
-rw-r--r-- | apps/plugins/lib/grey_parm.c | 13 | ||||
-rw-r--r-- | apps/plugins/lib/grey_scroll.c | 24 |
4 files changed, 26 insertions, 40 deletions
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h index d63d19ee4a..63e896bfb6 100644 --- a/apps/plugins/lib/grey.h +++ b/apps/plugins/lib/grey.h | |||
@@ -198,10 +198,6 @@ struct _grey_info | |||
198 | struct viewport *vp; /* current viewport in use */ | 198 | struct viewport *vp; /* current viewport in use */ |
199 | }; | 199 | }; |
200 | 200 | ||
201 | /* Stuff these here for now. LCD depth of 1 has no 'pattern' members. */ | ||
202 | #define _GREY_FG_BRIGHTNESS(vp) ((vp)->flags) | ||
203 | #define _GREY_BG_BRIGHTNESS(vp) ((vp)->line_height) | ||
204 | |||
205 | /* Global variable, defined in the plugin */ | 201 | /* Global variable, defined in the plugin */ |
206 | extern struct _grey_info _grey_info; | 202 | extern struct _grey_info _grey_info; |
207 | 203 | ||
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 | ||
35 | static void setpixel(unsigned char *address) | 35 | static 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 | ||
40 | static void clearpixel(unsigned char *address) | 40 | static 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 | ||
45 | static void flippixel(unsigned char *address) | 45 | static 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)); |
diff --git a/apps/plugins/lib/grey_parm.c b/apps/plugins/lib/grey_parm.c index 9b4ba8c5f6..d2dfde42f1 100644 --- a/apps/plugins/lib/grey_parm.c +++ b/apps/plugins/lib/grey_parm.c | |||
@@ -79,25 +79,25 @@ int grey_get_drawmode(void) | |||
79 | /* Set the foreground shade for subsequent drawing operations */ | 79 | /* Set the foreground shade for subsequent drawing operations */ |
80 | void grey_set_foreground(unsigned brightness) | 80 | void grey_set_foreground(unsigned brightness) |
81 | { | 81 | { |
82 | _GREY_FG_BRIGHTNESS(_grey_info.vp) = brightness; | 82 | _grey_info.vp->fg_pattern = brightness; |
83 | } | 83 | } |
84 | 84 | ||
85 | /* Return the current foreground shade */ | 85 | /* Return the current foreground shade */ |
86 | unsigned grey_get_foreground(void) | 86 | unsigned grey_get_foreground(void) |
87 | { | 87 | { |
88 | return _GREY_FG_BRIGHTNESS(_grey_info.vp); | 88 | return _grey_info.vp->fg_pattern; |
89 | } | 89 | } |
90 | 90 | ||
91 | /* Set the background shade for subsequent drawing operations */ | 91 | /* Set the background shade for subsequent drawing operations */ |
92 | void grey_set_background(unsigned brightness) | 92 | void grey_set_background(unsigned brightness) |
93 | { | 93 | { |
94 | _GREY_BG_BRIGHTNESS(_grey_info.vp) = brightness; | 94 | _grey_info.vp->bg_pattern = brightness; |
95 | } | 95 | } |
96 | 96 | ||
97 | /* Return the current background shade */ | 97 | /* Return the current background shade */ |
98 | unsigned grey_get_background(void) | 98 | unsigned grey_get_background(void) |
99 | { | 99 | { |
100 | return _GREY_BG_BRIGHTNESS(_grey_info.vp); | 100 | return _grey_info.vp->bg_pattern; |
101 | } | 101 | } |
102 | 102 | ||
103 | /* Set draw mode, foreground and background shades at once */ | 103 | /* Set draw mode, foreground and background shades at once */ |
@@ -177,8 +177,8 @@ void grey_viewport_set_fullscreen(struct viewport *vp, | |||
177 | vp->y = 0; | 177 | vp->y = 0; |
178 | vp->width = _grey_info.width; | 178 | vp->width = _grey_info.width; |
179 | vp->height = _grey_info.height; | 179 | vp->height = _grey_info.height; |
180 | _GREY_FG_BRIGHTNESS(vp) = 0; | 180 | vp->fg_pattern = 0; |
181 | _GREY_BG_BRIGHTNESS(vp) = 255; | 181 | vp->bg_pattern = 255; |
182 | vp->drawmode = DRMODE_SOLID; | 182 | vp->drawmode = DRMODE_SOLID; |
183 | vp->font = FONT_SYSFIXED; | 183 | vp->font = FONT_SYSFIXED; |
184 | 184 | ||
@@ -258,4 +258,3 @@ void grey_framebuffer_set_pos(int x, int y, int width, int height) | |||
258 | 258 | ||
259 | grey_update_clip_rect(); | 259 | grey_update_clip_rect(); |
260 | } | 260 | } |
261 | |||
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c index 78e5725d05..a9ce45db92 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) | |||
48 | data = _grey_info.buffer; | 48 | data = _grey_info.buffer; |
49 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); | 49 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); |
50 | length = _grey_info.width - count; | 50 | length = _grey_info.width - count; |
51 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? | 51 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern; |
52 | _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); | ||
53 | 52 | ||
54 | do | 53 | do |
55 | { | 54 | { |
@@ -77,8 +76,7 @@ void grey_scroll_right(int count) | |||
77 | data = _grey_info.buffer; | 76 | data = _grey_info.buffer; |
78 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); | 77 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); |
79 | length = _grey_info.width - count; | 78 | length = _grey_info.width - count; |
80 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? | 79 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern; |
81 | _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); | ||
82 | 80 | ||
83 | do | 81 | do |
84 | { | 82 | { |
@@ -104,8 +102,7 @@ void grey_scroll_up(int count) | |||
104 | 102 | ||
105 | shift = _GREY_MULUQ(_grey_info.width, count); | 103 | shift = _GREY_MULUQ(_grey_info.width, count); |
106 | length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); | 104 | length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); |
107 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? | 105 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern; |
108 | _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); | ||
109 | 106 | ||
110 | rb->memmove(_grey_info.buffer, _grey_info.buffer + shift, | 107 | rb->memmove(_grey_info.buffer, _grey_info.buffer + shift, |
111 | length); | 108 | length); |
@@ -127,8 +124,7 @@ void grey_scroll_down(int count) | |||
127 | 124 | ||
128 | shift = _GREY_MULUQ(_grey_info.width, count); | 125 | shift = _GREY_MULUQ(_grey_info.width, count); |
129 | length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); | 126 | length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); |
130 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? | 127 | blank = (vp->drawmode & DRMODE_INVERSEVID) ? vp->fg_pattern : vp->bg_pattern; |
131 | _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); | ||
132 | 128 | ||
133 | rb->memmove(_grey_info.buffer + shift, _grey_info.buffer, | 129 | rb->memmove(_grey_info.buffer + shift, _grey_info.buffer, |
134 | length); | 130 | length); |
@@ -155,8 +151,7 @@ void grey_ub_scroll_left(int count) | |||
155 | length = (_grey_info.width - count) << _GREY_BSHIFT; | 151 | length = (_grey_info.width - count) << _GREY_BSHIFT; |
156 | count <<= _GREY_BSHIFT; | 152 | count <<= _GREY_BSHIFT; |
157 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? | 153 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? |
158 | _GREY_FG_BRIGHTNESS(vp) : | 154 | vp->fg_pattern : vp->bg_pattern]; |
159 | _GREY_BG_BRIGHTNESS(vp)]; | ||
160 | do | 155 | do |
161 | { | 156 | { |
162 | rb->memmove(data, data + count, length); | 157 | rb->memmove(data, data + count, length); |
@@ -189,8 +184,7 @@ void grey_ub_scroll_right(int count) | |||
189 | length = (_grey_info.width - count) << _GREY_BSHIFT; | 184 | length = (_grey_info.width - count) << _GREY_BSHIFT; |
190 | count <<= _GREY_BSHIFT; | 185 | count <<= _GREY_BSHIFT; |
191 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? | 186 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? |
192 | _GREY_FG_BRIGHTNESS(vp) : | 187 | vp->fg_pattern : vp->bg_pattern]; |
193 | _GREY_BG_BRIGHTNESS(vp)]; | ||
194 | do | 188 | do |
195 | { | 189 | { |
196 | rb->memmove(data + count, data, length); | 190 | rb->memmove(data + count, data, length); |
@@ -220,8 +214,7 @@ void grey_ub_scroll_up(int count) | |||
220 | dst = _grey_info.values; | 214 | dst = _grey_info.values; |
221 | end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width); | 215 | end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width); |
222 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? | 216 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? |
223 | _GREY_FG_BRIGHTNESS(vp) : | 217 | vp->fg_pattern : vp->bg_pattern]; |
224 | _GREY_BG_BRIGHTNESS(vp)]; | ||
225 | 218 | ||
226 | #if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ | 219 | #if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ |
227 | || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) | 220 | || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) |
@@ -296,8 +289,7 @@ void grey_ub_scroll_down(int count) | |||
296 | start = _grey_info.values; | 289 | start = _grey_info.values; |
297 | dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width); | 290 | dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width); |
298 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? | 291 | blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? |
299 | _GREY_FG_BRIGHTNESS(vp) : | 292 | vp->fg_pattern : vp->bg_pattern]; |
300 | _GREY_BG_BRIGHTNESS(vp)]; | ||
301 | 293 | ||
302 | #if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ | 294 | #if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ |
303 | || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) | 295 | || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) |