summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorne Wuff <torne@wolfpuppy.org.uk>2009-10-16 20:15:12 +0000
committerTorne Wuff <torne@wolfpuppy.org.uk>2009-10-16 20:15:12 +0000
commit27ece8c366b89fab05a47c342edc3edc18a6c5e3 (patch)
tree6731c6beeb67dfb6d10cb35322c41e859c48b6ea
parenta3f0a45c0f80b34310fffcce339d151365845c61 (diff)
downloadrockbox-27ece8c366b89fab05a47c342edc3edc18a6c5e3.tar.gz
rockbox-27ece8c366b89fab05a47c342edc3edc18a6c5e3.zip
Pluginlib: make scroll functions clear screen if scrolled by >= screen size (from FS#10330)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23211 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/lib/grey_scroll.c24
-rw-r--r--apps/plugins/lib/xlcd_scroll.c36
2 files changed, 60 insertions, 0 deletions
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c
index adecd3bc43..35f73b70c4 100644
--- a/apps/plugins/lib/grey_scroll.c
+++ b/apps/plugins/lib/grey_scroll.c
@@ -37,7 +37,10 @@ void grey_scroll_left(int count)
37 int length, blank; 37 int length, blank;
38 38
39 if ((unsigned)count >= (unsigned)_grey_info.width) 39 if ((unsigned)count >= (unsigned)_grey_info.width)
40 {
41 grey_clear_display();
40 return; 42 return;
43 }
41 44
42 data = _grey_info.buffer; 45 data = _grey_info.buffer;
43 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 46 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
@@ -62,7 +65,10 @@ void grey_scroll_right(int count)
62 int length, blank; 65 int length, blank;
63 66
64 if ((unsigned)count >= (unsigned)_grey_info.width) 67 if ((unsigned)count >= (unsigned)_grey_info.width)
68 {
69 grey_clear_display();
65 return; 70 return;
71 }
66 72
67 data = _grey_info.buffer; 73 data = _grey_info.buffer;
68 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 74 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
@@ -86,7 +92,10 @@ void grey_scroll_up(int count)
86 int blank; 92 int blank;
87 93
88 if ((unsigned)count >= (unsigned)_grey_info.height) 94 if ((unsigned)count >= (unsigned)_grey_info.height)
95 {
96 grey_clear_display();
89 return; 97 return;
98 }
90 99
91 shift = _GREY_MULUQ(_grey_info.width, count); 100 shift = _GREY_MULUQ(_grey_info.width, count);
92 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); 101 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
@@ -105,7 +114,10 @@ void grey_scroll_down(int count)
105 int blank; 114 int blank;
106 115
107 if ((unsigned)count >= (unsigned)_grey_info.height) 116 if ((unsigned)count >= (unsigned)_grey_info.height)
117 {
118 grey_clear_display();
108 return; 119 return;
120 }
109 121
110 shift = _GREY_MULUQ(_grey_info.width, count); 122 shift = _GREY_MULUQ(_grey_info.width, count);
111 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); 123 length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
@@ -126,7 +138,10 @@ void grey_ub_scroll_left(int count)
126 int blank, length; 138 int blank, length;
127 139
128 if ((unsigned)count >= (unsigned)_grey_info.width) 140 if ((unsigned)count >= (unsigned)_grey_info.width)
141 {
142 grey_ub_clear_display();
129 return; 143 return;
144 }
130 145
131 data = _grey_info.values; 146 data = _grey_info.values;
132 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 147 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
@@ -156,7 +171,10 @@ void grey_ub_scroll_right(int count)
156 int blank, length; 171 int blank, length;
157 172
158 if ((unsigned)count >= (unsigned)_grey_info.width) 173 if ((unsigned)count >= (unsigned)_grey_info.width)
174 {
175 grey_ub_clear_display();
159 return; 176 return;
177 }
160 178
161 data = _grey_info.values; 179 data = _grey_info.values;
162 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); 180 data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
@@ -185,7 +203,10 @@ void grey_ub_scroll_up(int count)
185 int blank; 203 int blank;
186 204
187 if ((unsigned)count >= (unsigned)_grey_info.height) 205 if ((unsigned)count >= (unsigned)_grey_info.height)
206 {
207 grey_ub_clear_display();
188 return; 208 return;
209 }
189 210
190 dst = _grey_info.values; 211 dst = _grey_info.values;
191 end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width); 212 end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width);
@@ -257,7 +278,10 @@ void grey_ub_scroll_down(int count)
257 int blank; 278 int blank;
258 279
259 if ((unsigned)count >= (unsigned)_grey_info.height) 280 if ((unsigned)count >= (unsigned)_grey_info.height)
281 {
282 grey_ub_clear_display();
260 return; 283 return;
284 }
261 285
262 start = _grey_info.values; 286 start = _grey_info.values;
263 dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width); 287 dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width);
diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c
index 96e0715894..f8eac1d4b9 100644
--- a/apps/plugins/lib/xlcd_scroll.c
+++ b/apps/plugins/lib/xlcd_scroll.c
@@ -37,7 +37,10 @@ void xlcd_scroll_left(int count)
37 int length, oldmode; 37 int length, oldmode;
38 38
39 if ((unsigned)count >= LCD_WIDTH) 39 if ((unsigned)count >= LCD_WIDTH)
40 {
41 rb->lcd_clear_display();
40 return; 42 return;
43 }
41 44
42 length = (LCD_WIDTH-count)*LCD_FBHEIGHT; 45 length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
43 46
@@ -56,7 +59,10 @@ void xlcd_scroll_right(int count)
56 int length, oldmode; 59 int length, oldmode;
57 60
58 if ((unsigned)count >= LCD_WIDTH) 61 if ((unsigned)count >= LCD_WIDTH)
62 {
63 rb->lcd_clear_display();
59 return; 64 return;
65 }
60 66
61 length = (LCD_WIDTH-count)*LCD_FBHEIGHT; 67 length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
62 68
@@ -77,7 +83,10 @@ void xlcd_scroll_up(int count)
77 fb_data *data; 83 fb_data *data;
78 84
79 if ((unsigned)count >= LCD_HEIGHT) 85 if ((unsigned)count >= LCD_HEIGHT)
86 {
87 rb->lcd_clear_display();
80 return; 88 return;
89 }
81 90
82 length = LCD_HEIGHT - count; 91 length = LCD_HEIGHT - count;
83 92
@@ -103,7 +112,10 @@ void xlcd_scroll_down(int count)
103 fb_data *data; 112 fb_data *data;
104 113
105 if ((unsigned)count >= LCD_HEIGHT) 114 if ((unsigned)count >= LCD_HEIGHT)
115 {
116 rb->lcd_clear_display();
106 return; 117 return;
118 }
107 119
108 length = LCD_HEIGHT - count; 120 length = LCD_HEIGHT - count;
109 121
@@ -131,7 +143,10 @@ void xlcd_scroll_left(int count)
131 int blockcount, blocklen; 143 int blockcount, blocklen;
132 144
133 if ((unsigned) count >= LCD_WIDTH) 145 if ((unsigned) count >= LCD_WIDTH)
146 {
147 rb->lcd_clear_display();
134 return; 148 return;
149 }
135 150
136#if LCD_DEPTH == 2 151#if LCD_DEPTH == 2
137 blockcount = count >> 2; 152 blockcount = count >> 2;
@@ -186,7 +201,10 @@ void xlcd_scroll_right(int count)
186 int blockcount, blocklen; 201 int blockcount, blocklen;
187 202
188 if ((unsigned) count >= LCD_WIDTH) 203 if ((unsigned) count >= LCD_WIDTH)
204 {
205 rb->lcd_clear_display();
189 return; 206 return;
207 }
190 208
191#if LCD_DEPTH == 2 209#if LCD_DEPTH == 2
192 blockcount = count >> 2; 210 blockcount = count >> 2;
@@ -243,7 +261,10 @@ void xlcd_scroll_left(int count)
243 int length, oldmode; 261 int length, oldmode;
244 262
245 if ((unsigned)count >= LCD_WIDTH) 263 if ((unsigned)count >= LCD_WIDTH)
264 {
265 rb->lcd_clear_display();
246 return; 266 return;
267 }
247 268
248 data = rb->lcd_framebuffer; 269 data = rb->lcd_framebuffer;
249 data_end = data + LCD_WIDTH*LCD_FBHEIGHT; 270 data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
@@ -269,7 +290,10 @@ void xlcd_scroll_right(int count)
269 int length, oldmode; 290 int length, oldmode;
270 291
271 if ((unsigned)count >= LCD_WIDTH) 292 if ((unsigned)count >= LCD_WIDTH)
293 {
294 rb->lcd_clear_display();
272 return; 295 return;
296 }
273 297
274 data = rb->lcd_framebuffer; 298 data = rb->lcd_framebuffer;
275 data_end = data + LCD_WIDTH*LCD_FBHEIGHT; 299 data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
@@ -298,7 +322,10 @@ void xlcd_scroll_up(int count)
298 int length, oldmode; 322 int length, oldmode;
299 323
300 if ((unsigned)count >= LCD_HEIGHT) 324 if ((unsigned)count >= LCD_HEIGHT)
325 {
326 rb->lcd_clear_display();
301 return; 327 return;
328 }
302 329
303 length = LCD_HEIGHT - count; 330 length = LCD_HEIGHT - count;
304 331
@@ -318,7 +345,10 @@ void xlcd_scroll_down(int count)
318 int length, oldmode; 345 int length, oldmode;
319 346
320 if ((unsigned)count >= LCD_HEIGHT) 347 if ((unsigned)count >= LCD_HEIGHT)
348 {
349 rb->lcd_clear_display();
321 return; 350 return;
351 }
322 352
323 length = LCD_HEIGHT - count; 353 length = LCD_HEIGHT - count;
324 354
@@ -342,7 +372,10 @@ void xlcd_scroll_up(int count)
342 int blockcount, blocklen; 372 int blockcount, blocklen;
343 373
344 if ((unsigned) count >= LCD_HEIGHT) 374 if ((unsigned) count >= LCD_HEIGHT)
375 {
376 rb->lcd_clear_display();
345 return; 377 return;
378 }
346 379
347#if (LCD_DEPTH == 1) \ 380#if (LCD_DEPTH == 1) \
348 || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 381 || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
@@ -536,7 +569,10 @@ void xlcd_scroll_down(int count)
536 int blockcount, blocklen; 569 int blockcount, blocklen;
537 570
538 if ((unsigned) count >= LCD_HEIGHT) 571 if ((unsigned) count >= LCD_HEIGHT)
572 {
573 rb->lcd_clear_display();
539 return; 574 return;
575 }
540 576
541#if (LCD_DEPTH == 1) \ 577#if (LCD_DEPTH == 1) \
542 || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 578 || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)