diff options
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/SOURCES | 4 | ||||
-rw-r--r-- | apps/plugins/lib/display_text.c | 4 | ||||
-rw-r--r-- | apps/plugins/lib/mylcd.h | 9 | ||||
-rw-r--r-- | apps/plugins/lib/osd.h | 4 | ||||
-rw-r--r-- | apps/plugins/lib/playergfx.c | 526 | ||||
-rw-r--r-- | apps/plugins/lib/playergfx.h | 55 | ||||
-rw-r--r-- | apps/plugins/lib/simple_viewer.c | 5 |
7 files changed, 2 insertions, 605 deletions
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index 82b9fba4a5..effc076eb7 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES | |||
@@ -33,10 +33,6 @@ overlay.c | |||
33 | profile_plugin.c | 33 | profile_plugin.c |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #ifdef HAVE_LCD_CHARCELLS | ||
37 | playergfx.c | ||
38 | #endif | ||
39 | |||
40 | #ifdef HAVE_LCD_BITMAP | 36 | #ifdef HAVE_LCD_BITMAP |
41 | 37 | ||
42 | #ifdef CPU_ARM | 38 | #ifdef CPU_ARM |
diff --git a/apps/plugins/lib/display_text.c b/apps/plugins/lib/display_text.c index 5d13fc678d..90712a649f 100644 --- a/apps/plugins/lib/display_text.c +++ b/apps/plugins/lib/display_text.c | |||
@@ -22,11 +22,7 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "display_text.h" | 23 | #include "display_text.h" |
24 | 24 | ||
25 | #ifdef HAVE_LCD_CHARCELLS | ||
26 | #define MARGIN 0 | ||
27 | #else | ||
28 | #define MARGIN 5 | 25 | #define MARGIN 5 |
29 | #endif | ||
30 | 26 | ||
31 | static bool wait_key_press(void) | 27 | static bool wait_key_press(void) |
32 | { | 28 | { |
diff --git a/apps/plugins/lib/mylcd.h b/apps/plugins/lib/mylcd.h index e363111c71..a543d60890 100644 --- a/apps/plugins/lib/mylcd.h +++ b/apps/plugins/lib/mylcd.h | |||
@@ -32,15 +32,10 @@ | |||
32 | * targets. On color, mylcd_ub_update_XXXX refer to the proper update | 32 | * targets. On color, mylcd_ub_update_XXXX refer to the proper update |
33 | * functions, otherwise they are no-ops. | 33 | * functions, otherwise they are no-ops. |
34 | * | 34 | * |
35 | * lib/playergfx.h or lib/grey.h should be included before including this | 35 | * lib/grey.h should be included before including this |
36 | * header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise. | 36 | * header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise. |
37 | */ | 37 | */ |
38 | #if defined (HAVE_LCD_CHARCELLS) && defined(__PGFX_H__) | 38 | #if defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && defined(__GREY_H__) |
39 | #define MYLCD_CFG_PGFX /* using PGFX */ | ||
40 | #define mylcd_(fn) pgfx_##fn | ||
41 | #define mylcd_ub_(fn) pgfx_##fn | ||
42 | |||
43 | #elif defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && defined(__GREY_H__) | ||
44 | #define MYLCD_CFG_GREYLIB /* using greylib */ | 39 | #define MYLCD_CFG_GREYLIB /* using greylib */ |
45 | #define mylcd_(fn) grey_##fn | 40 | #define mylcd_(fn) grey_##fn |
46 | #define myxlcd_(fn) grey_##fn | 41 | #define myxlcd_(fn) grey_##fn |
diff --git a/apps/plugins/lib/osd.h b/apps/plugins/lib/osd.h index b5bf63d9fe..1c2752139a 100644 --- a/apps/plugins/lib/osd.h +++ b/apps/plugins/lib/osd.h | |||
@@ -23,10 +23,6 @@ | |||
23 | #ifndef OSD_H | 23 | #ifndef OSD_H |
24 | #define OSD_H | 24 | #define OSD_H |
25 | 25 | ||
26 | #ifndef HAVE_LCD_BITMAP | ||
27 | #error OSD requires bitmapped LCD | ||
28 | #endif | ||
29 | |||
30 | /* At this time: assumes use of the default viewport for normal drawing */ | 26 | /* At this time: assumes use of the default viewport for normal drawing */ |
31 | 27 | ||
32 | /* Callback implemented by user. Paramters are OSD vp-relative coordinates */ | 28 | /* Callback implemented by user. Paramters are OSD vp-relative coordinates */ |
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c deleted file mode 100644 index b2ba71351f..0000000000 --- a/apps/plugins/lib/playergfx.c +++ /dev/null | |||
@@ -1,526 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Bitmap graphics on player LCD! | ||
11 | * | ||
12 | * Copyright (C) 2005 Jens Arnold | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #include "plugin.h" | ||
25 | |||
26 | #include "playergfx.h" | ||
27 | |||
28 | /*** globals ***/ | ||
29 | |||
30 | static int char_width; | ||
31 | static int char_height; | ||
32 | static int pixel_height; | ||
33 | static int pixel_width; | ||
34 | static unsigned long gfx_chars[8]; | ||
35 | static unsigned char gfx_buffer[56]; | ||
36 | static int drawmode = DRMODE_SOLID; | ||
37 | |||
38 | /*** Special functions ***/ | ||
39 | |||
40 | /* library init */ | ||
41 | bool pgfx_init(int cwidth, int cheight) | ||
42 | { | ||
43 | int i; | ||
44 | |||
45 | if (((unsigned) cwidth * (unsigned) cheight) > 8 || (unsigned) cheight > 2) | ||
46 | return false; | ||
47 | |||
48 | char_width = cwidth; | ||
49 | char_height = cheight; | ||
50 | pixel_height = 7 * char_height; | ||
51 | pixel_width = 5 * char_width; | ||
52 | |||
53 | for (i = 0; i < cwidth * cheight; i++) | ||
54 | { | ||
55 | if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0) | ||
56 | { | ||
57 | pgfx_release(); | ||
58 | return false; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | return true; | ||
63 | } | ||
64 | |||
65 | /* library deinit */ | ||
66 | void pgfx_release(void) | ||
67 | { | ||
68 | int i; | ||
69 | |||
70 | for (i = 0; i < 8; i++) | ||
71 | if (gfx_chars[i]) | ||
72 | rb->lcd_unlock_pattern(gfx_chars[i]); | ||
73 | } | ||
74 | |||
75 | /* place the display */ | ||
76 | void pgfx_display(int cx, int cy) | ||
77 | { | ||
78 | int i, j; | ||
79 | int width = MIN(char_width, 11 - cx); | ||
80 | int height = MIN(char_height, 2 - cy); | ||
81 | |||
82 | for (i = 0; i < width; i++) | ||
83 | for (j = 0; j < height; j++) | ||
84 | rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]); | ||
85 | } | ||
86 | |||
87 | void pgfx_display_block(int cx, int cy, int x, int y) | ||
88 | { | ||
89 | rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]); | ||
90 | } | ||
91 | |||
92 | |||
93 | /*** Update functions ***/ | ||
94 | |||
95 | void pgfx_update(void) | ||
96 | { | ||
97 | int i; | ||
98 | |||
99 | for (i = 0; i < char_width * char_height; i++) | ||
100 | rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i); | ||
101 | |||
102 | rb->lcd_update(); | ||
103 | } | ||
104 | |||
105 | /*** Parameter handling ***/ | ||
106 | |||
107 | void pgfx_set_drawmode(int mode) | ||
108 | { | ||
109 | drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID); | ||
110 | } | ||
111 | |||
112 | int pgfx_get_drawmode(void) | ||
113 | { | ||
114 | return drawmode; | ||
115 | } | ||
116 | |||
117 | /*** Low-level drawing functions ***/ | ||
118 | |||
119 | static void setpixel(int x, int y) | ||
120 | { | ||
121 | gfx_buffer[pixel_height * (x/5) + y] |= 0x10 >> (x%5); | ||
122 | } | ||
123 | |||
124 | static void clearpixel(int x, int y) | ||
125 | { | ||
126 | gfx_buffer[pixel_height * (x/5) + y] &= ~(0x10 >> (x%5)); | ||
127 | } | ||
128 | |||
129 | static void flippixel(int x, int y) | ||
130 | { | ||
131 | gfx_buffer[pixel_height * (x/5) + y] ^= 0x10 >> (x%5); | ||
132 | } | ||
133 | |||
134 | static void nopixel(int x, int y) | ||
135 | { | ||
136 | (void)x; | ||
137 | (void)y; | ||
138 | } | ||
139 | |||
140 | lcd_pixelfunc_type* pgfx_pixelfuncs[8] = { | ||
141 | flippixel, nopixel, setpixel, setpixel, | ||
142 | nopixel, clearpixel, nopixel, clearpixel | ||
143 | }; | ||
144 | |||
145 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) | ||
146 | { | ||
147 | *address ^= (bits & mask); | ||
148 | } | ||
149 | |||
150 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
151 | { | ||
152 | *address &= (bits | ~mask); | ||
153 | } | ||
154 | |||
155 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
156 | { | ||
157 | *address |= (bits & mask); | ||
158 | } | ||
159 | |||
160 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) | ||
161 | { | ||
162 | unsigned data = *(char *)address; | ||
163 | |||
164 | bits ^= data; | ||
165 | *address = data ^ (bits & mask); | ||
166 | } | ||
167 | |||
168 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
169 | { | ||
170 | *address ^= (~bits & mask); | ||
171 | } | ||
172 | |||
173 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
174 | { | ||
175 | *address &= ~(bits & mask); | ||
176 | } | ||
177 | |||
178 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
179 | { | ||
180 | *address |= (~bits & mask); | ||
181 | } | ||
182 | |||
183 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
184 | { | ||
185 | unsigned data = *(char *)address; | ||
186 | |||
187 | bits = ~bits ^ data; | ||
188 | *address = data ^ (bits & mask); | ||
189 | } | ||
190 | |||
191 | lcd_blockfunc_type* pgfx_blockfuncs[8] = { | ||
192 | flipblock, bgblock, fgblock, solidblock, | ||
193 | flipinvblock, bginvblock, fginvblock, solidinvblock | ||
194 | }; | ||
195 | |||
196 | /*** Drawing functions ***/ | ||
197 | |||
198 | /* Clear the whole display */ | ||
199 | void pgfx_clear_display(void) | ||
200 | { | ||
201 | unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0x1F : 0; | ||
202 | |||
203 | rb->memset(gfx_buffer, bits, char_width * pixel_height); | ||
204 | } | ||
205 | |||
206 | /* Set a single pixel */ | ||
207 | void pgfx_drawpixel(int x, int y) | ||
208 | { | ||
209 | if (((unsigned)x < (unsigned)pixel_width) | ||
210 | && ((unsigned)y < (unsigned)pixel_height)) | ||
211 | pgfx_pixelfuncs[drawmode](x, y); | ||
212 | } | ||
213 | |||
214 | /* Draw a line */ | ||
215 | void pgfx_drawline(int x1, int y1, int x2, int y2) | ||
216 | { | ||
217 | int numpixels; | ||
218 | int i; | ||
219 | int deltax, deltay; | ||
220 | int d, dinc1, dinc2; | ||
221 | int x, xinc1, xinc2; | ||
222 | int y, yinc1, yinc2; | ||
223 | lcd_pixelfunc_type *pfunc = pgfx_pixelfuncs[drawmode]; | ||
224 | |||
225 | deltax = abs(x2 - x1); | ||
226 | deltay = abs(y2 - y1); | ||
227 | xinc2 = 1; | ||
228 | yinc2 = 1; | ||
229 | |||
230 | if (deltax >= deltay) | ||
231 | { | ||
232 | numpixels = deltax; | ||
233 | d = 2 * deltay - deltax; | ||
234 | dinc1 = deltay * 2; | ||
235 | dinc2 = (deltay - deltax) * 2; | ||
236 | xinc1 = 1; | ||
237 | yinc1 = 0; | ||
238 | } | ||
239 | else | ||
240 | { | ||
241 | numpixels = deltay; | ||
242 | d = 2 * deltax - deltay; | ||
243 | dinc1 = deltax * 2; | ||
244 | dinc2 = (deltax - deltay) * 2; | ||
245 | xinc1 = 0; | ||
246 | yinc1 = 1; | ||
247 | } | ||
248 | numpixels++; /* include endpoints */ | ||
249 | |||
250 | if (x1 > x2) | ||
251 | { | ||
252 | xinc1 = -xinc1; | ||
253 | xinc2 = -xinc2; | ||
254 | } | ||
255 | |||
256 | if (y1 > y2) | ||
257 | { | ||
258 | yinc1 = -yinc1; | ||
259 | yinc2 = -yinc2; | ||
260 | } | ||
261 | |||
262 | x = x1; | ||
263 | y = y1; | ||
264 | |||
265 | for (i = 0; i < numpixels; i++) | ||
266 | { | ||
267 | if (((unsigned)x < (unsigned)pixel_width) | ||
268 | && ((unsigned)y < (unsigned)pixel_height)) | ||
269 | pfunc(x, y); | ||
270 | |||
271 | if (d < 0) | ||
272 | { | ||
273 | d += dinc1; | ||
274 | x += xinc1; | ||
275 | y += yinc1; | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | d += dinc2; | ||
280 | x += xinc2; | ||
281 | y += yinc2; | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | |||
286 | /* Draw a horizontal line (optimised) */ | ||
287 | void pgfx_hline(int x1, int x2, int y) | ||
288 | { | ||
289 | int nx; | ||
290 | unsigned char *dst; | ||
291 | unsigned mask, mask_right; | ||
292 | lcd_blockfunc_type *bfunc; | ||
293 | |||
294 | /* direction flip */ | ||
295 | if (x2 < x1) | ||
296 | { | ||
297 | nx = x1; | ||
298 | x1 = x2; | ||
299 | x2 = nx; | ||
300 | } | ||
301 | |||
302 | /* nothing to draw? */ | ||
303 | if (((unsigned)y >= (unsigned)pixel_height) || (x1 >= pixel_width) | ||
304 | || (x2 < 0)) | ||
305 | return; | ||
306 | |||
307 | /* clipping */ | ||
308 | if (x1 < 0) | ||
309 | x1 = 0; | ||
310 | if (x2 >= pixel_width) | ||
311 | x2 = pixel_width - 1; | ||
312 | |||
313 | bfunc = pgfx_blockfuncs[drawmode]; | ||
314 | dst = &gfx_buffer[pixel_height * (x1/5) + y]; | ||
315 | nx = x2 - (x1 - (x1 % 5)); | ||
316 | mask = 0x1F >> (x1 % 5); | ||
317 | mask_right = 0x1F0 >> (nx % 5); | ||
318 | |||
319 | for (; nx >= 5; nx -= 5) | ||
320 | { | ||
321 | bfunc(dst, mask, 0xFFu); | ||
322 | dst += pixel_height; | ||
323 | mask = 0x1F; | ||
324 | } | ||
325 | mask &= mask_right; | ||
326 | bfunc(dst, mask, 0x1F); | ||
327 | } | ||
328 | |||
329 | /* Draw a vertical line (optimised) */ | ||
330 | void pgfx_vline(int x, int y1, int y2) | ||
331 | { | ||
332 | int y; | ||
333 | unsigned char *dst, *dst_end; | ||
334 | unsigned mask; | ||
335 | lcd_blockfunc_type *bfunc; | ||
336 | |||
337 | /* direction flip */ | ||
338 | if (y2 < y1) | ||
339 | { | ||
340 | y = y1; | ||
341 | y1 = y2; | ||
342 | y2 = y; | ||
343 | } | ||
344 | |||
345 | /* nothing to draw? */ | ||
346 | if (((unsigned)x >= (unsigned)pixel_width) || (y1 >= pixel_height) | ||
347 | || (y2 < 0)) | ||
348 | return; | ||
349 | |||
350 | /* clipping */ | ||
351 | if (y1 < 0) | ||
352 | y1 = 0; | ||
353 | if (y2 >= pixel_height) | ||
354 | y2 = pixel_height - 1; | ||
355 | |||
356 | bfunc = pgfx_blockfuncs[drawmode]; | ||
357 | dst = &gfx_buffer[pixel_height * (x/5) + y1]; | ||
358 | mask = 0x10 >> (x % 5); | ||
359 | |||
360 | dst_end = dst + y2 - y1; | ||
361 | do | ||
362 | bfunc(dst++, mask, 0x1F); | ||
363 | while (dst <= dst_end); | ||
364 | } | ||
365 | |||
366 | /* Draw a rectangular box */ | ||
367 | void pgfx_drawrect(int x, int y, int width, int height) | ||
368 | { | ||
369 | if ((width <= 0) || (height <= 0)) | ||
370 | return; | ||
371 | |||
372 | int x2 = x + width - 1; | ||
373 | int y2 = y + height - 1; | ||
374 | |||
375 | pgfx_vline(x, y, y2); | ||
376 | pgfx_vline(x2, y, y2); | ||
377 | pgfx_hline(x, x2, y); | ||
378 | pgfx_hline(x, x2, y2); | ||
379 | } | ||
380 | |||
381 | /* Fill a rectangular area */ | ||
382 | void pgfx_fillrect(int x, int y, int width, int height) | ||
383 | { | ||
384 | int nx; | ||
385 | unsigned char *dst, *dst_end; | ||
386 | unsigned mask, mask_right; | ||
387 | lcd_blockfunc_type *bfunc; | ||
388 | |||
389 | /* nothing to draw? */ | ||
390 | if ((width <= 0) || (height <= 0) || (x >= pixel_width) | ||
391 | || (y >= pixel_height) || (x + width <= 0) || (y + height <= 0)) | ||
392 | return; | ||
393 | |||
394 | /* clipping */ | ||
395 | if (x < 0) | ||
396 | { | ||
397 | width += x; | ||
398 | x = 0; | ||
399 | } | ||
400 | if (y < 0) | ||
401 | { | ||
402 | height += y; | ||
403 | y = 0; | ||
404 | } | ||
405 | if (x + width > pixel_width) | ||
406 | width = pixel_width - x; | ||
407 | if (y + height > pixel_height) | ||
408 | height = pixel_height - y; | ||
409 | |||
410 | bfunc = pgfx_blockfuncs[drawmode]; | ||
411 | dst = &gfx_buffer[pixel_height * (x/5) + y]; | ||
412 | nx = width - 1 + (x % 5); | ||
413 | mask = 0x1F >> (x % 5); | ||
414 | mask_right = 0x1F0 >> (nx % 5); | ||
415 | |||
416 | for (; nx >= 5; nx -= 5) | ||
417 | { | ||
418 | unsigned char *dst_col = dst; | ||
419 | |||
420 | dst_end = dst_col + height; | ||
421 | do | ||
422 | bfunc(dst_col++, mask, 0x1F); | ||
423 | while (dst_col < dst_end); | ||
424 | |||
425 | dst += pixel_height; | ||
426 | mask = 0x1F; | ||
427 | } | ||
428 | mask &= mask_right; | ||
429 | |||
430 | dst_end = dst + height; | ||
431 | do | ||
432 | bfunc(dst++, mask, 0x1F); | ||
433 | while (dst < dst_end); | ||
434 | } | ||
435 | |||
436 | /* About PlayerGFX internal bitmap format: | ||
437 | * | ||
438 | * A bitmap contains one bit for every pixel that defines if that pixel is | ||
439 | * black (1) or white (0). Bits within a byte are arranged horizontally, | ||
440 | * MSB at the left. | ||
441 | * The bytes are stored in row-major order, with byte 0 being top left, | ||
442 | * byte 1 2nd from left etc. Each row of bytes defines one pixel row. | ||
443 | * | ||
444 | * This approximates the (even more strange) internal hardware format. */ | ||
445 | |||
446 | /* Draw a partial bitmap. stride is given in pixels */ | ||
447 | void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
448 | int stride, int x, int y, int width, int height) | ||
449 | { | ||
450 | int nx, shift; | ||
451 | unsigned char *dst, *dst_end; | ||
452 | unsigned mask, mask_right; | ||
453 | lcd_blockfunc_type *bfunc; | ||
454 | |||
455 | /* nothing to draw? */ | ||
456 | if ((width <= 0) || (height <= 0) || (x >= pixel_width) | ||
457 | || (y >= pixel_height) || (x + width <= 0) || (y + height <= 0)) | ||
458 | return; | ||
459 | |||
460 | /* clipping */ | ||
461 | if (x < 0) | ||
462 | { | ||
463 | width += x; | ||
464 | src_x -= x; | ||
465 | x = 0; | ||
466 | } | ||
467 | if (y < 0) | ||
468 | { | ||
469 | height += y; | ||
470 | src_y -= y; | ||
471 | y = 0; | ||
472 | } | ||
473 | if (x + width > pixel_width) | ||
474 | width = pixel_width - x; | ||
475 | if (y + height > pixel_height) | ||
476 | height = pixel_height - y; | ||
477 | |||
478 | stride = (stride + 7) >> 3; /* convert to no. of bytes */ | ||
479 | |||
480 | src += stride * src_y + (src_x >> 3); /* move starting point */ | ||
481 | dst = &gfx_buffer[pixel_height * (x/5) + y]; | ||
482 | shift = 3 + (x % 5) - (src_x & 7); | ||
483 | nx = width - 1 + (x % 5); | ||
484 | |||
485 | bfunc = pgfx_blockfuncs[drawmode]; | ||
486 | mask = 0x1F >> (x % 5); | ||
487 | mask_right = 0x1F0 >> (nx % 5); | ||
488 | |||
489 | dst_end = dst + height; | ||
490 | do | ||
491 | { | ||
492 | const unsigned char *src_row = src; | ||
493 | unsigned char *dst_row = dst++; | ||
494 | unsigned mask_row = mask; | ||
495 | unsigned data = *src_row++; | ||
496 | int extrabits = shift; | ||
497 | |||
498 | for (x = nx; x >= 5; x -= 5) | ||
499 | { | ||
500 | if (extrabits < 0) | ||
501 | { | ||
502 | data = (data << 8) | *src_row++; | ||
503 | extrabits += 8; | ||
504 | } | ||
505 | bfunc(dst_row, mask_row, data >> extrabits); | ||
506 | extrabits -= 5; | ||
507 | dst_row += pixel_height; | ||
508 | mask_row = 0x1F; | ||
509 | } | ||
510 | if (extrabits < 0) | ||
511 | { | ||
512 | data = (data << 8) | *src_row; | ||
513 | extrabits += 8; | ||
514 | } | ||
515 | bfunc(dst_row, mask_row & mask_right, data >> extrabits); | ||
516 | |||
517 | src += stride; | ||
518 | } | ||
519 | while (dst < dst_end); | ||
520 | } | ||
521 | |||
522 | /* Draw a full bitmap */ | ||
523 | void pgfx_bitmap(const unsigned char *src, int x, int y, int width, int height) | ||
524 | { | ||
525 | pgfx_bitmap_part(src, 0, 0, width, x, y, width, height); | ||
526 | } | ||
diff --git a/apps/plugins/lib/playergfx.h b/apps/plugins/lib/playergfx.h deleted file mode 100644 index 9f1305af12..0000000000 --- a/apps/plugins/lib/playergfx.h +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Bitmap graphics on player LCD! | ||
11 | * | ||
12 | * Copyright (C) 2005 Jens Arnold | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #ifndef __PGFX_H__ | ||
25 | #define __PGFX_H__ | ||
26 | |||
27 | #include "plugin.h" | ||
28 | |||
29 | #ifdef HAVE_LCD_CHARCELLS /* Player only :) */ | ||
30 | |||
31 | bool pgfx_init(int cwidth, int cheight); | ||
32 | void pgfx_release(void); | ||
33 | void pgfx_display(int cx, int cy); | ||
34 | void pgfx_display_block(int cx, int cy, int x, int y); | ||
35 | void pgfx_update(void); | ||
36 | |||
37 | void pgfx_set_drawmode(int mode); | ||
38 | int pgfx_get_drawmode(void); | ||
39 | |||
40 | void pgfx_clear_display(void); | ||
41 | void pgfx_drawpixel(int x, int y); | ||
42 | void pgfx_drawline(int x1, int y1, int x2, int y2); | ||
43 | void pgfx_hline(int x1, int x2, int y); | ||
44 | void pgfx_vline(int x, int y1, int y2); | ||
45 | void pgfx_drawrect(int x, int y, int width, int height); | ||
46 | void pgfx_fillrect(int x, int y, int width, int height); | ||
47 | void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
48 | int stride, int x, int y, int width, int height); | ||
49 | void pgfx_bitmap(const unsigned char *src, int x, int y, int width, int height); | ||
50 | |||
51 | #define pgfx_mono_bitmap_part pgfx_bitmap_part | ||
52 | #define pgfx_mono_bitmap pgfx_bitmap | ||
53 | |||
54 | #endif /* HAVE_LCD_CHARCELLS */ | ||
55 | #endif /* __PGFX_H__ */ | ||
diff --git a/apps/plugins/lib/simple_viewer.c b/apps/plugins/lib/simple_viewer.c index 6927d84a96..4c05ee68c5 100644 --- a/apps/plugins/lib/simple_viewer.c +++ b/apps/plugins/lib/simple_viewer.c | |||
@@ -64,17 +64,12 @@ static const char* get_next_line(const char *text, struct view_info *info) | |||
64 | total = 0; | 64 | total = 0; |
65 | while(*ptr) | 65 | while(*ptr) |
66 | { | 66 | { |
67 | #ifdef HAVE_LCD_CHARCELLS | ||
68 | n = rb->utf8seek(ptr, 1); | ||
69 | w = 1; | ||
70 | #else | ||
71 | unsigned short ch; | 67 | unsigned short ch; |
72 | n = ((intptr_t)rb->utf8decode(ptr, &ch) - (intptr_t)ptr); | 68 | n = ((intptr_t)rb->utf8decode(ptr, &ch) - (intptr_t)ptr); |
73 | if (rb->is_diacritic(ch, NULL)) | 69 | if (rb->is_diacritic(ch, NULL)) |
74 | w = 0; | 70 | w = 0; |
75 | else | 71 | else |
76 | w = rb->font_get_width(info->pf, ch); | 72 | w = rb->font_get_width(info->pf, ch); |
77 | #endif | ||
78 | if (isbrchr(ptr, n)) | 73 | if (isbrchr(ptr, n)) |
79 | space = ptr+(isspace(*ptr) || total + w <= info->vp.width? n: 0); | 74 | space = ptr+(isspace(*ptr) || total + w <= info->vp.width? n: 0); |
80 | if (*ptr == '\n') | 75 | if (*ptr == '\n') |