summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/grey_scroll.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-12-07 01:50:52 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-12-18 19:16:26 -0500
commit371c86bf3f4d1708fc40db2aa7fa572eb429d0b4 (patch)
treebe339c62eac616ac6938c2929349b72377c10ee2 /apps/plugins/lib/grey_scroll.c
parentf668c3624184fedc14d34f87ad7b5f1e43bc87a1 (diff)
downloadrockbox-371c86bf3f4d1708fc40db2aa7fa572eb429d0b4.tar.gz
rockbox-371c86bf3f4d1708fc40db2aa7fa572eb429d0b4.zip
Adapt OSD in plugin lib to be greylib compatible.
Requires addition of viewports and alternate framebuffers to greylib which are essentially similar to the core implementation except that the framebuffer can be any size and relationship to a viewport. Drawing is always fully clipped to the intersecting area. Adapt oscilloscope.c to the API change. FFT will use the new features (later update). Get rid of silly and wrong lcd_bmp_part use in OSD. Remove it from plugin API (must be made incompatible now). Change-Id: Iafa5e2174148fb8ad11db6b9d4add0dcabc5c563
Diffstat (limited to 'apps/plugins/lib/grey_scroll.c')
-rw-r--r--apps/plugins/lib/grey_scroll.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c
index 35f73b70c4..78e5725d05 100644
--- a/apps/plugins/lib/grey_scroll.c
+++ b/apps/plugins/lib/grey_scroll.c
@@ -28,11 +28,14 @@
28#include "plugin.h" 28#include "plugin.h"
29#include "grey.h" 29#include "grey.h"
30 30
31extern struct viewport _grey_default_vp;
32
31/*** Scrolling ***/ 33/*** Scrolling ***/
32 34
33/* Scroll left */ 35/* Scroll left */
34void grey_scroll_left(int count) 36void grey_scroll_left(int count)
35{ 37{
38 struct viewport *vp = &_grey_default_vp;
36 unsigned char *data, *data_end; 39 unsigned char *data, *data_end;
37 int length, blank; 40 int length, blank;
38 41
@@ -45,8 +48,8 @@ void grey_scroll_left(int count)
45 data = _grey_info.buffer; 48 data = _grey_info.buffer;
46 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 49 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
47 length = _grey_info.width - count; 50 length = _grey_info.width - count;
48 blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? 51 blank = (vp->drawmode & DRMODE_INVERSEVID) ?
49 _grey_info.fg_brightness : _grey_info.bg_brightness; 52 _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
50 53
51 do 54 do
52 { 55 {
@@ -61,6 +64,7 @@ void grey_scroll_left(int count)
61/* Scroll right */ 64/* Scroll right */
62void grey_scroll_right(int count) 65void grey_scroll_right(int count)
63{ 66{
67 struct viewport *vp = &_grey_default_vp;
64 unsigned char *data, *data_end; 68 unsigned char *data, *data_end;
65 int length, blank; 69 int length, blank;
66 70
@@ -73,8 +77,8 @@ void grey_scroll_right(int count)
73 data = _grey_info.buffer; 77 data = _grey_info.buffer;
74 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 78 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
75 length = _grey_info.width - count; 79 length = _grey_info.width - count;
76 blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? 80 blank = (vp->drawmode & DRMODE_INVERSEVID) ?
77 _grey_info.fg_brightness : _grey_info.bg_brightness; 81 _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
78 82
79 do 83 do
80 { 84 {
@@ -88,6 +92,7 @@ void grey_scroll_right(int count)
88/* Scroll up */ 92/* Scroll up */
89void grey_scroll_up(int count) 93void grey_scroll_up(int count)
90{ 94{
95 struct viewport *vp = &_grey_default_vp;
91 long shift, length; 96 long shift, length;
92 int blank; 97 int blank;
93 98
@@ -99,8 +104,8 @@ void grey_scroll_up(int count)
99 104
100 shift = _GREY_MULUQ(_grey_info.width, count); 105 shift = _GREY_MULUQ(_grey_info.width, count);
101 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); 106 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
102 blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? 107 blank = (vp->drawmode & DRMODE_INVERSEVID) ?
103 _grey_info.fg_brightness : _grey_info.bg_brightness; 108 _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
104 109
105 rb->memmove(_grey_info.buffer, _grey_info.buffer + shift, 110 rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
106 length); 111 length);
@@ -110,6 +115,7 @@ void grey_scroll_up(int count)
110/* Scroll down */ 115/* Scroll down */
111void grey_scroll_down(int count) 116void grey_scroll_down(int count)
112{ 117{
118 struct viewport *vp = &_grey_default_vp;
113 long shift, length; 119 long shift, length;
114 int blank; 120 int blank;
115 121
@@ -121,8 +127,8 @@ void grey_scroll_down(int count)
121 127
122 shift = _GREY_MULUQ(_grey_info.width, count); 128 shift = _GREY_MULUQ(_grey_info.width, count);
123 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); 129 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
124 blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? 130 blank = (vp->drawmode & DRMODE_INVERSEVID) ?
125 _grey_info.fg_brightness : _grey_info.bg_brightness; 131 _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
126 132
127 rb->memmove(_grey_info.buffer + shift, _grey_info.buffer, 133 rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
128 length); 134 length);
@@ -134,6 +140,7 @@ void grey_scroll_down(int count)
134/* Scroll left */ 140/* Scroll left */
135void grey_ub_scroll_left(int count) 141void grey_ub_scroll_left(int count)
136{ 142{
143 struct viewport *vp = &_grey_default_vp;
137 unsigned char *data, *data_end; 144 unsigned char *data, *data_end;
138 int blank, length; 145 int blank, length;
139 146
@@ -147,9 +154,9 @@ void grey_ub_scroll_left(int count)
147 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 154 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
148 length = (_grey_info.width - count) << _GREY_BSHIFT; 155 length = (_grey_info.width - count) << _GREY_BSHIFT;
149 count <<= _GREY_BSHIFT; 156 count <<= _GREY_BSHIFT;
150 blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? 157 blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
151 _grey_info.fg_brightness : 158 _GREY_FG_BRIGHTNESS(vp) :
152 _grey_info.bg_brightness]; 159 _GREY_BG_BRIGHTNESS(vp)];
153 do 160 do
154 { 161 {
155 rb->memmove(data, data + count, length); 162 rb->memmove(data, data + count, length);
@@ -167,6 +174,7 @@ void grey_ub_scroll_left(int count)
167/* Scroll right */ 174/* Scroll right */
168void grey_ub_scroll_right(int count) 175void grey_ub_scroll_right(int count)
169{ 176{
177 struct viewport *vp = &_grey_default_vp;
170 unsigned char *data, *data_end; 178 unsigned char *data, *data_end;
171 int blank, length; 179 int blank, length;
172 180
@@ -180,9 +188,9 @@ void grey_ub_scroll_right(int count)
180 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 188 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
181 length = (_grey_info.width - count) << _GREY_BSHIFT; 189 length = (_grey_info.width - count) << _GREY_BSHIFT;
182 count <<= _GREY_BSHIFT; 190 count <<= _GREY_BSHIFT;
183 blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? 191 blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
184 _grey_info.fg_brightness : 192 _GREY_FG_BRIGHTNESS(vp) :
185 _grey_info.bg_brightness]; 193 _GREY_BG_BRIGHTNESS(vp)];
186 do 194 do
187 { 195 {
188 rb->memmove(data + count, data, length); 196 rb->memmove(data + count, data, length);
@@ -199,6 +207,7 @@ void grey_ub_scroll_right(int count)
199/* Scroll up */ 207/* Scroll up */
200void grey_ub_scroll_up(int count) 208void grey_ub_scroll_up(int count)
201{ 209{
210 struct viewport *vp = &_grey_default_vp;
202 unsigned char *dst, *end, *src; 211 unsigned char *dst, *end, *src;
203 int blank; 212 int blank;
204 213
@@ -210,9 +219,9 @@ void grey_ub_scroll_up(int count)
210 219
211 dst = _grey_info.values; 220 dst = _grey_info.values;
212 end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width); 221 end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width);
213 blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? 222 blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
214 _grey_info.fg_brightness : 223 _GREY_FG_BRIGHTNESS(vp) :
215 _grey_info.bg_brightness]; 224 _GREY_BG_BRIGHTNESS(vp)];
216 225
217#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ 226#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \
218 || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 227 || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
@@ -274,6 +283,7 @@ void grey_ub_scroll_up(int count)
274/* Scroll down */ 283/* Scroll down */
275void grey_ub_scroll_down(int count) 284void grey_ub_scroll_down(int count)
276{ 285{
286 struct viewport *vp = &_grey_default_vp;
277 unsigned char *start, *dst; 287 unsigned char *start, *dst;
278 int blank; 288 int blank;
279 289
@@ -285,9 +295,9 @@ void grey_ub_scroll_down(int count)
285 295
286 start = _grey_info.values; 296 start = _grey_info.values;
287 dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width); 297 dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width);
288 blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? 298 blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
289 _grey_info.fg_brightness : 299 _GREY_FG_BRIGHTNESS(vp) :
290 _grey_info.bg_brightness]; 300 _GREY_BG_BRIGHTNESS(vp)];
291 301
292#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ 302#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \
293 || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 303 || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)