diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-01-13 00:11:43 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-01-13 00:11:43 +0000 |
commit | a72499a12541fa0348e92f88662d1efe15b0ea47 (patch) | |
tree | 32a874c093616649f49f4392207b738a6f7abed7 /apps/plugins/lib/grey_scroll.c | |
parent | 43cc03457d2bda7eb3057f242ff7b23a9856408c (diff) | |
download | rockbox-a72499a12541fa0348e92f88662d1efe15b0ea47.tar.gz rockbox-a72499a12541fa0348e92f88662d1efe15b0ea47.zip |
Greyscale library: Plugins can now put the management structure in IRAM for higher update speed. Use this in doom, mpegplayer, and zxbox. Made the api pointer part of the struct.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16066 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/grey_scroll.c')
-rw-r--r-- | apps/plugins/lib/grey_scroll.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c index 0e88655c89..5040dd4c74 100644 --- a/apps/plugins/lib/grey_scroll.c +++ b/apps/plugins/lib/grey_scroll.c | |||
@@ -45,9 +45,9 @@ void grey_scroll_left(int count) | |||
45 | 45 | ||
46 | do | 46 | do |
47 | { | 47 | { |
48 | _grey_rb->memmove(data, data + count, length); | 48 | _grey_info.rb->memmove(data, data + count, length); |
49 | data += length; | 49 | data += length; |
50 | _grey_rb->memset(data, blank, count); | 50 | _grey_info.rb->memset(data, blank, count); |
51 | data += count; | 51 | data += count; |
52 | } | 52 | } |
53 | while (data < data_end); | 53 | while (data < data_end); |
@@ -70,8 +70,8 @@ void grey_scroll_right(int count) | |||
70 | 70 | ||
71 | do | 71 | do |
72 | { | 72 | { |
73 | _grey_rb->memmove(data + count, data, length); | 73 | _grey_info.rb->memmove(data + count, data, length); |
74 | _grey_rb->memset(data, blank, count); | 74 | _grey_info.rb->memset(data, blank, count); |
75 | data += _grey_info.width; | 75 | data += _grey_info.width; |
76 | } | 76 | } |
77 | while (data < data_end); | 77 | while (data < data_end); |
@@ -91,8 +91,9 @@ void grey_scroll_up(int count) | |||
91 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? | 91 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? |
92 | _grey_info.fg_val : _grey_info.bg_val; | 92 | _grey_info.fg_val : _grey_info.bg_val; |
93 | 93 | ||
94 | _grey_rb->memmove(_grey_info.buffer, _grey_info.buffer + shift, length); | 94 | _grey_info.rb->memmove(_grey_info.buffer, _grey_info.buffer + shift, |
95 | _grey_rb->memset(_grey_info.buffer + length, blank, shift); | 95 | length); |
96 | _grey_info.rb->memset(_grey_info.buffer + length, blank, shift); | ||
96 | } | 97 | } |
97 | 98 | ||
98 | /* Scroll down */ | 99 | /* Scroll down */ |
@@ -109,8 +110,9 @@ void grey_scroll_down(int count) | |||
109 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? | 110 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? |
110 | _grey_info.fg_val : _grey_info.bg_val; | 111 | _grey_info.fg_val : _grey_info.bg_val; |
111 | 112 | ||
112 | _grey_rb->memmove(_grey_info.buffer + shift, _grey_info.buffer, length); | 113 | _grey_info.rb->memmove(_grey_info.buffer + shift, _grey_info.buffer, |
113 | _grey_rb->memset(_grey_info.buffer, blank, shift); | 114 | length); |
115 | _grey_info.rb->memset(_grey_info.buffer, blank, shift); | ||
114 | } | 116 | } |
115 | 117 | ||
116 | /*** Unbuffered scrolling functions ***/ | 118 | /*** Unbuffered scrolling functions ***/ |
@@ -155,7 +157,7 @@ void grey_ub_scroll_left(int count) | |||
155 | 157 | ||
156 | if ((unsigned)count >= (unsigned)_grey_info.width) | 158 | if ((unsigned)count >= (unsigned)_grey_info.width) |
157 | return; | 159 | return; |
158 | 160 | ||
159 | data = _grey_info.values; | 161 | data = _grey_info.values; |
160 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); | 162 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); |
161 | length = (_grey_info.width - count) << _GREY_BSHIFT; | 163 | length = (_grey_info.width - count) << _GREY_BSHIFT; |
@@ -165,9 +167,9 @@ void grey_ub_scroll_left(int count) | |||
165 | 167 | ||
166 | do | 168 | do |
167 | { | 169 | { |
168 | _grey_rb->memmove(data, data + count, length); | 170 | _grey_info.rb->memmove(data, data + count, length); |
169 | data += length; | 171 | data += length; |
170 | _grey_rb->memset(data, blank, count); | 172 | _grey_info.rb->memset(data, blank, count); |
171 | data += count; | 173 | data += count; |
172 | } | 174 | } |
173 | while (data < data_end); | 175 | while (data < data_end); |
@@ -181,7 +183,7 @@ void grey_ub_scroll_right(int count) | |||
181 | 183 | ||
182 | if ((unsigned)count >= (unsigned)_grey_info.width) | 184 | if ((unsigned)count >= (unsigned)_grey_info.width) |
183 | return; | 185 | return; |
184 | 186 | ||
185 | data = _grey_info.values; | 187 | data = _grey_info.values; |
186 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); | 188 | data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); |
187 | length = (_grey_info.width - count) << _GREY_BSHIFT; | 189 | length = (_grey_info.width - count) << _GREY_BSHIFT; |
@@ -191,8 +193,8 @@ void grey_ub_scroll_right(int count) | |||
191 | 193 | ||
192 | do | 194 | do |
193 | { | 195 | { |
194 | _grey_rb->memmove(data + count, data, length); | 196 | _grey_info.rb->memmove(data + count, data, length); |
195 | _grey_rb->memset(data, blank, count); | 197 | _grey_info.rb->memset(data, blank, count); |
196 | data += _grey_info.width << _GREY_BSHIFT; | 198 | data += _grey_info.width << _GREY_BSHIFT; |
197 | } | 199 | } |
198 | while (data < data_end); | 200 | while (data < data_end); |
@@ -206,7 +208,7 @@ void grey_ub_scroll_up(int count) | |||
206 | 208 | ||
207 | if ((unsigned)count >= (unsigned)_grey_info.height) | 209 | if ((unsigned)count >= (unsigned)_grey_info.height) |
208 | return; | 210 | return; |
209 | 211 | ||
210 | dst = _grey_info.values; | 212 | dst = _grey_info.values; |
211 | end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width); | 213 | end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width); |
212 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? | 214 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? |
@@ -258,10 +260,10 @@ void grey_ub_scroll_up(int count) | |||
258 | int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width); | 260 | int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width); |
259 | 261 | ||
260 | src = dst + _GREY_MULUQ(count, _grey_info.width); | 262 | src = dst + _GREY_MULUQ(count, _grey_info.width); |
261 | _grey_rb->memmove(dst, src, blen); | 263 | _grey_info.rb->memmove(dst, src, blen); |
262 | dst += blen; | 264 | dst += blen; |
263 | } | 265 | } |
264 | _grey_rb->memset(dst, blank, end - dst); /* Fill remainder at once. */ | 266 | _grey_info.rb->memset(dst, blank, end - dst); /* Fill remainder at once. */ |
265 | } | 267 | } |
266 | 268 | ||
267 | /* Scroll down */ | 269 | /* Scroll down */ |
@@ -272,7 +274,7 @@ void grey_ub_scroll_down(int count) | |||
272 | 274 | ||
273 | if ((unsigned)count >= (unsigned)_grey_info.height) | 275 | if ((unsigned)count >= (unsigned)_grey_info.height) |
274 | return; | 276 | return; |
275 | 277 | ||
276 | start = _grey_info.values; | 278 | start = _grey_info.values; |
277 | dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width); | 279 | dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width); |
278 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? | 280 | blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? |
@@ -304,7 +306,7 @@ void grey_ub_scroll_down(int count) | |||
304 | } | 306 | } |
305 | while (dst < line_end); | 307 | while (dst < line_end); |
306 | } | 308 | } |
307 | for (; ~yd & _GREY_BMASK; yd--) /* Fill remainder of current block. */ | 309 | for (; ~yd & _GREY_BMASK; yd--) /* Fill remainder of current block. */ |
308 | { | 310 | { |
309 | dst = _grey_info.values | 311 | dst = _grey_info.values |
310 | + _GREY_MULUQ(_grey_info.width, yd & ~_GREY_BMASK) | 312 | + _GREY_MULUQ(_grey_info.width, yd & ~_GREY_BMASK) |
@@ -325,9 +327,10 @@ void grey_ub_scroll_down(int count) | |||
325 | int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width); | 327 | int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width); |
326 | 328 | ||
327 | dst -= blen; | 329 | dst -= blen; |
328 | _grey_rb->memmove(dst, start, blen); | 330 | _grey_info.rb->memmove(dst, start, blen); |
329 | } | 331 | } |
330 | _grey_rb->memset(start, blank, dst - start); /* Fill remainder at once. */ | 332 | _grey_info.rb->memset(start, blank, dst - start); |
333 | /* Fill remainder at once. */ | ||
331 | } | 334 | } |
332 | 335 | ||
333 | #endif /* !SIMULATOR */ | 336 | #endif /* !SIMULATOR */ |