A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Convert some more stuff to mylcd_ and support pgfx as well.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26543 a1c6a512-1295-4272-9138-f99709370657

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