summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/cube.c44
-rw-r--r--apps/plugins/fft/fft.c3
-rw-r--r--apps/plugins/fractals/fractal.c30
-rw-r--r--apps/plugins/fractals/fractal_sets.h2
-rw-r--r--apps/plugins/imageviewer/bmp/bmp.c2
-rw-r--r--apps/plugins/imageviewer/imageviewer.c22
-rw-r--r--apps/plugins/imageviewer/imageviewer.h8
-rw-r--r--apps/plugins/imageviewer/jpeg/jpeg.c2
-rw-r--r--apps/plugins/lib/mylcd.h91
-rw-r--r--apps/plugins/mosaique.c23
-rw-r--r--apps/plugins/pictureflow/pictureflow.c43
-rw-r--r--apps/plugins/rockblox.c21
-rw-r--r--apps/plugins/snow.c11
-rw-r--r--apps/plugins/test_core_jpeg.c9
-rw-r--r--apps/plugins/test_gfx.c116
-rw-r--r--apps/plugins/test_mem_jpeg.c9
16 files changed, 223 insertions, 213 deletions
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 5c6f9934eb..2b1e00d690 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -21,8 +21,14 @@
21* 21*
22***************************************************************************/ 22***************************************************************************/
23#include "plugin.h" 23#include "plugin.h"
24#include "lib/grey.h"
25#include "lib/playergfx.h" 24#include "lib/playergfx.h"
25#if LCD_DEPTH > 1
26#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */
27#include "lib/grey.h"
28#else
29#include "lib/grey.h"
30#include "lib/mylcd.h" /* MYLCD_CFG_GREYLIB or MYLCD_CFG_PGFX */
31#endif
26#include "lib/xlcd.h" 32#include "lib/xlcd.h"
27#include "lib/fixedpoint.h" 33#include "lib/fixedpoint.h"
28 34
@@ -339,15 +345,9 @@ static struct my_lcd lcdfuncs; /* initialised at runtime */
339static struct my_lcd *mylcd = &greyfuncs; 345static struct my_lcd *mylcd = &greyfuncs;
340 346
341#define MYLCD(fn) mylcd->fn 347#define MYLCD(fn) mylcd->fn
342#define MY_FILLTRIANGLE(x1, y1, x2, y2, x3, y3) grey_filltriangle(x1, y1, x2, y2, x3, y3)
343#define MY_SET_FOREGROUND(fg) grey_set_foreground(fg)
344#define MY_GET_FOREGROUND() grey_get_foreground()
345 348
346#else 349#else
347#define MYLCD(fn) rb->lcd_ ## fn 350#define MYLCD(fn) rb->lcd_ ## fn
348#define MY_FILLTRIANGLE(x1, y1, x2, y2, x3, y3) xlcd_filltriangle(x1, y1, x2, y2, x3, y3)
349#define MY_SET_FOREGROUND(fg) rb->lcd_set_foreground(fg)
350#define MY_GET_FOREGROUND() rb->lcd_get_foreground()
351#endif 351#endif
352 352
353#if CONFIG_LCD == LCD_SSD1815 353#if CONFIG_LCD == LCD_SSD1815
@@ -540,7 +540,7 @@ static void cube_draw(void)
540#if LCD_DEPTH > 1 || defined(USEGSLIB) 540#if LCD_DEPTH > 1 || defined(USEGSLIB)
541 case SOLID: 541 case SOLID:
542 542
543 old_foreground = MY_GET_FOREGROUND(); 543 old_foreground = mylcd_get_foreground();
544 for (i = 0; i < 6; i++) 544 for (i = 0; i < 6; i++)
545 { 545 {
546 /* backface culling; if the shape winds counter-clockwise, we are 546 /* backface culling; if the shape winds counter-clockwise, we are
@@ -552,22 +552,22 @@ static void cube_draw(void)
552 * (point2D[faces[i].corner[2]].x - point2D[faces[i].corner[1]].x)) 552 * (point2D[faces[i].corner[2]].x - point2D[faces[i].corner[1]].x))
553 continue; 553 continue;
554 554
555 MY_SET_FOREGROUND(face_colors[i]); 555 mylcd_set_foreground(face_colors[i]);
556 MY_FILLTRIANGLE(point2D[faces[i].corner[0]].x, 556 mylcd_filltriangle(point2D[faces[i].corner[0]].x,
557 point2D[faces[i].corner[0]].y, 557 point2D[faces[i].corner[0]].y,
558 point2D[faces[i].corner[1]].x, 558 point2D[faces[i].corner[1]].x,
559 point2D[faces[i].corner[1]].y, 559 point2D[faces[i].corner[1]].y,
560 point2D[faces[i].corner[2]].x, 560 point2D[faces[i].corner[2]].x,
561 point2D[faces[i].corner[2]].y); 561 point2D[faces[i].corner[2]].y);
562 MY_FILLTRIANGLE(point2D[faces[i].corner[0]].x, 562 mylcd_filltriangle(point2D[faces[i].corner[0]].x,
563 point2D[faces[i].corner[0]].y, 563 point2D[faces[i].corner[0]].y,
564 point2D[faces[i].corner[2]].x, 564 point2D[faces[i].corner[2]].x,
565 point2D[faces[i].corner[2]].y, 565 point2D[faces[i].corner[2]].y,
566 point2D[faces[i].corner[3]].x, 566 point2D[faces[i].corner[3]].x,
567 point2D[faces[i].corner[3]].y); 567 point2D[faces[i].corner[3]].y);
568 568
569 } 569 }
570 MY_SET_FOREGROUND(old_foreground); 570 mylcd_set_foreground(old_foreground);
571 break; 571 break;
572#endif /* (LCD_DEPTH > 1) || GSLIB */ 572#endif /* (LCD_DEPTH > 1) || GSLIB */
573 573
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index b971a8f92f..e352c1c041 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -22,13 +22,12 @@
22 22
23#include "lib/helper.h" 23#include "lib/helper.h"
24#include "lib/xlcd.h" 24#include "lib/xlcd.h"
25#include "lib/mylcd.h"
26#include "math.h" 25#include "math.h"
27#include "fracmul.h" 26#include "fracmul.h"
28
29#ifndef HAVE_LCD_COLOR 27#ifndef HAVE_LCD_COLOR
30#include "lib/grey.h" 28#include "lib/grey.h"
31#endif 29#endif
30#include "lib/mylcd.h"
32 31
33PLUGIN_HEADER 32PLUGIN_HEADER
34 33
diff --git a/apps/plugins/fractals/fractal.c b/apps/plugins/fractals/fractal.c
index ff768a9516..971ae506ca 100644
--- a/apps/plugins/fractals/fractal.c
+++ b/apps/plugins/fractals/fractal.c
@@ -31,16 +31,6 @@
31#include "mandelbrot_set.h" 31#include "mandelbrot_set.h"
32 32
33#ifdef USEGSLIB 33#ifdef USEGSLIB
34#define MYLCD(fn) grey_ub_ ## fn
35#define MYLCD_UPDATE()
36#define MYXLCD(fn) grey_ub_ ## fn
37#else
38#define MYLCD(fn) rb->lcd_ ## fn
39#define MYLCD_UPDATE() rb->lcd_update();
40#define MYXLCD(fn) xlcd_ ## fn
41#endif
42
43#ifdef USEGSLIB
44GREY_INFO_STRUCT 34GREY_INFO_STRUCT
45static unsigned char *gbuf; 35static unsigned char *gbuf;
46static size_t gbuf_size = 0; 36static size_t gbuf_size = 0;
@@ -143,8 +133,8 @@ enum plugin_status plugin_start(const void* parameter)
143 switch (redraw) 133 switch (redraw)
144 { 134 {
145 case REDRAW_FULL: 135 case REDRAW_FULL:
146 MYLCD(clear_display)(); 136 mylcd_ub_clear_display();
147 MYLCD_UPDATE(); 137 mylcd_ub_update();
148 /* fall-through */ 138 /* fall-through */
149 case REDRAW_FULL_OVERLAY: 139 case REDRAW_FULL_OVERLAY:
150 rects_queue_init(); 140 rects_queue_init();
@@ -200,32 +190,32 @@ enum plugin_status plugin_start(const void* parameter)
200 190
201 case FRACTAL_UP: 191 case FRACTAL_UP:
202 ops->move(0, +1); 192 ops->move(0, +1);
203 MYXLCD(scroll_down)(LCD_SHIFT_Y); 193 mylcd_ub_scroll_down(LCD_SHIFT_Y);
204 MYLCD_UPDATE(); 194 mylcd_ub_update();
205 if (redraw != REDRAW_FULL) 195 if (redraw != REDRAW_FULL)
206 redraw = rects_move_down() ? REDRAW_FULL : REDRAW_PARTIAL; 196 redraw = rects_move_down() ? REDRAW_FULL : REDRAW_PARTIAL;
207 break; 197 break;
208 198
209 case FRACTAL_DOWN: 199 case FRACTAL_DOWN:
210 ops->move(0, -1); 200 ops->move(0, -1);
211 MYXLCD(scroll_up)(LCD_SHIFT_Y); 201 mylcd_ub_scroll_up(LCD_SHIFT_Y);
212 MYLCD_UPDATE(); 202 mylcd_ub_update();
213 if (redraw != REDRAW_FULL) 203 if (redraw != REDRAW_FULL)
214 redraw = rects_move_up() ? REDRAW_FULL : REDRAW_PARTIAL; 204 redraw = rects_move_up() ? REDRAW_FULL : REDRAW_PARTIAL;
215 break; 205 break;
216 206
217 case FRACTAL_LEFT: 207 case FRACTAL_LEFT:
218 ops->move(-1, 0); 208 ops->move(-1, 0);
219 MYXLCD(scroll_right)(LCD_SHIFT_X); 209 mylcd_ub_scroll_right(LCD_SHIFT_X);
220 MYLCD_UPDATE(); 210 mylcd_ub_update();
221 if (redraw != REDRAW_FULL) 211 if (redraw != REDRAW_FULL)
222 redraw = rects_move_right() ? REDRAW_FULL : REDRAW_PARTIAL; 212 redraw = rects_move_right() ? REDRAW_FULL : REDRAW_PARTIAL;
223 break; 213 break;
224 214
225 case FRACTAL_RIGHT: 215 case FRACTAL_RIGHT:
226 ops->move(+1, 0); 216 ops->move(+1, 0);
227 MYXLCD(scroll_left)(LCD_SHIFT_X); 217 mylcd_ub_scroll_left(LCD_SHIFT_X);
228 MYLCD_UPDATE(); 218 mylcd_ub_update();
229 if (redraw != REDRAW_FULL) 219 if (redraw != REDRAW_FULL)
230 redraw = rects_move_left() ? REDRAW_FULL : REDRAW_PARTIAL; 220 redraw = rects_move_left() ? REDRAW_FULL : REDRAW_PARTIAL;
231 break; 221 break;
diff --git a/apps/plugins/fractals/fractal_sets.h b/apps/plugins/fractals/fractal_sets.h
index b2eaa589dc..865517b5b5 100644
--- a/apps/plugins/fractals/fractal_sets.h
+++ b/apps/plugins/fractals/fractal_sets.h
@@ -30,6 +30,8 @@
30#include "lib/xlcd.h" 30#include "lib/xlcd.h"
31#endif 31#endif
32 32
33#include "lib/mylcd.h"
34
33#define DELTA 8 /* Panning moves 1/DELTA of screen */ 35#define DELTA 8 /* Panning moves 1/DELTA of screen */
34 36
35#define LCD_SHIFT_X (LCD_WIDTH / DELTA) 37#define LCD_SHIFT_X (LCD_WIDTH / DELTA)
diff --git a/apps/plugins/imageviewer/bmp/bmp.c b/apps/plugins/imageviewer/bmp/bmp.c
index 1229ac3d35..6b5c4b1759 100644
--- a/apps/plugins/imageviewer/bmp/bmp.c
+++ b/apps/plugins/imageviewer/bmp/bmp.c
@@ -119,7 +119,7 @@ void draw_image_rect(struct image_info *info,
119 y + MAX(0, (LCD_HEIGHT-info->height)/2), 119 y + MAX(0, (LCD_HEIGHT-info->height)/2),
120 width, height); 120 width, height);
121#else 121#else
122 MYXLCD(gray_bitmap_part)( 122 mylcd_ub_gray_bitmap_part(
123 pdisp->bitmap, info->x + x, info->y + y, info->width, 123 pdisp->bitmap, info->x + x, info->y + y, info->width,
124 x + MAX(0, (LCD_WIDTH-info->width)/2), 124 x + MAX(0, (LCD_WIDTH-info->width)/2),
125 y + MAX(0, (LCD_HEIGHT-info->height)/2), 125 y + MAX(0, (LCD_HEIGHT-info->height)/2),
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c
index ed41719cca..0fd25e7b29 100644
--- a/apps/plugins/imageviewer/imageviewer.c
+++ b/apps/plugins/imageviewer/imageviewer.c
@@ -416,10 +416,10 @@ static void pan_view_right(struct image_info *info)
416 move = MIN(HSCROLL, info->width - info->x - LCD_WIDTH); 416 move = MIN(HSCROLL, info->width - info->x - LCD_WIDTH);
417 if (move > 0) 417 if (move > 0)
418 { 418 {
419 MYXLCD(scroll_left)(move); /* scroll left */ 419 mylcd_ub_scroll_left(move); /* scroll left */
420 info->x += move; 420 info->x += move;
421 draw_image_rect(info, LCD_WIDTH - move, 0, move, info->height-info->y); 421 draw_image_rect(info, LCD_WIDTH - move, 0, move, info->height-info->y);
422 MYLCD_UPDATE(); 422 mylcd_ub_update();
423 } 423 }
424} 424}
425 425
@@ -432,10 +432,10 @@ static void pan_view_left(struct image_info *info)
432 move = MIN(HSCROLL, info->x); 432 move = MIN(HSCROLL, info->x);
433 if (move > 0) 433 if (move > 0)
434 { 434 {
435 MYXLCD(scroll_right)(move); /* scroll right */ 435 mylcd_ub_scroll_right(move); /* scroll right */
436 info->x -= move; 436 info->x -= move;
437 draw_image_rect(info, 0, 0, move, info->height-info->y); 437 draw_image_rect(info, 0, 0, move, info->height-info->y);
438 MYLCD_UPDATE(); 438 mylcd_ub_update();
439 } 439 }
440} 440}
441 441
@@ -448,7 +448,7 @@ static void pan_view_up(struct image_info *info)
448 move = MIN(VSCROLL, info->y); 448 move = MIN(VSCROLL, info->y);
449 if (move > 0) 449 if (move > 0)
450 { 450 {
451 MYXLCD(scroll_down)(move); /* scroll down */ 451 mylcd_ub_scroll_down(move); /* scroll down */
452 info->y -= move; 452 info->y -= move;
453#if defined(HAVE_LCD_COLOR) && defined(JPEG_VIEWER) 453#if defined(HAVE_LCD_COLOR) && defined(JPEG_VIEWER)
454 if (settings.jpeg_dither_mode == DITHER_DIFFUSION) 454 if (settings.jpeg_dither_mode == DITHER_DIFFUSION)
@@ -459,7 +459,7 @@ static void pan_view_up(struct image_info *info)
459 } 459 }
460#endif 460#endif
461 draw_image_rect(info, 0, 0, info->width-info->x, move); 461 draw_image_rect(info, 0, 0, info->width-info->x, move);
462 MYLCD_UPDATE(); 462 mylcd_ub_update();
463 } 463 }
464} 464}
465 465
@@ -472,7 +472,7 @@ static void pan_view_down(struct image_info *info)
472 move = MIN(VSCROLL, info->height - info->y - LCD_HEIGHT); 472 move = MIN(VSCROLL, info->height - info->y - LCD_HEIGHT);
473 if (move > 0) 473 if (move > 0)
474 { 474 {
475 MYXLCD(scroll_up)(move); /* scroll up */ 475 mylcd_ub_scroll_up(move); /* scroll up */
476 info->y += move; 476 info->y += move;
477#if defined(HAVE_LCD_COLOR) && defined(JPEG_VIEWER) 477#if defined(HAVE_LCD_COLOR) && defined(JPEG_VIEWER)
478 if (settings.jpeg_dither_mode == DITHER_DIFFUSION) 478 if (settings.jpeg_dither_mode == DITHER_DIFFUSION)
@@ -499,7 +499,7 @@ static void pan_view_down(struct image_info *info)
499 info->y++; 499 info->y++;
500 } 500 }
501#endif 501#endif
502 MYLCD_UPDATE(); 502 mylcd_ub_update();
503 } 503 }
504} 504}
505 505
@@ -611,7 +611,7 @@ static int scroll_bmp(struct image_info *info)
611#else 611#else
612 draw_image_rect(info, 0, 0, 612 draw_image_rect(info, 0, 0,
613 info->width-info->x, info->height-info->y); 613 info->width-info->x, info->height-info->y);
614 MYLCD_UPDATE(); 614 mylcd_ub_update();
615#endif 615#endif
616 break; 616 break;
617 617
@@ -783,10 +783,10 @@ static int load_and_show(char* filename, struct image_info *info)
783 rb->lcd_update(); 783 rb->lcd_update();
784 } 784 }
785 785
786 MYLCD(clear_display)(); 786 mylcd_ub_clear_display();
787 draw_image_rect(info, 0, 0, 787 draw_image_rect(info, 0, 0,
788 info->width-info->x, info->height-info->y); 788 info->width-info->x, info->height-info->y);
789 MYLCD_UPDATE(); 789 mylcd_ub_update();
790 790
791#ifdef USEGSLIB 791#ifdef USEGSLIB
792 grey_show(true); /* switch on greyscale overlay */ 792 grey_show(true); /* switch on greyscale overlay */
diff --git a/apps/plugins/imageviewer/imageviewer.h b/apps/plugins/imageviewer/imageviewer.h
index b704701cda..5f22b03e97 100644
--- a/apps/plugins/imageviewer/imageviewer.h
+++ b/apps/plugins/imageviewer/imageviewer.h
@@ -366,16 +366,12 @@
366#if LCD_DEPTH < 8 366#if LCD_DEPTH < 8
367#define USEGSLIB 367#define USEGSLIB
368#include <lib/grey.h> 368#include <lib/grey.h>
369#define MYLCD(fn) grey_ub_ ## fn
370#define MYLCD_UPDATE()
371#define MYXLCD(fn) grey_ub_ ## fn
372#else 369#else
373#include <lib/xlcd.h> 370#include <lib/xlcd.h>
374#define MYLCD(fn) rb->lcd_ ## fn
375#define MYLCD_UPDATE() rb->lcd_update();
376#define MYXLCD(fn) xlcd_ ## fn
377#endif 371#endif
378 372
373#include <lib/mylcd.h>
374
379/* Min memory allowing us to use the plugin buffer 375/* Min memory allowing us to use the plugin buffer
380 * and thus not stopping the music 376 * and thus not stopping the music
381 * *Very* rough estimation: 377 * *Very* rough estimation:
diff --git a/apps/plugins/imageviewer/jpeg/jpeg.c b/apps/plugins/imageviewer/jpeg/jpeg.c
index b16ec1c4b1..95e493e7ee 100644
--- a/apps/plugins/imageviewer/jpeg/jpeg.c
+++ b/apps/plugins/imageviewer/jpeg/jpeg.c
@@ -94,7 +94,7 @@ void draw_image_rect(struct image_info *info,
94 width, height, 94 width, height,
95 settings.jpeg_colour_mode, settings.jpeg_dither_mode); 95 settings.jpeg_colour_mode, settings.jpeg_dither_mode);
96#else 96#else
97 MYXLCD(gray_bitmap_part)( 97 mylcd_ub_gray_bitmap_part(
98 pdisp->bitmap[0], info->x + x, info->y + y, pdisp->stride, 98 pdisp->bitmap[0], info->x + x, info->y + y, pdisp->stride,
99 x + MAX(0, (LCD_WIDTH-info->width)/2), 99 x + MAX(0, (LCD_WIDTH-info->width)/2),
100 y + MAX(0, (LCD_HEIGHT-info->height)/2), 100 y + MAX(0, (LCD_HEIGHT-info->height)/2),
diff --git a/apps/plugins/lib/mylcd.h b/apps/plugins/lib/mylcd.h
index 8b6223c30b..48e8ca1d47 100644
--- a/apps/plugins/lib/mylcd.h
+++ b/apps/plugins/lib/mylcd.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Copyright (c) 2010 Michael Sevakis 10 * Copyright (c) 2010 Michael Sevakis
11 * 11 *
12 * Helper defines for writing code for both grey and color targets. 12 * Helper defines for writing code for pgfx, grey and color targets.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
@@ -24,63 +24,90 @@
24#define MYLCD_H 24#define MYLCD_H
25 25
26/*** 26/***
27 * Most functions are, other than color depth, equivalent between grey, lcd 27 * Most functions are, other than color depth, equivalent between pgfx, grey,
28 * and xlcd and most of the time the caller need not be concerned with which 28 * lcd and xlcd and most of the time the caller need not be concerned with
29 * is actually called, making code nicer to read and maintain. 29 * which is actually called, making code nicer to read and maintain.
30 * 30 *
31 * Unbuffered routines revert to standard rb->lcd_XXXX funtions on color 31 * Unbuffered routines revert to standard rb->lcd_XXXX funtions on color
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 *
35 * lib/playergfx.h or lib/grey.h should be included before including this
36 * header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise.
34 */ 37 */
38#if defined (HAVE_LCD_CHARCELLS) && defined(__PGFX_H__)
39#define MYLCD_CFG_PGFX /* using PGFX */
40#define mylcd_(fn) pgfx_##fn
41#define mylcd_ub_(fn) pgfx_##fn
35 42
36#ifdef HAVE_LCD_COLOR 43#elif defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 8) && defined(__GREY_H__)
37#define mylcd_(fn) rb->lcd_##fn 44#define MYLCD_CFG_GREYLIB /* using greylib */
38#define myxlcd_(fn) xlcd_##fn
39#define mylcd_ub_(fn) rb->lcd_##fn
40#define myxlcd_ub_(fn) xlcd_##fn
41#else
42#define mylcd_(fn) grey_##fn 45#define mylcd_(fn) grey_##fn
43#define myxlcd_(fn) grey_##fn 46#define myxlcd_(fn) grey_##fn
44#define mylcd_ub_(fn) grey_ub_##fn 47#define mylcd_ub_(fn) grey_ub_##fn
45#define myxlcd_ub_(fn) grey_ub_##fn 48#define myxlcd_ub_(fn) grey_ub_##fn
46#endif
47 49
48/* Common colors */ 50/* Common colors */
49#ifdef HAVE_LCD_COLOR 51#define MYLCD_BLACK GREY_BLACK
52#define MYLCD_DARKGRAY GREY_DARKGRAY
53#define MYLCD_LIGHTGRAY GREY_LIGHTGRAY
54#define MYLCD_WHITE GREY_WHITE
55#define MYLCD_DEFAULT_FG GREY_BLACK
56#define MYLCD_DEFAULT_BG GREY_WHITE
57
58#elif defined (HAVE_LCD_BITMAP)
59#define MYLCD_CFG_RB_XLCD /* using standard (X)LCD routines */
60#define mylcd_(fn) rb->lcd_##fn
61#define myxlcd_(fn) xlcd_##fn
62#define mylcd_ub_(fn) rb->lcd_##fn
63#define myxlcd_ub_(fn) xlcd_##fn
64
65/* Common colors */
50#define MYLCD_BLACK LCD_BLACK 66#define MYLCD_BLACK LCD_BLACK
51#define MYLCD_DARKGRAY LCD_DARKGRAY 67#define MYLCD_DARKGRAY LCD_DARKGRAY
52#define MYLCD_LIGHTGRAY LCD_LIGHTGRAY 68#define MYLCD_LIGHTGRAY LCD_LIGHTGRAY
53#define MYLCD_WHITE LCD_WHITE 69#define MYLCD_WHITE LCD_WHITE
54#define MYLCD_DEFAULT_FG LCD_DEFAULT_FG 70#define MYLCD_DEFAULT_FG LCD_DEFAULT_FG
55#define MYLCD_DEFAULT_BG LCD_DEFAULT_BG 71#define MYLCD_DEFAULT_BG LCD_DEFAULT_BG
72
56#else 73#else
57#define MYLCD_BLACK GREY_BLACK 74#error Configuration not supported! Did you forget to include the correct lib header?
58#define MYLCD_DARKGRAY GREY_DARKGRAY 75#endif /* end LCD type selection */
59#define MYLCD_LIGHTGRAY GREY_LIGHTGRAY
60#define MYLCD_WHITE GREY_WHITE
61#define MYLCD_DEFAULT_FG GREY_BLACK
62#define MYLCD_DEFAULT_BG GREY_WHITE
63#endif /* HAVE_LCD_COLOR */
64 76
65/* Update functions */ 77/* Update functions */
66#define mylcd_update mylcd_(update) 78#define mylcd_update mylcd_(update)
79#ifdef HAVE_LCD_BITMAP
67#define mylcd_update_rect mylcd_(update_rect) 80#define mylcd_update_rect mylcd_(update_rect)
68
69/* Update functions - unbuffered : special handling for these */
70#ifdef HAVE_LCD_COLOR
71#define mylcd_ub_update() rb->lcd_update()
72#define mylcd_ub_update_rect(...) rb->lcd_update_rect(__VA_ARGS__)
73#else 81#else
74/* Still evaluate args like functions */ 82static inline void mylcd_update_rect(int x, int y, int w, int h)
83 { (void)x; (void)y; (void)w; (void)h; pgfx_update(); }
84#endif /* HAVE_LCD_BITMAP */
85
86/* Update functions - unbuffered : special handling for these
87 * It is desirable to still evaluate arguments even if there will
88 * be no function call, just in case they have side-effects.
89 */
90#if defined (MYLCD_CFG_PGFX)
91#define mylcd_ub_update pgfx_update
92static inline void mylcd_ub_update_rect(int x, int y, int w, int h)
93 { (void)x; (void)y; (void)w; (void)h; pgfx_update(); }
94
95#elif defined (MYLCD_CFG_GREYLIB)
75static inline void mylcd_ub_update(void) 96static inline void mylcd_ub_update(void)
76 {} 97 {}
77static inline void mylcd_ub_update_rect(int x, int y, int w, int h) 98static inline void mylcd_ub_update_rect(int x, int y, int w, int h)
78 { (void)x; (void)y; (void)w; (void)h; } 99 { (void)x; (void)y; (void)w; (void)h; }
100
101#else /* color or RB default */
102#define mylcd_ub_update rb->lcd_update
103#define mylcd_ub_update_rect rb->lcd_update_rect
79#endif 104#endif
80 105
81/* Parameter handling */ 106/* Parameter handling */
82#define mylcd_set_drawmode mylcd_(set_drawmode) 107#define mylcd_set_drawmode mylcd_(set_drawmode)
83#define mylcd_get_drawmode mylcd_(get_drawmode) 108#define mylcd_get_drawmode mylcd_(get_drawmode)
109
110#ifdef HAVE_LCD_BITMAP
84#define mylcd_set_foreground mylcd_(set_foreground) 111#define mylcd_set_foreground mylcd_(set_foreground)
85#define mylcd_get_foreground mylcd_(get_foreground) 112#define mylcd_get_foreground mylcd_(get_foreground)
86#define mylcd_set_background mylcd_(set_background) 113#define mylcd_set_background mylcd_(set_background)
@@ -88,6 +115,7 @@ static inline void mylcd_ub_update_rect(int x, int y, int w, int h)
88#define mylcd_set_drawinfo mylcd_(set_drawinfo) 115#define mylcd_set_drawinfo mylcd_(set_drawinfo)
89#define mylcd_setfont mylcd_(setfont) 116#define mylcd_setfont mylcd_(setfont)
90#define mylcd_getstringsize mylcd_(getstringsize) 117#define mylcd_getstringsize mylcd_(getstringsize)
118#endif /* HAVE_LCD_BITMAP */
91 119
92/* Whole display */ 120/* Whole display */
93#define mylcd_clear_display mylcd_(clear_display) 121#define mylcd_clear_display mylcd_(clear_display)
@@ -106,37 +134,50 @@ static inline void mylcd_ub_update_rect(int x, int y, int w, int h)
106 134
107/* Filled Primitives */ 135/* Filled Primitives */
108#define mylcd_fillrect mylcd_(fillrect) 136#define mylcd_fillrect mylcd_(fillrect)
137#ifdef HAVE_LCD_BITMAP
109#define mylcd_filltriangle myxlcd_(filltriangle) 138#define mylcd_filltriangle myxlcd_(filltriangle)
139#endif /* HAVE_LCD_BITMAP */
110 140
111/* Bitmaps */ 141/* Bitmaps */
112#define mylcd_mono_bitmap_part mylcd_(mono_bitmap_part) 142#define mylcd_mono_bitmap_part mylcd_(mono_bitmap_part)
113#define mylcd_mono_bitmap mylcd_(mono_bitmap) 143#define mylcd_mono_bitmap mylcd_(mono_bitmap)
144
145#ifdef HAVE_LCD_BITMAP
114#define mylcd_gray_bitmap_part myxlcd_(gray_bitmap_part) 146#define mylcd_gray_bitmap_part myxlcd_(gray_bitmap_part)
115#define mylcd_gray_bitmap myxlcd_(gray_bitmap) 147#define mylcd_gray_bitmap myxlcd_(gray_bitmap)
116#if 0 /* possible, but not implemented in greylib */ 148#if 0 /* possible, but not implemented in greylib */
117#define mylcd_color_bitmap_part myxlcd_(color_bitmap_part) 149#define mylcd_color_bitmap_part myxlcd_(color_bitmap_part)
118#define mylcd_color_bitmap myxlcd_(color_bitmap) 150#define mylcd_color_bitmap myxlcd_(color_bitmap)
119#endif 151#endif
152#endif /* HAVE_LCD_BITMAP */
120 153
121/* Bitmaps - unbuffered */ 154/* Bitmaps - unbuffered */
155#ifdef HAVE_LCD_BITMAP
122#define mylcd_ub_gray_bitmap_part myxlcd_ub_(gray_bitmap_part) 156#define mylcd_ub_gray_bitmap_part myxlcd_ub_(gray_bitmap_part)
123#define mylcd_ub_gray_bitmap myxlcd_ub_(gray_bitmap) 157#define mylcd_ub_gray_bitmap myxlcd_ub_(gray_bitmap)
158#endif /* HAVE_LCD_BITMAP */
124 159
125/* Text */ 160/* Text */
126/* lcd_putsxyofs is static'ed in the core for now on color */ 161/* lcd_putsxyofs is static'ed in the core for now on color */
162#ifdef HAVE_LCD_BITMAP
127#define mylcd_putsxyofs mylcd_(putsxyofs) 163#define mylcd_putsxyofs mylcd_(putsxyofs)
128#define mylcd_putsxy mylcd_(putsxy) 164#define mylcd_putsxy mylcd_(putsxy)
165#endif /* HAVE_LCD_BITMAP */
129 166
130/* Scrolling */ 167/* Scrolling */
168#ifdef HAVE_LCD_BITMAP
131#define mylcd_scroll_left myxlcd_(scroll_left) 169#define mylcd_scroll_left myxlcd_(scroll_left)
132#define mylcd_scroll_right myxlcd_(scroll_right) 170#define mylcd_scroll_right myxlcd_(scroll_right)
133#define mylcd_scroll_up myxlcd_(scroll_up) 171#define mylcd_scroll_up myxlcd_(scroll_up)
134#define mylcd_scroll_down myxlcd_(scroll_down) 172#define mylcd_scroll_down myxlcd_(scroll_down)
173#endif /* HAVE_LCD_BITMAP */
135 174
136/* Scrolling - unbuffered */ 175/* Scrolling - unbuffered */
176#ifdef HAVE_LCD_BITMAP
137#define mylcd_ub_scroll_left myxlcd_ub_(scroll_left) 177#define mylcd_ub_scroll_left myxlcd_ub_(scroll_left)
138#define mylcd_ub_scroll_right myxlcd_ub_(scroll_right) 178#define mylcd_ub_scroll_right myxlcd_ub_(scroll_right)
139#define mylcd_ub_scroll_up myxlcd_ub_(scroll_up) 179#define mylcd_ub_scroll_up myxlcd_ub_(scroll_up)
140#define mylcd_ub_scroll_down myxlcd_ub_(scroll_down) 180#define mylcd_ub_scroll_down myxlcd_ub_(scroll_down)
181#endif /* HAVE_LCD_BITMAP */
141 182
142#endif /* MYLCD_H */ 183#endif /* MYLCD_H */
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index 6506c85560..43efc27d77 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -20,11 +20,11 @@
20 **************************************************************************/ 20 **************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playergfx.h" 22#include "lib/playergfx.h"
23#include "lib/mylcd.h"
23 24
24PLUGIN_HEADER 25PLUGIN_HEADER
25 26
26#ifdef HAVE_LCD_BITMAP 27#ifdef HAVE_LCD_BITMAP
27#define MYLCD(fn) rb->lcd_ ## fn
28#define GFX_X (LCD_WIDTH/2-1) 28#define GFX_X (LCD_WIDTH/2-1)
29#define GFX_Y (LCD_HEIGHT/2-1) 29#define GFX_Y (LCD_HEIGHT/2-1)
30#if LCD_WIDTH != LCD_HEIGHT 30#if LCD_WIDTH != LCD_HEIGHT
@@ -35,7 +35,6 @@ PLUGIN_HEADER
35#define GFX_HEIGHT (4*GFX_Y/5) 35#define GFX_HEIGHT (4*GFX_Y/5)
36#endif 36#endif
37#else 37#else
38#define MYLCD(fn) pgfx_ ## fn
39#define GFX_X 9 38#define GFX_X 9
40#define GFX_Y 6 39#define GFX_Y 6
41#define GFX_WIDTH 9 40#define GFX_WIDTH 9
@@ -208,8 +207,8 @@ enum plugin_status plugin_start(const void* parameter)
208 } 207 }
209 pgfx_display(3, 0); 208 pgfx_display(3, 0);
210#endif 209#endif
211 MYLCD(clear_display)(); 210 mylcd_clear_display();
212 MYLCD(set_drawmode)(DRMODE_COMPLEMENT); 211 mylcd_set_drawmode(DRMODE_COMPLEMENT);
213 while (1) { 212 while (1) {
214 213
215 x+=sx; 214 x+=sx;
@@ -238,11 +237,11 @@ enum plugin_status plugin_start(const void* parameter)
238 sy = -sy; 237 sy = -sy;
239 } 238 }
240 239
241 MYLCD(fillrect)(GFX_X-x, GFX_Y-y, 2*x+1, 1); 240 mylcd_fillrect(GFX_X-x, GFX_Y-y, 2*x+1, 1);
242 MYLCD(fillrect)(GFX_X-x, GFX_Y+y, 2*x+1, 1); 241 mylcd_fillrect(GFX_X-x, GFX_Y+y, 2*x+1, 1);
243 MYLCD(fillrect)(GFX_X-x, GFX_Y-y+1, 1, 2*y-1); 242 mylcd_fillrect(GFX_X-x, GFX_Y-y+1, 1, 2*y-1);
244 MYLCD(fillrect)(GFX_X+x, GFX_Y-y+1, 1, 2*y-1); 243 mylcd_fillrect(GFX_X+x, GFX_Y-y+1, 1, 2*y-1);
245 MYLCD(update)(); 244 mylcd_update();
246 245
247 rb->sleep(HZ/timer); 246 rb->sleep(HZ/timer);
248 247
@@ -253,7 +252,7 @@ enum plugin_status plugin_start(const void* parameter)
253 case MOSAIQUE_RC_QUIT: 252 case MOSAIQUE_RC_QUIT:
254#endif 253#endif
255 case MOSAIQUE_QUIT: 254 case MOSAIQUE_QUIT:
256 MYLCD(set_drawmode)(DRMODE_SOLID); 255 mylcd_set_drawmode(DRMODE_SOLID);
257#ifdef HAVE_LCD_CHARCELLS 256#ifdef HAVE_LCD_CHARCELLS
258 pgfx_release(); 257 pgfx_release();
259#endif 258#endif
@@ -271,14 +270,14 @@ enum plugin_status plugin_start(const void* parameter)
271 sy = rb->rand() % (GFX_HEIGHT/2) + 1; 270 sy = rb->rand() % (GFX_HEIGHT/2) + 1;
272 x=0; 271 x=0;
273 y=0; 272 y=0;
274 MYLCD(clear_display)(); 273 mylcd_clear_display();
275 break; 274 break;
276 275
277 276
278 default: 277 default:
279 if (rb->default_event_handler(button) == SYS_USB_CONNECTED) 278 if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
280 { 279 {
281 MYLCD(set_drawmode)(DRMODE_SOLID); 280 mylcd_set_drawmode(DRMODE_SOLID);
282#ifdef HAVE_LCD_CHARCELLS 281#ifdef HAVE_LCD_CHARCELLS
283 pgfx_release(); 282 pgfx_release();
284#endif 283#endif
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 463f86c394..155b495ebf 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -30,6 +30,7 @@
30#include "lib/helper.h" 30#include "lib/helper.h"
31#include "lib/configfile.h" 31#include "lib/configfile.h"
32#include "lib/grey.h" 32#include "lib/grey.h"
33#include "lib/mylcd.h"
33#include "lib/feature_wrappers.h" 34#include "lib/feature_wrappers.h"
34#include "lib/buflib.h" 35#include "lib/buflib.h"
35 36
@@ -176,7 +177,6 @@ const struct button_mapping *pf_contexts[] =
176#define USEGSLIB 177#define USEGSLIB
177GREY_INFO_STRUCT 178GREY_INFO_STRUCT
178#define LCD_BUF _grey_info.buffer 179#define LCD_BUF _grey_info.buffer
179#define MYLCD(fn) grey_ ## fn
180#define G_PIX(r,g,b) \ 180#define G_PIX(r,g,b) \
181 (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256 181 (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256
182#define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b)) 182#define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b))
@@ -186,7 +186,6 @@ GREY_INFO_STRUCT
186typedef unsigned char pix_t; 186typedef unsigned char pix_t;
187#else /* LCD_DEPTH >= 8 */ 187#else /* LCD_DEPTH >= 8 */
188#define LCD_BUF rb->lcd_framebuffer 188#define LCD_BUF rb->lcd_framebuffer
189#define MYLCD(fn) rb->lcd_ ## fn
190#define G_PIX LCD_RGBPACK 189#define G_PIX LCD_RGBPACK
191#define N_PIX LCD_RGBPACK 190#define N_PIX LCD_RGBPACK
192#define G_BRIGHT(y) LCD_RGBPACK(y,y,y) 191#define G_BRIGHT(y) LCD_RGBPACK(y,y,y)
@@ -1865,9 +1864,9 @@ void show_next_slide(void)
1865*/ 1864*/
1866void render_all_slides(void) 1865void render_all_slides(void)
1867{ 1866{
1868 MYLCD(set_background)(G_BRIGHT(0)); 1867 mylcd_set_background(G_BRIGHT(0));
1869 /* TODO: Optimizes this by e.g. invalidating rects */ 1868 /* TODO: Optimizes this by e.g. invalidating rects */
1870 MYLCD(clear_display)(); 1869 mylcd_clear_display();
1871 1870
1872 int nleft = num_slides; 1871 int nleft = num_slides;
1873 int nright = num_slides; 1872 int nright = num_slides;
@@ -2251,12 +2250,12 @@ static inline void draw_gradient(int y, int h)
2251 int c2 = selected_track_pulse - 5; 2250 int c2 = selected_track_pulse - 5;
2252 for (r=0; r<h; r++) { 2251 for (r=0; r<h; r++) {
2253#ifdef HAVE_LCD_COLOR 2252#ifdef HAVE_LCD_COLOR
2254 MYLCD(set_foreground)(G_PIX(c2+80-(c >> 9), c2+100-(c >> 9), 2253 mylcd_set_foreground(G_PIX(c2+80-(c >> 9), c2+100-(c >> 9),
2255 c2+250-(c >> 8))); 2254 c2+250-(c >> 8)));
2256#else 2255#else
2257 MYLCD(set_foreground)(G_BRIGHT(c2+160-(c >> 8))); 2256 mylcd_set_foreground(G_BRIGHT(c2+160-(c >> 8)));
2258#endif 2257#endif
2259 MYLCD(hline)(0, LCD_WIDTH, r+y); 2258 mylcd_hline(0, LCD_WIDTH, r+y);
2260 if ( r > h/2 ) 2259 if ( r > h/2 )
2261 c-=inc; 2260 c-=inc;
2262 else 2261 else
@@ -2312,7 +2311,7 @@ void reset_track_list(void)
2312 */ 2311 */
2313void show_track_list(void) 2312void show_track_list(void)
2314{ 2313{
2315 MYLCD(clear_display)(); 2314 mylcd_clear_display();
2316 if ( center_slide.slide_index != track_index ) { 2315 if ( center_slide.slide_index != track_index ) {
2317 create_track_index(center_slide.slide_index); 2316 create_track_index(center_slide.slide_index);
2318 reset_track_list(); 2317 reset_track_list();
@@ -2326,11 +2325,11 @@ void show_track_list(void)
2326 for (;track_i < track_list_visible_entries+start_index_track_list; 2325 for (;track_i < track_list_visible_entries+start_index_track_list;
2327 track_i++) 2326 track_i++)
2328 { 2327 {
2329 MYLCD(getstringsize)(get_track_name(track_i), &titletxt_w, NULL); 2328 mylcd_getstringsize(get_track_name(track_i), &titletxt_w, NULL);
2330 titletxt_x = (LCD_WIDTH-titletxt_w)/2; 2329 titletxt_x = (LCD_WIDTH-titletxt_w)/2;
2331 if ( track_i == selected_track ) { 2330 if ( track_i == selected_track ) {
2332 draw_gradient(titletxt_y, titletxt_h); 2331 draw_gradient(titletxt_y, titletxt_h);
2333 MYLCD(set_foreground)(G_BRIGHT(255)); 2332 mylcd_set_foreground(G_BRIGHT(255));
2334 if (titletxt_w > LCD_WIDTH ) { 2333 if (titletxt_w > LCD_WIDTH ) {
2335 if ( titletxt_w + track_scroll_index <= LCD_WIDTH ) 2334 if ( titletxt_w + track_scroll_index <= LCD_WIDTH )
2336 track_scroll_dir = 1; 2335 track_scroll_dir = 1;
@@ -2338,12 +2337,12 @@ void show_track_list(void)
2338 track_scroll_index += track_scroll_dir*2; 2337 track_scroll_index += track_scroll_dir*2;
2339 titletxt_x = track_scroll_index; 2338 titletxt_x = track_scroll_index;
2340 } 2339 }
2341 MYLCD(putsxy)(titletxt_x,titletxt_y,get_track_name(track_i)); 2340 mylcd_putsxy(titletxt_x,titletxt_y,get_track_name(track_i));
2342 } 2341 }
2343 else { 2342 else {
2344 color = 250 - (abs(selected_track - track_i) * 200 / track_count); 2343 color = 250 - (abs(selected_track - track_i) * 200 / track_count);
2345 MYLCD(set_foreground)(G_BRIGHT(color)); 2344 mylcd_set_foreground(G_BRIGHT(color));
2346 MYLCD(putsxy)(titletxt_x,titletxt_y,get_track_name(track_i)); 2345 mylcd_putsxy(titletxt_x,titletxt_y,get_track_name(track_i));
2347 } 2346 }
2348 titletxt_y += titletxt_h; 2347 titletxt_y += titletxt_h;
2349 } 2348 }
@@ -2446,8 +2445,8 @@ void draw_album_text(void)
2446 albumtxt = get_album_name(center_index); 2445 albumtxt = get_album_name(center_index);
2447 } 2446 }
2448 2447
2449 MYLCD(set_foreground)(G_BRIGHT(c)); 2448 mylcd_set_foreground(G_BRIGHT(c));
2450 MYLCD(getstringsize)(albumtxt, &albumtxt_w, &albumtxt_h); 2449 mylcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h);
2451 if (center_index != prev_center_index) { 2450 if (center_index != prev_center_index) {
2452 albumtxt_x = 0; 2451 albumtxt_x = 0;
2453 albumtxt_dir = -1; 2452 albumtxt_dir = -1;
@@ -2460,7 +2459,7 @@ void draw_album_text(void)
2460 albumtxt_y = LCD_HEIGHT - albumtxt_h - albumtxt_h/2; 2459 albumtxt_y = LCD_HEIGHT - albumtxt_h - albumtxt_h/2;
2461 2460
2462 if (albumtxt_w > LCD_WIDTH ) { 2461 if (albumtxt_w > LCD_WIDTH ) {
2463 MYLCD(putsxy)(albumtxt_x, albumtxt_y , albumtxt); 2462 mylcd_putsxy(albumtxt_x, albumtxt_y , albumtxt);
2464 if ( pf_state == pf_idle || pf_state == pf_show_tracks ) { 2463 if ( pf_state == pf_idle || pf_state == pf_show_tracks ) {
2465 if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1; 2464 if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1;
2466 else if ( albumtxt_x >= 0 ) albumtxt_dir = -1; 2465 else if ( albumtxt_x >= 0 ) albumtxt_dir = -1;
@@ -2468,7 +2467,7 @@ void draw_album_text(void)
2468 } 2467 }
2469 } 2468 }
2470 else { 2469 else {
2471 MYLCD(putsxy)((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt); 2470 mylcd_putsxy((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt);
2472 } 2471 }
2473 2472
2474 2473
@@ -2641,9 +2640,9 @@ int main(void)
2641 if (show_fps) 2640 if (show_fps)
2642 { 2641 {
2643#ifdef USEGSLIB 2642#ifdef USEGSLIB
2644 MYLCD(set_foreground)(G_BRIGHT(255)); 2643 mylcd_set_foreground(G_BRIGHT(255));
2645#else 2644#else
2646 MYLCD(set_foreground)(G_PIX(255,0,0)); 2645 mylcd_set_foreground(G_PIX(255,0,0));
2647#endif 2646#endif
2648 rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps); 2647 rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps);
2649 if (show_album_name == album_name_top) 2648 if (show_album_name == album_name_top)
@@ -2651,13 +2650,13 @@ int main(void)
2651 rb->screens[SCREEN_MAIN]->getcharheight(); 2650 rb->screens[SCREEN_MAIN]->getcharheight();
2652 else 2651 else
2653 fpstxt_y = 0; 2652 fpstxt_y = 0;
2654 MYLCD(putsxy)(0, fpstxt_y, fpstxt); 2653 mylcd_putsxy(0, fpstxt_y, fpstxt);
2655 } 2654 }
2656 draw_album_text(); 2655 draw_album_text();
2657 2656
2658 2657
2659 /* Copy offscreen buffer to LCD and give time to other threads */ 2658 /* Copy offscreen buffer to LCD and give time to other threads */
2660 MYLCD(update)(); 2659 mylcd_update();
2661 rb->yield(); 2660 rb->yield();
2662 2661
2663 /*/ Handle buttons */ 2662 /*/ Handle buttons */
@@ -2695,7 +2694,7 @@ int main(void)
2695#ifdef USEGSLIB 2694#ifdef USEGSLIB
2696 grey_show(true); 2695 grey_show(true);
2697#endif 2696#endif
2698 MYLCD(set_drawmode)(DRMODE_FG); 2697 mylcd_set_drawmode(DRMODE_FG);
2699 break; 2698 break;
2700 2699
2701 case PF_NEXT: 2700 case PF_NEXT:
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 4e261e4547..084eaa5830 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -26,6 +26,7 @@
26#include "lib/highscore.h" 26#include "lib/highscore.h"
27#include "lib/playback_control.h" 27#include "lib/playback_control.h"
28#include "lib/playergfx.h" 28#include "lib/playergfx.h"
29#include "lib/mylcd.h"
29 30
30PLUGIN_HEADER 31PLUGIN_HEADER
31 32
@@ -599,8 +600,6 @@ PLUGIN_HEADER
599#define LINES_X LABEL_X 600#define LINES_X LABEL_X
600#endif 601#endif
601 602
602#define MYLCD(fn) rb->lcd_ ## fn
603
604extern const fb_data rockblox_background[]; 603extern const fb_data rockblox_background[];
605 604
606#else /* HAVE_LCD_CHARCELLS */ 605#else /* HAVE_LCD_CHARCELLS */
@@ -614,8 +613,6 @@ extern const fb_data rockblox_background[];
614#define PREVIEW_X 15 613#define PREVIEW_X 15
615#define PREVIEW_Y 1 614#define PREVIEW_Y 1
616 615
617#define MYLCD(fn) pgfx_ ## fn
618
619#endif 616#endif
620 617
621#ifndef _SPACE 618#ifndef _SPACE
@@ -983,14 +980,14 @@ static void refresh_board (void)
983#if LCD_DEPTH >= 2 980#if LCD_DEPTH >= 2
984 rb->lcd_set_foreground (LCD_BLACK); 981 rb->lcd_set_foreground (LCD_BLACK);
985#elif LCD_DEPTH == 1 982#elif LCD_DEPTH == 1
986 MYLCD(set_drawmode) (DRMODE_SOLID | DRMODE_INVERSEVID); 983 mylcd_set_drawmode (DRMODE_SOLID | DRMODE_INVERSEVID);
987#endif 984#endif
988 985
989 MYLCD(fillrect) (BOARD_X, BOARD_Y, BOARD_WIDTH * BLOCK_WIDTH, 986 mylcd_fillrect (BOARD_X, BOARD_Y, BOARD_WIDTH * BLOCK_WIDTH,
990 BOARD_HEIGHT * BLOCK_HEIGHT); 987 BOARD_HEIGHT * BLOCK_HEIGHT);
991 988
992#if LCD_DEPTH == 1 989#if LCD_DEPTH == 1
993 MYLCD(set_drawmode) (DRMODE_SOLID); 990 mylcd_set_drawmode (DRMODE_SOLID);
994#endif 991#endif
995 992
996 for (i = 0; i < BOARD_WIDTH; i++) 993 for (i = 0; i < BOARD_WIDTH; i++)
@@ -1067,7 +1064,7 @@ static void refresh_board (void)
1067 pgfx_drawpixel (BOARD_X + x, BOARD_Y + y); 1064 pgfx_drawpixel (BOARD_X + x, BOARD_Y + y);
1068#endif 1065#endif
1069 } 1066 }
1070 MYLCD(update) (); 1067 mylcd_update ();
1071} 1068}
1072 1069
1073static bool canMoveTo (int x, int y, int newOrientation) 1070static bool canMoveTo (int x, int y, int newOrientation)
@@ -1092,14 +1089,14 @@ static void draw_next_block (void)
1092#if LCD_DEPTH >= 2 1089#if LCD_DEPTH >= 2
1093 rb->lcd_set_foreground (LCD_BLACK); 1090 rb->lcd_set_foreground (LCD_BLACK);
1094#elif LCD_DEPTH == 1 1091#elif LCD_DEPTH == 1
1095 MYLCD(set_drawmode) (DRMODE_SOLID | DRMODE_INVERSEVID); 1092 mylcd_set_drawmode (DRMODE_SOLID | DRMODE_INVERSEVID);
1096#endif 1093#endif
1097 1094
1098 /* 4x4 */ 1095 /* 4x4 */
1099 MYLCD(fillrect) (PREVIEW_X, PREVIEW_Y, BLOCK_WIDTH * 4, BLOCK_HEIGHT * 4); 1096 mylcd_fillrect (PREVIEW_X, PREVIEW_Y, BLOCK_WIDTH * 4, BLOCK_HEIGHT * 4);
1100 1097
1101#if LCD_DEPTH == 1 1098#if LCD_DEPTH == 1
1102 MYLCD(set_drawmode) (DRMODE_SOLID); 1099 mylcd_set_drawmode (DRMODE_SOLID);
1103#endif 1100#endif
1104 1101
1105 /* draw the lightgray rectangles */ 1102 /* draw the lightgray rectangles */
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index eb8870efde..c3c9b7458a 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -20,6 +20,7 @@
20 **************************************************************************/ 20 **************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playergfx.h" 22#include "lib/playergfx.h"
23#include "lib/mylcd.h"
23 24
24PLUGIN_HEADER 25PLUGIN_HEADER
25 26
@@ -27,12 +28,10 @@ PLUGIN_HEADER
27#define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72) 28#define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72)
28#define SNOW_HEIGHT LCD_HEIGHT 29#define SNOW_HEIGHT LCD_HEIGHT
29#define SNOW_WIDTH LCD_WIDTH 30#define SNOW_WIDTH LCD_WIDTH
30#define MYLCD(fn) rb->lcd_ ## fn
31#else 31#else
32#define NUM_PARTICLES 10 32#define NUM_PARTICLES 10
33#define SNOW_HEIGHT 14 33#define SNOW_HEIGHT 14
34#define SNOW_WIDTH 20 34#define SNOW_WIDTH 20
35#define MYLCD(fn) pgfx_ ## fn
36#endif 35#endif
37 36
38/* variable button definitions */ 37/* variable button definitions */
@@ -136,14 +135,14 @@ static void snow_move(void)
136 135
137 for (i=0; i<NUM_PARTICLES; i++) { 136 for (i=0; i<NUM_PARTICLES; i++) {
138 if (particle_exists(i)) { 137 if (particle_exists(i)) {
139 MYLCD(set_drawmode)(DRMODE_SOLID|DRMODE_INVERSEVID); 138 mylcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
140#ifdef HAVE_LCD_BITMAP 139#ifdef HAVE_LCD_BITMAP
141 rb->lcd_fillrect(particles[i][0],particles[i][1], 140 rb->lcd_fillrect(particles[i][0],particles[i][1],
142 FLAKE_WIDTH,FLAKE_WIDTH); 141 FLAKE_WIDTH,FLAKE_WIDTH);
143#else 142#else
144 pgfx_drawpixel(particles[i][0],particles[i][1]); 143 pgfx_drawpixel(particles[i][0],particles[i][1]);
145#endif 144#endif
146 MYLCD(set_drawmode)(DRMODE_SOLID); 145 mylcd_set_drawmode(DRMODE_SOLID);
147#ifdef HAVE_REMOTE_LCD 146#ifdef HAVE_REMOTE_LCD
148 if (particles[i][0] <= LCD_REMOTE_WIDTH 147 if (particles[i][0] <= LCD_REMOTE_WIDTH
149 && particles[i][1] <= LCD_REMOTE_HEIGHT) { 148 && particles[i][1] <= LCD_REMOTE_HEIGHT) {
@@ -201,7 +200,7 @@ static void snow_init(void)
201 pgfx_display(4, 0); 200 pgfx_display(4, 0);
202 pgfx_display(8, 0); 201 pgfx_display(8, 0);
203#endif 202#endif
204 MYLCD(clear_display)(); 203 mylcd_clear_display();
205#ifdef HAVE_REMOTE_LCD 204#ifdef HAVE_REMOTE_LCD
206 rb->lcd_remote_clear_display(); 205 rb->lcd_remote_clear_display();
207#endif 206#endif
@@ -227,7 +226,7 @@ enum plugin_status plugin_start(const void* parameter)
227 snow_init(); 226 snow_init();
228 while (1) { 227 while (1) {
229 snow_move(); 228 snow_move();
230 MYLCD(update)(); 229 mylcd_update();
231#ifdef HAVE_REMOTE_LCD 230#ifdef HAVE_REMOTE_LCD
232 rb->lcd_remote_update(); 231 rb->lcd_remote_update();
233#endif 232#endif
diff --git a/apps/plugins/test_core_jpeg.c b/apps/plugins/test_core_jpeg.c
index 5df69b5792..58b667e28e 100644
--- a/apps/plugins/test_core_jpeg.c
+++ b/apps/plugins/test_core_jpeg.c
@@ -21,20 +21,15 @@
21 21
22#include "plugin.h" 22#include "plugin.h"
23#include "lib/grey.h" 23#include "lib/grey.h"
24#include "lib/mylcd.h"
24PLUGIN_HEADER 25PLUGIN_HEADER
25 26
26/* different graphics libraries */ 27/* different graphics libraries */
27#if LCD_DEPTH < 8 28#if LCD_DEPTH < 8
28#define USEGSLIB 29#define USEGSLIB
29GREY_INFO_STRUCT 30GREY_INFO_STRUCT
30#define MYLCD(fn) grey_ub_ ## fn
31#define MYLCD_UPDATE()
32#define MYXLCD(fn) grey_ub_ ## fn
33#define CFORMAT &format_grey 31#define CFORMAT &format_grey
34#else 32#else
35#define MYLCD(fn) rb->lcd_ ## fn
36#define MYLCD_UPDATE() rb->lcd_update();
37#define MYXLCD(fn) xlcd_ ## fn
38#define CFORMAT NULL 33#define CFORMAT NULL
39#endif 34#endif
40 35
@@ -80,7 +75,7 @@ enum plugin_status plugin_start(const void* parameter)
80 rb->lcd_bitmap((fb_data *)bm.data, (LCD_WIDTH - bm.width) >> 1, 75 rb->lcd_bitmap((fb_data *)bm.data, (LCD_WIDTH - bm.width) >> 1,
81 (LCD_HEIGHT - bm.height) >> 1, bm.width, bm.height); 76 (LCD_HEIGHT - bm.height) >> 1, bm.width, bm.height);
82#endif 77#endif
83 MYLCD_UPDATE(); 78 mylcd_ub_update();
84 while (rb->get_action(CONTEXT_STD,1) != ACTION_STD_OK) rb->yield(); 79 while (rb->get_action(CONTEXT_STD,1) != ACTION_STD_OK) rb->yield();
85#ifdef USEGSLIB 80#ifdef USEGSLIB
86 grey_release(); 81 grey_release();
diff --git a/apps/plugins/test_gfx.c b/apps/plugins/test_gfx.c
index 0a2e02e43f..3ba8956109 100644
--- a/apps/plugins/test_gfx.c
+++ b/apps/plugins/test_gfx.c
@@ -19,16 +19,14 @@
19#include "plugin.h" 19#include "plugin.h"
20#include "lib/grey.h" 20#include "lib/grey.h"
21#include "lib/helper.h" 21#include "lib/helper.h"
22#include "lib/mylcd.h"
22 23
23//#define TEST_GREYLIB /* Uncomment for testing greylib instead of core gfx */ 24//#define TEST_GREYLIB /* Uncomment for testing greylib instead of core gfx */
24 25
25#ifdef TEST_GREYLIB 26#ifdef TEST_GREYLIB
26#define MYLCD(fn) grey_ ## fn
27GREY_INFO_STRUCT 27GREY_INFO_STRUCT
28static unsigned char *gbuf; 28static unsigned char *gbuf;
29static size_t gbuf_size = 0; 29static size_t gbuf_size = 0;
30#else
31#define MYLCD(fn) rb->lcd_ ## fn
32#endif 30#endif
33 31
34#define DURATION (HZ) /* longer duration gives more precise results */ 32#define DURATION (HZ) /* longer duration gives more precise results */
@@ -67,45 +65,45 @@ static void time_drawpixel(void)
67 int count1, count2, count3, count4; 65 int count1, count2, count3, count4;
68 66
69 /* Test 1: DRMODE_SOLID */ 67 /* Test 1: DRMODE_SOLID */
70 MYLCD(set_drawmode)(DRMODE_SOLID); 68 mylcd_set_drawmode(DRMODE_SOLID);
71 count1 = 0; 69 count1 = 0;
72 rb->sleep(0); /* sync to tick */ 70 rb->sleep(0); /* sync to tick */
73 time_start = *rb->current_tick; 71 time_start = *rb->current_tick;
74 while((time_end = *rb->current_tick) - time_start < DURATION) 72 while((time_end = *rb->current_tick) - time_start < DURATION)
75 { 73 {
76 unsigned rnd = rand_table[count1++ & 0x3ff]; 74 unsigned rnd = rand_table[count1++ & 0x3ff];
77 MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); 75 mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
78 } 76 }
79 77
80 /* Test 2: DRMODE_FG */ 78 /* Test 2: DRMODE_FG */
81 MYLCD(set_drawmode)(DRMODE_FG); 79 mylcd_set_drawmode(DRMODE_FG);
82 count2 = 0; 80 count2 = 0;
83 rb->sleep(0); /* sync to tick */ 81 rb->sleep(0); /* sync to tick */
84 time_start = *rb->current_tick; 82 time_start = *rb->current_tick;
85 while((time_end = *rb->current_tick) - time_start < DURATION) 83 while((time_end = *rb->current_tick) - time_start < DURATION)
86 { 84 {
87 unsigned rnd = rand_table[count2++ & 0x3ff]; 85 unsigned rnd = rand_table[count2++ & 0x3ff];
88 MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); 86 mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
89 } 87 }
90 /* Test 3: DRMODE_BG */ 88 /* Test 3: DRMODE_BG */
91 MYLCD(set_drawmode)(DRMODE_BG); 89 mylcd_set_drawmode(DRMODE_BG);
92 count3 = 0; 90 count3 = 0;
93 rb->sleep(0); /* sync to tick */ 91 rb->sleep(0); /* sync to tick */
94 time_start = *rb->current_tick; 92 time_start = *rb->current_tick;
95 while((time_end = *rb->current_tick) - time_start < DURATION) 93 while((time_end = *rb->current_tick) - time_start < DURATION)
96 { 94 {
97 unsigned rnd = rand_table[count3++ & 0x3ff]; 95 unsigned rnd = rand_table[count3++ & 0x3ff];
98 MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); 96 mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
99 } 97 }
100 /* Test 4: DRMODE_COMPLEMENT */ 98 /* Test 4: DRMODE_COMPLEMENT */
101 MYLCD(set_drawmode)(DRMODE_COMPLEMENT); 99 mylcd_set_drawmode(DRMODE_COMPLEMENT);
102 count4 = 0; 100 count4 = 0;
103 rb->sleep(0); /* sync to tick */ 101 rb->sleep(0); /* sync to tick */
104 time_start = *rb->current_tick; 102 time_start = *rb->current_tick;
105 while((time_end = *rb->current_tick) - time_start < DURATION) 103 while((time_end = *rb->current_tick) - time_start < DURATION)
106 { 104 {
107 unsigned rnd = rand_table[count4++ & 0x3ff]; 105 unsigned rnd = rand_table[count4++ & 0x3ff];
108 MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); 106 mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
109 } 107 }
110 108
111 rb->fdprintf(log_fd, "lcd_drawpixel (pixels/s): %d/%d/%d/%d\n", 109 rb->fdprintf(log_fd, "lcd_drawpixel (pixels/s): %d/%d/%d/%d\n",
@@ -119,7 +117,7 @@ static void time_drawline(void)
119 int count1, count2, count3, count4; 117 int count1, count2, count3, count4;
120 118
121 /* Test 1: DRMODE_SOLID */ 119 /* Test 1: DRMODE_SOLID */
122 MYLCD(set_drawmode)(DRMODE_SOLID); 120 mylcd_set_drawmode(DRMODE_SOLID);
123 count1 = 0; 121 count1 = 0;
124 rb->sleep(0); /* sync to tick */ 122 rb->sleep(0); /* sync to tick */
125 time_start = *rb->current_tick; 123 time_start = *rb->current_tick;
@@ -127,12 +125,12 @@ static void time_drawline(void)
127 { 125 {
128 unsigned rnd1 = rand_table[count1++ & 0x3ff]; 126 unsigned rnd1 = rand_table[count1++ & 0x3ff];
129 unsigned rnd2 = rand_table[count1++ & 0x3ff]; 127 unsigned rnd2 = rand_table[count1++ & 0x3ff];
130 MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 128 mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
131 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 129 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
132 } 130 }
133 131
134 /* Test 2: DRMODE_FG */ 132 /* Test 2: DRMODE_FG */
135 MYLCD(set_drawmode)(DRMODE_FG); 133 mylcd_set_drawmode(DRMODE_FG);
136 count2 = 0; 134 count2 = 0;
137 rb->sleep(0); /* sync to tick */ 135 rb->sleep(0); /* sync to tick */
138 time_start = *rb->current_tick; 136 time_start = *rb->current_tick;
@@ -140,11 +138,11 @@ static void time_drawline(void)
140 { 138 {
141 unsigned rnd1 = rand_table[count2++ & 0x3ff]; 139 unsigned rnd1 = rand_table[count2++ & 0x3ff];
142 unsigned rnd2 = rand_table[count2++ & 0x3ff]; 140 unsigned rnd2 = rand_table[count2++ & 0x3ff];
143 MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 141 mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
144 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 142 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
145 } 143 }
146 /* Test 3: DRMODE_BG */ 144 /* Test 3: DRMODE_BG */
147 MYLCD(set_drawmode)(DRMODE_BG); 145 mylcd_set_drawmode(DRMODE_BG);
148 count3 = 0; 146 count3 = 0;
149 rb->sleep(0); /* sync to tick */ 147 rb->sleep(0); /* sync to tick */
150 time_start = *rb->current_tick; 148 time_start = *rb->current_tick;
@@ -152,11 +150,11 @@ static void time_drawline(void)
152 { 150 {
153 unsigned rnd1 = rand_table[count3++ & 0x3ff]; 151 unsigned rnd1 = rand_table[count3++ & 0x3ff];
154 unsigned rnd2 = rand_table[count3++ & 0x3ff]; 152 unsigned rnd2 = rand_table[count3++ & 0x3ff];
155 MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 153 mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
156 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 154 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
157 } 155 }
158 /* Test 4: DRMODE_COMPLEMENT */ 156 /* Test 4: DRMODE_COMPLEMENT */
159 MYLCD(set_drawmode)(DRMODE_COMPLEMENT); 157 mylcd_set_drawmode(DRMODE_COMPLEMENT);
160 count4 = 0; 158 count4 = 0;
161 rb->sleep(0); /* sync to tick */ 159 rb->sleep(0); /* sync to tick */
162 time_start = *rb->current_tick; 160 time_start = *rb->current_tick;
@@ -164,8 +162,8 @@ static void time_drawline(void)
164 { 162 {
165 unsigned rnd1 = rand_table[count4++ & 0x3ff]; 163 unsigned rnd1 = rand_table[count4++ & 0x3ff];
166 unsigned rnd2 = rand_table[count4++ & 0x3ff]; 164 unsigned rnd2 = rand_table[count4++ & 0x3ff];
167 MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 165 mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
168 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 166 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
169 } 167 }
170 168
171 rb->fdprintf(log_fd, "lcd_drawline (lines/s): %d/%d/%d/%d\n", 169 rb->fdprintf(log_fd, "lcd_drawline (lines/s): %d/%d/%d/%d\n",
@@ -179,7 +177,7 @@ static void time_hline(void)
179 int count1, count2, count3, count4; 177 int count1, count2, count3, count4;
180 178
181 /* Test 1: DRMODE_SOLID */ 179 /* Test 1: DRMODE_SOLID */
182 MYLCD(set_drawmode)(DRMODE_SOLID); 180 mylcd_set_drawmode(DRMODE_SOLID);
183 count1 = 0; 181 count1 = 0;
184 rb->sleep(0); /* sync to tick */ 182 rb->sleep(0); /* sync to tick */
185 time_start = *rb->current_tick; 183 time_start = *rb->current_tick;
@@ -187,11 +185,11 @@ static void time_hline(void)
187 { 185 {
188 unsigned rnd1 = rand_table[count1++ & 0x3ff]; 186 unsigned rnd1 = rand_table[count1++ & 0x3ff];
189 unsigned rnd2 = rand_table[count1++ & 0x3ff]; 187 unsigned rnd2 = rand_table[count1++ & 0x3ff];
190 MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 188 mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
191 } 189 }
192 190
193 /* Test 2: DRMODE_FG */ 191 /* Test 2: DRMODE_FG */
194 MYLCD(set_drawmode)(DRMODE_FG); 192 mylcd_set_drawmode(DRMODE_FG);
195 count2 = 0; 193 count2 = 0;
196 rb->sleep(0); /* sync to tick */ 194 rb->sleep(0); /* sync to tick */
197 time_start = *rb->current_tick; 195 time_start = *rb->current_tick;
@@ -199,10 +197,10 @@ static void time_hline(void)
199 { 197 {
200 unsigned rnd1 = rand_table[count2++ & 0x3ff]; 198 unsigned rnd1 = rand_table[count2++ & 0x3ff];
201 unsigned rnd2 = rand_table[count2++ & 0x3ff]; 199 unsigned rnd2 = rand_table[count2++ & 0x3ff];
202 MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 200 mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
203 } 201 }
204 /* Test 3: DRMODE_BG */ 202 /* Test 3: DRMODE_BG */
205 MYLCD(set_drawmode)(DRMODE_BG); 203 mylcd_set_drawmode(DRMODE_BG);
206 count3 = 0; 204 count3 = 0;
207 rb->sleep(0); /* sync to tick */ 205 rb->sleep(0); /* sync to tick */
208 time_start = *rb->current_tick; 206 time_start = *rb->current_tick;
@@ -210,10 +208,10 @@ static void time_hline(void)
210 { 208 {
211 unsigned rnd1 = rand_table[count3++ & 0x3ff]; 209 unsigned rnd1 = rand_table[count3++ & 0x3ff];
212 unsigned rnd2 = rand_table[count3++ & 0x3ff]; 210 unsigned rnd2 = rand_table[count3++ & 0x3ff];
213 MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 211 mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
214 } 212 }
215 /* Test 4: DRMODE_COMPLEMENT */ 213 /* Test 4: DRMODE_COMPLEMENT */
216 MYLCD(set_drawmode)(DRMODE_COMPLEMENT); 214 mylcd_set_drawmode(DRMODE_COMPLEMENT);
217 count4 = 0; 215 count4 = 0;
218 rb->sleep(0); /* sync to tick */ 216 rb->sleep(0); /* sync to tick */
219 time_start = *rb->current_tick; 217 time_start = *rb->current_tick;
@@ -221,7 +219,7 @@ static void time_hline(void)
221 { 219 {
222 unsigned rnd1 = rand_table[count4++ & 0x3ff]; 220 unsigned rnd1 = rand_table[count4++ & 0x3ff];
223 unsigned rnd2 = rand_table[count4++ & 0x3ff]; 221 unsigned rnd2 = rand_table[count4++ & 0x3ff];
224 MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 222 mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
225 } 223 }
226 224
227 rb->fdprintf(log_fd, "lcd_hline (lines/s): %d/%d/%d/%d\n", 225 rb->fdprintf(log_fd, "lcd_hline (lines/s): %d/%d/%d/%d\n",
@@ -235,7 +233,7 @@ static void time_vline(void)
235 int count1, count2, count3, count4; 233 int count1, count2, count3, count4;
236 234
237 /* Test 1: DRMODE_SOLID */ 235 /* Test 1: DRMODE_SOLID */
238 MYLCD(set_drawmode)(DRMODE_SOLID); 236 mylcd_set_drawmode(DRMODE_SOLID);
239 count1 = 0; 237 count1 = 0;
240 rb->sleep(0); /* sync to tick */ 238 rb->sleep(0); /* sync to tick */
241 time_start = *rb->current_tick; 239 time_start = *rb->current_tick;
@@ -243,11 +241,11 @@ static void time_vline(void)
243 { 241 {
244 unsigned rnd1 = rand_table[count1++ & 0x3ff]; 242 unsigned rnd1 = rand_table[count1++ & 0x3ff];
245 unsigned rnd2 = rand_table[count1++ & 0x3ff]; 243 unsigned rnd2 = rand_table[count1++ & 0x3ff];
246 MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 244 mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
247 } 245 }
248 246
249 /* Test 2: DRMODE_FG */ 247 /* Test 2: DRMODE_FG */
250 MYLCD(set_drawmode)(DRMODE_FG); 248 mylcd_set_drawmode(DRMODE_FG);
251 count2 = 0; 249 count2 = 0;
252 rb->sleep(0); /* sync to tick */ 250 rb->sleep(0); /* sync to tick */
253 time_start = *rb->current_tick; 251 time_start = *rb->current_tick;
@@ -255,10 +253,10 @@ static void time_vline(void)
255 { 253 {
256 unsigned rnd1 = rand_table[count2++ & 0x3ff]; 254 unsigned rnd1 = rand_table[count2++ & 0x3ff];
257 unsigned rnd2 = rand_table[count2++ & 0x3ff]; 255 unsigned rnd2 = rand_table[count2++ & 0x3ff];
258 MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 256 mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
259 } 257 }
260 /* Test 3: DRMODE_BG */ 258 /* Test 3: DRMODE_BG */
261 MYLCD(set_drawmode)(DRMODE_BG); 259 mylcd_set_drawmode(DRMODE_BG);
262 count3 = 0; 260 count3 = 0;
263 rb->sleep(0); /* sync to tick */ 261 rb->sleep(0); /* sync to tick */
264 time_start = *rb->current_tick; 262 time_start = *rb->current_tick;
@@ -266,10 +264,10 @@ static void time_vline(void)
266 { 264 {
267 unsigned rnd1 = rand_table[count3++ & 0x3ff]; 265 unsigned rnd1 = rand_table[count3++ & 0x3ff];
268 unsigned rnd2 = rand_table[count3++ & 0x3ff]; 266 unsigned rnd2 = rand_table[count3++ & 0x3ff];
269 MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 267 mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
270 } 268 }
271 /* Test 4: DRMODE_COMPLEMENT */ 269 /* Test 4: DRMODE_COMPLEMENT */
272 MYLCD(set_drawmode)(DRMODE_COMPLEMENT); 270 mylcd_set_drawmode(DRMODE_COMPLEMENT);
273 count4 = 0; 271 count4 = 0;
274 rb->sleep(0); /* sync to tick */ 272 rb->sleep(0); /* sync to tick */
275 time_start = *rb->current_tick; 273 time_start = *rb->current_tick;
@@ -277,7 +275,7 @@ static void time_vline(void)
277 { 275 {
278 unsigned rnd1 = rand_table[count4++ & 0x3ff]; 276 unsigned rnd1 = rand_table[count4++ & 0x3ff];
279 unsigned rnd2 = rand_table[count4++ & 0x3ff]; 277 unsigned rnd2 = rand_table[count4++ & 0x3ff];
280 MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); 278 mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
281 } 279 }
282 280
283 rb->fdprintf(log_fd, "lcd_vline (lines/s): %d/%d/%d/%d\n", 281 rb->fdprintf(log_fd, "lcd_vline (lines/s): %d/%d/%d/%d\n",
@@ -291,7 +289,7 @@ static void time_fillrect(void)
291 int count1, count2, count3, count4; 289 int count1, count2, count3, count4;
292 290
293 /* Test 1: DRMODE_SOLID */ 291 /* Test 1: DRMODE_SOLID */
294 MYLCD(set_drawmode)(DRMODE_SOLID); 292 mylcd_set_drawmode(DRMODE_SOLID);
295 count1 = 0; 293 count1 = 0;
296 rb->sleep(0); /* sync to tick */ 294 rb->sleep(0); /* sync to tick */
297 time_start = *rb->current_tick; 295 time_start = *rb->current_tick;
@@ -299,12 +297,12 @@ static void time_fillrect(void)
299 { 297 {
300 unsigned rnd1 = rand_table[count1++ & 0x3ff]; 298 unsigned rnd1 = rand_table[count1++ & 0x3ff];
301 unsigned rnd2 = rand_table[count1++ & 0x3ff]; 299 unsigned rnd2 = rand_table[count1++ & 0x3ff];
302 MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 300 mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
303 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 301 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
304 } 302 }
305 303
306 /* Test 2: DRMODE_FG */ 304 /* Test 2: DRMODE_FG */
307 MYLCD(set_drawmode)(DRMODE_FG); 305 mylcd_set_drawmode(DRMODE_FG);
308 count2 = 0; 306 count2 = 0;
309 rb->sleep(0); /* sync to tick */ 307 rb->sleep(0); /* sync to tick */
310 time_start = *rb->current_tick; 308 time_start = *rb->current_tick;
@@ -312,11 +310,11 @@ static void time_fillrect(void)
312 { 310 {
313 unsigned rnd1 = rand_table[count2++ & 0x3ff]; 311 unsigned rnd1 = rand_table[count2++ & 0x3ff];
314 unsigned rnd2 = rand_table[count2++ & 0x3ff]; 312 unsigned rnd2 = rand_table[count2++ & 0x3ff];
315 MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 313 mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
316 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 314 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
317 } 315 }
318 /* Test 3: DRMODE_BG */ 316 /* Test 3: DRMODE_BG */
319 MYLCD(set_drawmode)(DRMODE_BG); 317 mylcd_set_drawmode(DRMODE_BG);
320 count3 = 0; 318 count3 = 0;
321 rb->sleep(0); /* sync to tick */ 319 rb->sleep(0); /* sync to tick */
322 time_start = *rb->current_tick; 320 time_start = *rb->current_tick;
@@ -324,11 +322,11 @@ static void time_fillrect(void)
324 { 322 {
325 unsigned rnd1 = rand_table[count3++ & 0x3ff]; 323 unsigned rnd1 = rand_table[count3++ & 0x3ff];
326 unsigned rnd2 = rand_table[count3++ & 0x3ff]; 324 unsigned rnd2 = rand_table[count3++ & 0x3ff];
327 MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 325 mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
328 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 326 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
329 } 327 }
330 /* Test 4: DRMODE_COMPLEMENT */ 328 /* Test 4: DRMODE_COMPLEMENT */
331 MYLCD(set_drawmode)(DRMODE_COMPLEMENT); 329 mylcd_set_drawmode(DRMODE_COMPLEMENT);
332 count4 = 0; 330 count4 = 0;
333 rb->sleep(0); /* sync to tick */ 331 rb->sleep(0); /* sync to tick */
334 time_start = *rb->current_tick; 332 time_start = *rb->current_tick;
@@ -336,8 +334,8 @@ static void time_fillrect(void)
336 { 334 {
337 unsigned rnd1 = rand_table[count4++ & 0x3ff]; 335 unsigned rnd1 = rand_table[count4++ & 0x3ff];
338 unsigned rnd2 = rand_table[count4++ & 0x3ff]; 336 unsigned rnd2 = rand_table[count4++ & 0x3ff];
339 MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, 337 mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
340 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); 338 (rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
341 } 339 }
342 340
343 rb->fdprintf(log_fd, "lcd_fillrect (rects/s): %d/%d/%d/%d\n", 341 rb->fdprintf(log_fd, "lcd_fillrect (rects/s): %d/%d/%d/%d\n",
@@ -353,45 +351,45 @@ static void time_text(void) /* tests mono_bitmap performance */
353 rb->lcd_setfont(FONT_SYSFIXED); 351 rb->lcd_setfont(FONT_SYSFIXED);
354 352
355 /* Test 1: DRMODE_SOLID */ 353 /* Test 1: DRMODE_SOLID */
356 MYLCD(set_drawmode)(DRMODE_SOLID); 354 mylcd_set_drawmode(DRMODE_SOLID);
357 count1 = 0; 355 count1 = 0;
358 rb->sleep(0); /* sync to tick */ 356 rb->sleep(0); /* sync to tick */
359 time_start = *rb->current_tick; 357 time_start = *rb->current_tick;
360 while((time_end = *rb->current_tick) - time_start < DURATION) 358 while((time_end = *rb->current_tick) - time_start < DURATION)
361 { 359 {
362 unsigned rnd = rand_table[count1++ & 0x3ff]; 360 unsigned rnd = rand_table[count1++ & 0x3ff];
363 MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); 361 mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
364 } 362 }
365 363
366 /* Test 2: DRMODE_FG */ 364 /* Test 2: DRMODE_FG */
367 MYLCD(set_drawmode)(DRMODE_FG); 365 mylcd_set_drawmode(DRMODE_FG);
368 count2 = 0; 366 count2 = 0;
369 rb->sleep(0); /* sync to tick */ 367 rb->sleep(0); /* sync to tick */
370 time_start = *rb->current_tick; 368 time_start = *rb->current_tick;
371 while((time_end = *rb->current_tick) - time_start < DURATION) 369 while((time_end = *rb->current_tick) - time_start < DURATION)
372 { 370 {
373 unsigned rnd = rand_table[count2++ & 0x3ff]; 371 unsigned rnd = rand_table[count2++ & 0x3ff];
374 MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); 372 mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
375 } 373 }
376 /* Test 3: DRMODE_BG */ 374 /* Test 3: DRMODE_BG */
377 MYLCD(set_drawmode)(DRMODE_BG); 375 mylcd_set_drawmode(DRMODE_BG);
378 count3 = 0; 376 count3 = 0;
379 rb->sleep(0); /* sync to tick */ 377 rb->sleep(0); /* sync to tick */
380 time_start = *rb->current_tick; 378 time_start = *rb->current_tick;
381 while((time_end = *rb->current_tick) - time_start < DURATION) 379 while((time_end = *rb->current_tick) - time_start < DURATION)
382 { 380 {
383 unsigned rnd = rand_table[count3++ & 0x3ff]; 381 unsigned rnd = rand_table[count3++ & 0x3ff];
384 MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); 382 mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
385 } 383 }
386 /* Test 4: DRMODE_COMPLEMENT */ 384 /* Test 4: DRMODE_COMPLEMENT */
387 MYLCD(set_drawmode)(DRMODE_COMPLEMENT); 385 mylcd_set_drawmode(DRMODE_COMPLEMENT);
388 count4 = 0; 386 count4 = 0;
389 rb->sleep(0); /* sync to tick */ 387 rb->sleep(0); /* sync to tick */
390 time_start = *rb->current_tick; 388 time_start = *rb->current_tick;
391 while((time_end = *rb->current_tick) - time_start < DURATION) 389 while((time_end = *rb->current_tick) - time_start < DURATION)
392 { 390 {
393 unsigned rnd = rand_table[count4++ & 0x3ff]; 391 unsigned rnd = rand_table[count4++ & 0x3ff];
394 MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); 392 mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
395 } 393 }
396 394
397 rb->fdprintf(log_fd, "lcd_putsxy (strings/s): %d/%d/%d/%d\n", 395 rb->fdprintf(log_fd, "lcd_putsxy (strings/s): %d/%d/%d/%d\n",
diff --git a/apps/plugins/test_mem_jpeg.c b/apps/plugins/test_mem_jpeg.c
index 50969c3503..d6eda771ad 100644
--- a/apps/plugins/test_mem_jpeg.c
+++ b/apps/plugins/test_mem_jpeg.c
@@ -24,20 +24,15 @@
24#include "plugin.h" 24#include "plugin.h"
25#include "lib/grey.h" 25#include "lib/grey.h"
26#include "lib/jpeg_mem.h" 26#include "lib/jpeg_mem.h"
27#include "lib/mylcd.h"
27PLUGIN_HEADER 28PLUGIN_HEADER
28 29
29/* different graphics libraries */ 30/* different graphics libraries */
30#if LCD_DEPTH < 8 31#if LCD_DEPTH < 8
31#define USEGSLIB 32#define USEGSLIB
32GREY_INFO_STRUCT 33GREY_INFO_STRUCT
33#define MYLCD(fn) grey_ub_ ## fn
34#define MYLCD_UPDATE()
35#define MYXLCD(fn) grey_ub_ ## fn
36#define CFORMAT &format_grey 34#define CFORMAT &format_grey
37#else 35#else
38#define MYLCD(fn) rb->lcd_ ## fn
39#define MYLCD_UPDATE() rb->lcd_update();
40#define MYXLCD(fn) xlcd_ ## fn
41#define CFORMAT &format_native 36#define CFORMAT &format_native
42#endif 37#endif
43 38
@@ -94,7 +89,7 @@ enum plugin_status plugin_start(const void* parameter)
94 rb->lcd_bitmap((fb_data *)bm.data, (LCD_WIDTH - bm.width) >> 1, 89 rb->lcd_bitmap((fb_data *)bm.data, (LCD_WIDTH - bm.width) >> 1,
95 (LCD_HEIGHT - bm.height) >> 1, bm.width, bm.height); 90 (LCD_HEIGHT - bm.height) >> 1, bm.width, bm.height);
96#endif 91#endif
97 MYLCD_UPDATE(); 92 mylcd_ub_update();
98 while (rb->get_action(CONTEXT_STD,1) != ACTION_STD_OK) rb->yield(); 93 while (rb->get_action(CONTEXT_STD,1) != ACTION_STD_OK) rb->yield();
99#ifdef USEGSLIB 94#ifdef USEGSLIB
100 grey_release(); 95 grey_release();