mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
This commit is contained in:
parent
bc26fe7a96
commit
e63e84a5df
16 changed files with 224 additions and 214 deletions
|
@ -21,8 +21,14 @@
|
|||
*
|
||||
***************************************************************************/
|
||||
#include "plugin.h"
|
||||
#include "lib/grey.h"
|
||||
#include "lib/playergfx.h"
|
||||
#if LCD_DEPTH > 1
|
||||
#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */
|
||||
#include "lib/grey.h"
|
||||
#else
|
||||
#include "lib/grey.h"
|
||||
#include "lib/mylcd.h" /* MYLCD_CFG_GREYLIB or MYLCD_CFG_PGFX */
|
||||
#endif
|
||||
#include "lib/xlcd.h"
|
||||
#include "lib/fixedpoint.h"
|
||||
|
||||
|
@ -339,15 +345,9 @@ static struct my_lcd lcdfuncs; /* initialised at runtime */
|
|||
static struct my_lcd *mylcd = &greyfuncs;
|
||||
|
||||
#define MYLCD(fn) mylcd->fn
|
||||
#define MY_FILLTRIANGLE(x1, y1, x2, y2, x3, y3) grey_filltriangle(x1, y1, x2, y2, x3, y3)
|
||||
#define MY_SET_FOREGROUND(fg) grey_set_foreground(fg)
|
||||
#define MY_GET_FOREGROUND() grey_get_foreground()
|
||||
|
||||
#else
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#define MY_FILLTRIANGLE(x1, y1, x2, y2, x3, y3) xlcd_filltriangle(x1, y1, x2, y2, x3, y3)
|
||||
#define MY_SET_FOREGROUND(fg) rb->lcd_set_foreground(fg)
|
||||
#define MY_GET_FOREGROUND() rb->lcd_get_foreground()
|
||||
#endif
|
||||
|
||||
#if CONFIG_LCD == LCD_SSD1815
|
||||
|
@ -540,7 +540,7 @@ static void cube_draw(void)
|
|||
#if LCD_DEPTH > 1 || defined(USEGSLIB)
|
||||
case SOLID:
|
||||
|
||||
old_foreground = MY_GET_FOREGROUND();
|
||||
old_foreground = mylcd_get_foreground();
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
/* backface culling; if the shape winds counter-clockwise, we are
|
||||
|
@ -552,14 +552,14 @@ static void cube_draw(void)
|
|||
* (point2D[faces[i].corner[2]].x - point2D[faces[i].corner[1]].x))
|
||||
continue;
|
||||
|
||||
MY_SET_FOREGROUND(face_colors[i]);
|
||||
MY_FILLTRIANGLE(point2D[faces[i].corner[0]].x,
|
||||
mylcd_set_foreground(face_colors[i]);
|
||||
mylcd_filltriangle(point2D[faces[i].corner[0]].x,
|
||||
point2D[faces[i].corner[0]].y,
|
||||
point2D[faces[i].corner[1]].x,
|
||||
point2D[faces[i].corner[1]].y,
|
||||
point2D[faces[i].corner[2]].x,
|
||||
point2D[faces[i].corner[2]].y);
|
||||
MY_FILLTRIANGLE(point2D[faces[i].corner[0]].x,
|
||||
mylcd_filltriangle(point2D[faces[i].corner[0]].x,
|
||||
point2D[faces[i].corner[0]].y,
|
||||
point2D[faces[i].corner[2]].x,
|
||||
point2D[faces[i].corner[2]].y,
|
||||
|
@ -567,7 +567,7 @@ static void cube_draw(void)
|
|||
point2D[faces[i].corner[3]].y);
|
||||
|
||||
}
|
||||
MY_SET_FOREGROUND(old_foreground);
|
||||
mylcd_set_foreground(old_foreground);
|
||||
break;
|
||||
#endif /* (LCD_DEPTH > 1) || GSLIB */
|
||||
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
|
||||
#include "lib/helper.h"
|
||||
#include "lib/xlcd.h"
|
||||
#include "lib/mylcd.h"
|
||||
#include "math.h"
|
||||
#include "fracmul.h"
|
||||
|
||||
#ifndef HAVE_LCD_COLOR
|
||||
#include "lib/grey.h"
|
||||
#endif
|
||||
#include "lib/mylcd.h"
|
||||
|
||||
PLUGIN_HEADER
|
||||
|
||||
|
|
|
@ -30,16 +30,6 @@
|
|||
#include "fractal_sets.h"
|
||||
#include "mandelbrot_set.h"
|
||||
|
||||
#ifdef USEGSLIB
|
||||
#define MYLCD(fn) grey_ub_ ## fn
|
||||
#define MYLCD_UPDATE()
|
||||
#define MYXLCD(fn) grey_ub_ ## fn
|
||||
#else
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#define MYLCD_UPDATE() rb->lcd_update();
|
||||
#define MYXLCD(fn) xlcd_ ## fn
|
||||
#endif
|
||||
|
||||
#ifdef USEGSLIB
|
||||
GREY_INFO_STRUCT
|
||||
static unsigned char *gbuf;
|
||||
|
@ -143,8 +133,8 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
switch (redraw)
|
||||
{
|
||||
case REDRAW_FULL:
|
||||
MYLCD(clear_display)();
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_clear_display();
|
||||
mylcd_ub_update();
|
||||
/* fall-through */
|
||||
case REDRAW_FULL_OVERLAY:
|
||||
rects_queue_init();
|
||||
|
@ -200,32 +190,32 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
|
||||
case FRACTAL_UP:
|
||||
ops->move(0, +1);
|
||||
MYXLCD(scroll_down)(LCD_SHIFT_Y);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_scroll_down(LCD_SHIFT_Y);
|
||||
mylcd_ub_update();
|
||||
if (redraw != REDRAW_FULL)
|
||||
redraw = rects_move_down() ? REDRAW_FULL : REDRAW_PARTIAL;
|
||||
break;
|
||||
|
||||
case FRACTAL_DOWN:
|
||||
ops->move(0, -1);
|
||||
MYXLCD(scroll_up)(LCD_SHIFT_Y);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_scroll_up(LCD_SHIFT_Y);
|
||||
mylcd_ub_update();
|
||||
if (redraw != REDRAW_FULL)
|
||||
redraw = rects_move_up() ? REDRAW_FULL : REDRAW_PARTIAL;
|
||||
break;
|
||||
|
||||
case FRACTAL_LEFT:
|
||||
ops->move(-1, 0);
|
||||
MYXLCD(scroll_right)(LCD_SHIFT_X);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_scroll_right(LCD_SHIFT_X);
|
||||
mylcd_ub_update();
|
||||
if (redraw != REDRAW_FULL)
|
||||
redraw = rects_move_right() ? REDRAW_FULL : REDRAW_PARTIAL;
|
||||
break;
|
||||
|
||||
case FRACTAL_RIGHT:
|
||||
ops->move(+1, 0);
|
||||
MYXLCD(scroll_left)(LCD_SHIFT_X);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_scroll_left(LCD_SHIFT_X);
|
||||
mylcd_ub_update();
|
||||
if (redraw != REDRAW_FULL)
|
||||
redraw = rects_move_left() ? REDRAW_FULL : REDRAW_PARTIAL;
|
||||
break;
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "lib/xlcd.h"
|
||||
#endif
|
||||
|
||||
#include "lib/mylcd.h"
|
||||
|
||||
#define DELTA 8 /* Panning moves 1/DELTA of screen */
|
||||
|
||||
#define LCD_SHIFT_X (LCD_WIDTH / DELTA)
|
||||
|
|
|
@ -119,7 +119,7 @@ void draw_image_rect(struct image_info *info,
|
|||
y + MAX(0, (LCD_HEIGHT-info->height)/2),
|
||||
width, height);
|
||||
#else
|
||||
MYXLCD(gray_bitmap_part)(
|
||||
mylcd_ub_gray_bitmap_part(
|
||||
pdisp->bitmap, info->x + x, info->y + y, info->width,
|
||||
x + MAX(0, (LCD_WIDTH-info->width)/2),
|
||||
y + MAX(0, (LCD_HEIGHT-info->height)/2),
|
||||
|
|
|
@ -416,10 +416,10 @@ static void pan_view_right(struct image_info *info)
|
|||
move = MIN(HSCROLL, info->width - info->x - LCD_WIDTH);
|
||||
if (move > 0)
|
||||
{
|
||||
MYXLCD(scroll_left)(move); /* scroll left */
|
||||
mylcd_ub_scroll_left(move); /* scroll left */
|
||||
info->x += move;
|
||||
draw_image_rect(info, LCD_WIDTH - move, 0, move, info->height-info->y);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,10 +432,10 @@ static void pan_view_left(struct image_info *info)
|
|||
move = MIN(HSCROLL, info->x);
|
||||
if (move > 0)
|
||||
{
|
||||
MYXLCD(scroll_right)(move); /* scroll right */
|
||||
mylcd_ub_scroll_right(move); /* scroll right */
|
||||
info->x -= move;
|
||||
draw_image_rect(info, 0, 0, move, info->height-info->y);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ static void pan_view_up(struct image_info *info)
|
|||
move = MIN(VSCROLL, info->y);
|
||||
if (move > 0)
|
||||
{
|
||||
MYXLCD(scroll_down)(move); /* scroll down */
|
||||
mylcd_ub_scroll_down(move); /* scroll down */
|
||||
info->y -= move;
|
||||
#if defined(HAVE_LCD_COLOR) && defined(JPEG_VIEWER)
|
||||
if (settings.jpeg_dither_mode == DITHER_DIFFUSION)
|
||||
|
@ -459,7 +459,7 @@ static void pan_view_up(struct image_info *info)
|
|||
}
|
||||
#endif
|
||||
draw_image_rect(info, 0, 0, info->width-info->x, move);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ static void pan_view_down(struct image_info *info)
|
|||
move = MIN(VSCROLL, info->height - info->y - LCD_HEIGHT);
|
||||
if (move > 0)
|
||||
{
|
||||
MYXLCD(scroll_up)(move); /* scroll up */
|
||||
mylcd_ub_scroll_up(move); /* scroll up */
|
||||
info->y += move;
|
||||
#if defined(HAVE_LCD_COLOR) && defined(JPEG_VIEWER)
|
||||
if (settings.jpeg_dither_mode == DITHER_DIFFUSION)
|
||||
|
@ -499,7 +499,7 @@ static void pan_view_down(struct image_info *info)
|
|||
info->y++;
|
||||
}
|
||||
#endif
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ static int scroll_bmp(struct image_info *info)
|
|||
#else
|
||||
draw_image_rect(info, 0, 0,
|
||||
info->width-info->x, info->height-info->y);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -783,10 +783,10 @@ static int load_and_show(char* filename, struct image_info *info)
|
|||
rb->lcd_update();
|
||||
}
|
||||
|
||||
MYLCD(clear_display)();
|
||||
mylcd_ub_clear_display();
|
||||
draw_image_rect(info, 0, 0,
|
||||
info->width-info->x, info->height-info->y);
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
|
||||
#ifdef USEGSLIB
|
||||
grey_show(true); /* switch on greyscale overlay */
|
||||
|
|
|
@ -366,16 +366,12 @@
|
|||
#if LCD_DEPTH < 8
|
||||
#define USEGSLIB
|
||||
#include <lib/grey.h>
|
||||
#define MYLCD(fn) grey_ub_ ## fn
|
||||
#define MYLCD_UPDATE()
|
||||
#define MYXLCD(fn) grey_ub_ ## fn
|
||||
#else
|
||||
#include <lib/xlcd.h>
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#define MYLCD_UPDATE() rb->lcd_update();
|
||||
#define MYXLCD(fn) xlcd_ ## fn
|
||||
#endif
|
||||
|
||||
#include <lib/mylcd.h>
|
||||
|
||||
/* Min memory allowing us to use the plugin buffer
|
||||
* and thus not stopping the music
|
||||
* *Very* rough estimation:
|
||||
|
|
|
@ -94,7 +94,7 @@ void draw_image_rect(struct image_info *info,
|
|||
width, height,
|
||||
settings.jpeg_colour_mode, settings.jpeg_dither_mode);
|
||||
#else
|
||||
MYXLCD(gray_bitmap_part)(
|
||||
mylcd_ub_gray_bitmap_part(
|
||||
pdisp->bitmap[0], info->x + x, info->y + y, pdisp->stride,
|
||||
x + MAX(0, (LCD_WIDTH-info->width)/2),
|
||||
y + MAX(0, (LCD_HEIGHT-info->height)/2),
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* Copyright (c) 2010 Michael Sevakis
|
||||
*
|
||||
* Helper defines for writing code for both grey and color targets.
|
||||
* Helper defines for writing code for pgfx, grey and color targets.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -24,63 +24,90 @@
|
|||
#define MYLCD_H
|
||||
|
||||
/***
|
||||
* Most functions are, other than color depth, equivalent between grey, lcd
|
||||
* and xlcd and most of the time the caller need not be concerned with which
|
||||
* is actually called, making code nicer to read and maintain.
|
||||
* Most functions are, other than color depth, equivalent between pgfx, grey,
|
||||
* lcd and xlcd and most of the time the caller need not be concerned with
|
||||
* which is actually called, making code nicer to read and maintain.
|
||||
*
|
||||
* Unbuffered routines revert to standard rb->lcd_XXXX funtions on color
|
||||
* targets. On color, mylcd_ub_update_XXXX refer to the proper update
|
||||
* functions, otherwise they are no-ops.
|
||||
*
|
||||
* lib/playergfx.h or lib/grey.h should be included before including this
|
||||
* header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise.
|
||||
*/
|
||||
#if defined (HAVE_LCD_CHARCELLS) && defined(__PGFX_H__)
|
||||
#define MYLCD_CFG_PGFX /* using PGFX */
|
||||
#define mylcd_(fn) pgfx_##fn
|
||||
#define mylcd_ub_(fn) pgfx_##fn
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
#define mylcd_(fn) rb->lcd_##fn
|
||||
#define myxlcd_(fn) xlcd_##fn
|
||||
#define mylcd_ub_(fn) rb->lcd_##fn
|
||||
#define myxlcd_ub_(fn) xlcd_##fn
|
||||
#else
|
||||
#elif defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 8) && defined(__GREY_H__)
|
||||
#define MYLCD_CFG_GREYLIB /* using greylib */
|
||||
#define mylcd_(fn) grey_##fn
|
||||
#define myxlcd_(fn) grey_##fn
|
||||
#define mylcd_ub_(fn) grey_ub_##fn
|
||||
#define myxlcd_ub_(fn) grey_ub_##fn
|
||||
#endif
|
||||
|
||||
/* Common colors */
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
#define MYLCD_BLACK LCD_BLACK
|
||||
#define MYLCD_DARKGRAY LCD_DARKGRAY
|
||||
#define MYLCD_LIGHTGRAY LCD_LIGHTGRAY
|
||||
#define MYLCD_WHITE LCD_WHITE
|
||||
#define MYLCD_DEFAULT_FG LCD_DEFAULT_FG
|
||||
#define MYLCD_DEFAULT_BG LCD_DEFAULT_BG
|
||||
#else
|
||||
#define MYLCD_BLACK GREY_BLACK
|
||||
#define MYLCD_DARKGRAY GREY_DARKGRAY
|
||||
#define MYLCD_LIGHTGRAY GREY_LIGHTGRAY
|
||||
#define MYLCD_WHITE GREY_WHITE
|
||||
#define MYLCD_DEFAULT_FG GREY_BLACK
|
||||
#define MYLCD_DEFAULT_BG GREY_WHITE
|
||||
#endif /* HAVE_LCD_COLOR */
|
||||
|
||||
#elif defined (HAVE_LCD_BITMAP)
|
||||
#define MYLCD_CFG_RB_XLCD /* using standard (X)LCD routines */
|
||||
#define mylcd_(fn) rb->lcd_##fn
|
||||
#define myxlcd_(fn) xlcd_##fn
|
||||
#define mylcd_ub_(fn) rb->lcd_##fn
|
||||
#define myxlcd_ub_(fn) xlcd_##fn
|
||||
|
||||
/* Common colors */
|
||||
#define MYLCD_BLACK LCD_BLACK
|
||||
#define MYLCD_DARKGRAY LCD_DARKGRAY
|
||||
#define MYLCD_LIGHTGRAY LCD_LIGHTGRAY
|
||||
#define MYLCD_WHITE LCD_WHITE
|
||||
#define MYLCD_DEFAULT_FG LCD_DEFAULT_FG
|
||||
#define MYLCD_DEFAULT_BG LCD_DEFAULT_BG
|
||||
|
||||
#else
|
||||
#error Configuration not supported! Did you forget to include the correct lib header?
|
||||
#endif /* end LCD type selection */
|
||||
|
||||
/* Update functions */
|
||||
#define mylcd_update mylcd_(update)
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_update_rect mylcd_(update_rect)
|
||||
|
||||
/* Update functions - unbuffered : special handling for these */
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
#define mylcd_ub_update() rb->lcd_update()
|
||||
#define mylcd_ub_update_rect(...) rb->lcd_update_rect(__VA_ARGS__)
|
||||
#else
|
||||
/* Still evaluate args like functions */
|
||||
static inline void mylcd_update_rect(int x, int y, int w, int h)
|
||||
{ (void)x; (void)y; (void)w; (void)h; pgfx_update(); }
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Update functions - unbuffered : special handling for these
|
||||
* It is desirable to still evaluate arguments even if there will
|
||||
* be no function call, just in case they have side-effects.
|
||||
*/
|
||||
#if defined (MYLCD_CFG_PGFX)
|
||||
#define mylcd_ub_update pgfx_update
|
||||
static inline void mylcd_ub_update_rect(int x, int y, int w, int h)
|
||||
{ (void)x; (void)y; (void)w; (void)h; pgfx_update(); }
|
||||
|
||||
#elif defined (MYLCD_CFG_GREYLIB)
|
||||
static inline void mylcd_ub_update(void)
|
||||
{}
|
||||
static inline void mylcd_ub_update_rect(int x, int y, int w, int h)
|
||||
{ (void)x; (void)y; (void)w; (void)h; }
|
||||
|
||||
#else /* color or RB default */
|
||||
#define mylcd_ub_update rb->lcd_update
|
||||
#define mylcd_ub_update_rect rb->lcd_update_rect
|
||||
#endif
|
||||
|
||||
/* Parameter handling */
|
||||
#define mylcd_set_drawmode mylcd_(set_drawmode)
|
||||
#define mylcd_get_drawmode mylcd_(get_drawmode)
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_set_foreground mylcd_(set_foreground)
|
||||
#define mylcd_get_foreground mylcd_(get_foreground)
|
||||
#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)
|
|||
#define mylcd_set_drawinfo mylcd_(set_drawinfo)
|
||||
#define mylcd_setfont mylcd_(setfont)
|
||||
#define mylcd_getstringsize mylcd_(getstringsize)
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Whole display */
|
||||
#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)
|
|||
|
||||
/* Filled Primitives */
|
||||
#define mylcd_fillrect mylcd_(fillrect)
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_filltriangle myxlcd_(filltriangle)
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Bitmaps */
|
||||
#define mylcd_mono_bitmap_part mylcd_(mono_bitmap_part)
|
||||
#define mylcd_mono_bitmap mylcd_(mono_bitmap)
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_gray_bitmap_part myxlcd_(gray_bitmap_part)
|
||||
#define mylcd_gray_bitmap myxlcd_(gray_bitmap)
|
||||
#if 0 /* possible, but not implemented in greylib */
|
||||
#define mylcd_color_bitmap_part myxlcd_(color_bitmap_part)
|
||||
#define mylcd_color_bitmap myxlcd_(color_bitmap)
|
||||
#endif
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Bitmaps - unbuffered */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_ub_gray_bitmap_part myxlcd_ub_(gray_bitmap_part)
|
||||
#define mylcd_ub_gray_bitmap myxlcd_ub_(gray_bitmap)
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Text */
|
||||
/* lcd_putsxyofs is static'ed in the core for now on color */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_putsxyofs mylcd_(putsxyofs)
|
||||
#define mylcd_putsxy mylcd_(putsxy)
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Scrolling */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_scroll_left myxlcd_(scroll_left)
|
||||
#define mylcd_scroll_right myxlcd_(scroll_right)
|
||||
#define mylcd_scroll_up myxlcd_(scroll_up)
|
||||
#define mylcd_scroll_down myxlcd_(scroll_down)
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Scrolling - unbuffered */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define mylcd_ub_scroll_left myxlcd_ub_(scroll_left)
|
||||
#define mylcd_ub_scroll_right myxlcd_ub_(scroll_right)
|
||||
#define mylcd_ub_scroll_up myxlcd_ub_(scroll_up)
|
||||
#define mylcd_ub_scroll_down myxlcd_ub_(scroll_down)
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
#endif /* MYLCD_H */
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
**************************************************************************/
|
||||
#include "plugin.h"
|
||||
#include "lib/playergfx.h"
|
||||
#include "lib/mylcd.h"
|
||||
|
||||
PLUGIN_HEADER
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#define GFX_X (LCD_WIDTH/2-1)
|
||||
#define GFX_Y (LCD_HEIGHT/2-1)
|
||||
#if LCD_WIDTH != LCD_HEIGHT
|
||||
|
@ -35,7 +35,6 @@ PLUGIN_HEADER
|
|||
#define GFX_HEIGHT (4*GFX_Y/5)
|
||||
#endif
|
||||
#else
|
||||
#define MYLCD(fn) pgfx_ ## fn
|
||||
#define GFX_X 9
|
||||
#define GFX_Y 6
|
||||
#define GFX_WIDTH 9
|
||||
|
@ -208,8 +207,8 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
}
|
||||
pgfx_display(3, 0);
|
||||
#endif
|
||||
MYLCD(clear_display)();
|
||||
MYLCD(set_drawmode)(DRMODE_COMPLEMENT);
|
||||
mylcd_clear_display();
|
||||
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
while (1) {
|
||||
|
||||
x+=sx;
|
||||
|
@ -238,11 +237,11 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
sy = -sy;
|
||||
}
|
||||
|
||||
MYLCD(fillrect)(GFX_X-x, GFX_Y-y, 2*x+1, 1);
|
||||
MYLCD(fillrect)(GFX_X-x, GFX_Y+y, 2*x+1, 1);
|
||||
MYLCD(fillrect)(GFX_X-x, GFX_Y-y+1, 1, 2*y-1);
|
||||
MYLCD(fillrect)(GFX_X+x, GFX_Y-y+1, 1, 2*y-1);
|
||||
MYLCD(update)();
|
||||
mylcd_fillrect(GFX_X-x, GFX_Y-y, 2*x+1, 1);
|
||||
mylcd_fillrect(GFX_X-x, GFX_Y+y, 2*x+1, 1);
|
||||
mylcd_fillrect(GFX_X-x, GFX_Y-y+1, 1, 2*y-1);
|
||||
mylcd_fillrect(GFX_X+x, GFX_Y-y+1, 1, 2*y-1);
|
||||
mylcd_update();
|
||||
|
||||
rb->sleep(HZ/timer);
|
||||
|
||||
|
@ -253,7 +252,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
case MOSAIQUE_RC_QUIT:
|
||||
#endif
|
||||
case MOSAIQUE_QUIT:
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
#ifdef HAVE_LCD_CHARCELLS
|
||||
pgfx_release();
|
||||
#endif
|
||||
|
@ -271,14 +270,14 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
sy = rb->rand() % (GFX_HEIGHT/2) + 1;
|
||||
x=0;
|
||||
y=0;
|
||||
MYLCD(clear_display)();
|
||||
mylcd_clear_display();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
||||
{
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
#ifdef HAVE_LCD_CHARCELLS
|
||||
pgfx_release();
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "lib/helper.h"
|
||||
#include "lib/configfile.h"
|
||||
#include "lib/grey.h"
|
||||
#include "lib/mylcd.h"
|
||||
#include "lib/feature_wrappers.h"
|
||||
#include "lib/buflib.h"
|
||||
|
||||
|
@ -176,7 +177,6 @@ const struct button_mapping *pf_contexts[] =
|
|||
#define USEGSLIB
|
||||
GREY_INFO_STRUCT
|
||||
#define LCD_BUF _grey_info.buffer
|
||||
#define MYLCD(fn) grey_ ## fn
|
||||
#define G_PIX(r,g,b) \
|
||||
(77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256
|
||||
#define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b))
|
||||
|
@ -186,7 +186,6 @@ GREY_INFO_STRUCT
|
|||
typedef unsigned char pix_t;
|
||||
#else /* LCD_DEPTH >= 8 */
|
||||
#define LCD_BUF rb->lcd_framebuffer
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#define G_PIX LCD_RGBPACK
|
||||
#define N_PIX LCD_RGBPACK
|
||||
#define G_BRIGHT(y) LCD_RGBPACK(y,y,y)
|
||||
|
@ -1865,9 +1864,9 @@ void show_next_slide(void)
|
|||
*/
|
||||
void render_all_slides(void)
|
||||
{
|
||||
MYLCD(set_background)(G_BRIGHT(0));
|
||||
mylcd_set_background(G_BRIGHT(0));
|
||||
/* TODO: Optimizes this by e.g. invalidating rects */
|
||||
MYLCD(clear_display)();
|
||||
mylcd_clear_display();
|
||||
|
||||
int nleft = num_slides;
|
||||
int nright = num_slides;
|
||||
|
@ -2251,12 +2250,12 @@ static inline void draw_gradient(int y, int h)
|
|||
int c2 = selected_track_pulse - 5;
|
||||
for (r=0; r<h; r++) {
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
MYLCD(set_foreground)(G_PIX(c2+80-(c >> 9), c2+100-(c >> 9),
|
||||
mylcd_set_foreground(G_PIX(c2+80-(c >> 9), c2+100-(c >> 9),
|
||||
c2+250-(c >> 8)));
|
||||
#else
|
||||
MYLCD(set_foreground)(G_BRIGHT(c2+160-(c >> 8)));
|
||||
mylcd_set_foreground(G_BRIGHT(c2+160-(c >> 8)));
|
||||
#endif
|
||||
MYLCD(hline)(0, LCD_WIDTH, r+y);
|
||||
mylcd_hline(0, LCD_WIDTH, r+y);
|
||||
if ( r > h/2 )
|
||||
c-=inc;
|
||||
else
|
||||
|
@ -2312,7 +2311,7 @@ void reset_track_list(void)
|
|||
*/
|
||||
void show_track_list(void)
|
||||
{
|
||||
MYLCD(clear_display)();
|
||||
mylcd_clear_display();
|
||||
if ( center_slide.slide_index != track_index ) {
|
||||
create_track_index(center_slide.slide_index);
|
||||
reset_track_list();
|
||||
|
@ -2326,11 +2325,11 @@ void show_track_list(void)
|
|||
for (;track_i < track_list_visible_entries+start_index_track_list;
|
||||
track_i++)
|
||||
{
|
||||
MYLCD(getstringsize)(get_track_name(track_i), &titletxt_w, NULL);
|
||||
mylcd_getstringsize(get_track_name(track_i), &titletxt_w, NULL);
|
||||
titletxt_x = (LCD_WIDTH-titletxt_w)/2;
|
||||
if ( track_i == selected_track ) {
|
||||
draw_gradient(titletxt_y, titletxt_h);
|
||||
MYLCD(set_foreground)(G_BRIGHT(255));
|
||||
mylcd_set_foreground(G_BRIGHT(255));
|
||||
if (titletxt_w > LCD_WIDTH ) {
|
||||
if ( titletxt_w + track_scroll_index <= LCD_WIDTH )
|
||||
track_scroll_dir = 1;
|
||||
|
@ -2338,12 +2337,12 @@ void show_track_list(void)
|
|||
track_scroll_index += track_scroll_dir*2;
|
||||
titletxt_x = track_scroll_index;
|
||||
}
|
||||
MYLCD(putsxy)(titletxt_x,titletxt_y,get_track_name(track_i));
|
||||
mylcd_putsxy(titletxt_x,titletxt_y,get_track_name(track_i));
|
||||
}
|
||||
else {
|
||||
color = 250 - (abs(selected_track - track_i) * 200 / track_count);
|
||||
MYLCD(set_foreground)(G_BRIGHT(color));
|
||||
MYLCD(putsxy)(titletxt_x,titletxt_y,get_track_name(track_i));
|
||||
mylcd_set_foreground(G_BRIGHT(color));
|
||||
mylcd_putsxy(titletxt_x,titletxt_y,get_track_name(track_i));
|
||||
}
|
||||
titletxt_y += titletxt_h;
|
||||
}
|
||||
|
@ -2446,8 +2445,8 @@ void draw_album_text(void)
|
|||
albumtxt = get_album_name(center_index);
|
||||
}
|
||||
|
||||
MYLCD(set_foreground)(G_BRIGHT(c));
|
||||
MYLCD(getstringsize)(albumtxt, &albumtxt_w, &albumtxt_h);
|
||||
mylcd_set_foreground(G_BRIGHT(c));
|
||||
mylcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h);
|
||||
if (center_index != prev_center_index) {
|
||||
albumtxt_x = 0;
|
||||
albumtxt_dir = -1;
|
||||
|
@ -2460,7 +2459,7 @@ void draw_album_text(void)
|
|||
albumtxt_y = LCD_HEIGHT - albumtxt_h - albumtxt_h/2;
|
||||
|
||||
if (albumtxt_w > LCD_WIDTH ) {
|
||||
MYLCD(putsxy)(albumtxt_x, albumtxt_y , albumtxt);
|
||||
mylcd_putsxy(albumtxt_x, albumtxt_y , albumtxt);
|
||||
if ( pf_state == pf_idle || pf_state == pf_show_tracks ) {
|
||||
if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1;
|
||||
else if ( albumtxt_x >= 0 ) albumtxt_dir = -1;
|
||||
|
@ -2468,7 +2467,7 @@ void draw_album_text(void)
|
|||
}
|
||||
}
|
||||
else {
|
||||
MYLCD(putsxy)((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt);
|
||||
mylcd_putsxy((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2641,9 +2640,9 @@ int main(void)
|
|||
if (show_fps)
|
||||
{
|
||||
#ifdef USEGSLIB
|
||||
MYLCD(set_foreground)(G_BRIGHT(255));
|
||||
mylcd_set_foreground(G_BRIGHT(255));
|
||||
#else
|
||||
MYLCD(set_foreground)(G_PIX(255,0,0));
|
||||
mylcd_set_foreground(G_PIX(255,0,0));
|
||||
#endif
|
||||
rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps);
|
||||
if (show_album_name == album_name_top)
|
||||
|
@ -2651,13 +2650,13 @@ int main(void)
|
|||
rb->screens[SCREEN_MAIN]->getcharheight();
|
||||
else
|
||||
fpstxt_y = 0;
|
||||
MYLCD(putsxy)(0, fpstxt_y, fpstxt);
|
||||
mylcd_putsxy(0, fpstxt_y, fpstxt);
|
||||
}
|
||||
draw_album_text();
|
||||
|
||||
|
||||
/* Copy offscreen buffer to LCD and give time to other threads */
|
||||
MYLCD(update)();
|
||||
mylcd_update();
|
||||
rb->yield();
|
||||
|
||||
/*/ Handle buttons */
|
||||
|
@ -2695,7 +2694,7 @@ int main(void)
|
|||
#ifdef USEGSLIB
|
||||
grey_show(true);
|
||||
#endif
|
||||
MYLCD(set_drawmode)(DRMODE_FG);
|
||||
mylcd_set_drawmode(DRMODE_FG);
|
||||
break;
|
||||
|
||||
case PF_NEXT:
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "lib/highscore.h"
|
||||
#include "lib/playback_control.h"
|
||||
#include "lib/playergfx.h"
|
||||
#include "lib/mylcd.h"
|
||||
|
||||
PLUGIN_HEADER
|
||||
|
||||
|
@ -599,8 +600,6 @@ PLUGIN_HEADER
|
|||
#define LINES_X LABEL_X
|
||||
#endif
|
||||
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
|
||||
extern const fb_data rockblox_background[];
|
||||
|
||||
#else /* HAVE_LCD_CHARCELLS */
|
||||
|
@ -614,8 +613,6 @@ extern const fb_data rockblox_background[];
|
|||
#define PREVIEW_X 15
|
||||
#define PREVIEW_Y 1
|
||||
|
||||
#define MYLCD(fn) pgfx_ ## fn
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _SPACE
|
||||
|
@ -983,14 +980,14 @@ static void refresh_board (void)
|
|||
#if LCD_DEPTH >= 2
|
||||
rb->lcd_set_foreground (LCD_BLACK);
|
||||
#elif LCD_DEPTH == 1
|
||||
MYLCD(set_drawmode) (DRMODE_SOLID | DRMODE_INVERSEVID);
|
||||
mylcd_set_drawmode (DRMODE_SOLID | DRMODE_INVERSEVID);
|
||||
#endif
|
||||
|
||||
MYLCD(fillrect) (BOARD_X, BOARD_Y, BOARD_WIDTH * BLOCK_WIDTH,
|
||||
mylcd_fillrect (BOARD_X, BOARD_Y, BOARD_WIDTH * BLOCK_WIDTH,
|
||||
BOARD_HEIGHT * BLOCK_HEIGHT);
|
||||
|
||||
#if LCD_DEPTH == 1
|
||||
MYLCD(set_drawmode) (DRMODE_SOLID);
|
||||
mylcd_set_drawmode (DRMODE_SOLID);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < BOARD_WIDTH; i++)
|
||||
|
@ -1067,7 +1064,7 @@ static void refresh_board (void)
|
|||
pgfx_drawpixel (BOARD_X + x, BOARD_Y + y);
|
||||
#endif
|
||||
}
|
||||
MYLCD(update) ();
|
||||
mylcd_update ();
|
||||
}
|
||||
|
||||
static bool canMoveTo (int x, int y, int newOrientation)
|
||||
|
@ -1092,14 +1089,14 @@ static void draw_next_block (void)
|
|||
#if LCD_DEPTH >= 2
|
||||
rb->lcd_set_foreground (LCD_BLACK);
|
||||
#elif LCD_DEPTH == 1
|
||||
MYLCD(set_drawmode) (DRMODE_SOLID | DRMODE_INVERSEVID);
|
||||
mylcd_set_drawmode (DRMODE_SOLID | DRMODE_INVERSEVID);
|
||||
#endif
|
||||
|
||||
/* 4x4 */
|
||||
MYLCD(fillrect) (PREVIEW_X, PREVIEW_Y, BLOCK_WIDTH * 4, BLOCK_HEIGHT * 4);
|
||||
mylcd_fillrect (PREVIEW_X, PREVIEW_Y, BLOCK_WIDTH * 4, BLOCK_HEIGHT * 4);
|
||||
|
||||
#if LCD_DEPTH == 1
|
||||
MYLCD(set_drawmode) (DRMODE_SOLID);
|
||||
mylcd_set_drawmode (DRMODE_SOLID);
|
||||
#endif
|
||||
|
||||
/* draw the lightgray rectangles */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
**************************************************************************/
|
||||
#include "plugin.h"
|
||||
#include "lib/playergfx.h"
|
||||
#include "lib/mylcd.h"
|
||||
|
||||
PLUGIN_HEADER
|
||||
|
||||
|
@ -27,12 +28,10 @@ PLUGIN_HEADER
|
|||
#define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72)
|
||||
#define SNOW_HEIGHT LCD_HEIGHT
|
||||
#define SNOW_WIDTH LCD_WIDTH
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#else
|
||||
#define NUM_PARTICLES 10
|
||||
#define SNOW_HEIGHT 14
|
||||
#define SNOW_WIDTH 20
|
||||
#define MYLCD(fn) pgfx_ ## fn
|
||||
#endif
|
||||
|
||||
/* variable button definitions */
|
||||
|
@ -136,14 +135,14 @@ static void snow_move(void)
|
|||
|
||||
for (i=0; i<NUM_PARTICLES; i++) {
|
||||
if (particle_exists(i)) {
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
rb->lcd_fillrect(particles[i][0],particles[i][1],
|
||||
FLAKE_WIDTH,FLAKE_WIDTH);
|
||||
#else
|
||||
pgfx_drawpixel(particles[i][0],particles[i][1]);
|
||||
#endif
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
if (particles[i][0] <= LCD_REMOTE_WIDTH
|
||||
&& particles[i][1] <= LCD_REMOTE_HEIGHT) {
|
||||
|
@ -201,7 +200,7 @@ static void snow_init(void)
|
|||
pgfx_display(4, 0);
|
||||
pgfx_display(8, 0);
|
||||
#endif
|
||||
MYLCD(clear_display)();
|
||||
mylcd_clear_display();
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
rb->lcd_remote_clear_display();
|
||||
#endif
|
||||
|
@ -227,7 +226,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
snow_init();
|
||||
while (1) {
|
||||
snow_move();
|
||||
MYLCD(update)();
|
||||
mylcd_update();
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
rb->lcd_remote_update();
|
||||
#endif
|
||||
|
|
|
@ -21,20 +21,15 @@
|
|||
|
||||
#include "plugin.h"
|
||||
#include "lib/grey.h"
|
||||
#include "lib/mylcd.h"
|
||||
PLUGIN_HEADER
|
||||
|
||||
/* different graphics libraries */
|
||||
#if LCD_DEPTH < 8
|
||||
#define USEGSLIB
|
||||
GREY_INFO_STRUCT
|
||||
#define MYLCD(fn) grey_ub_ ## fn
|
||||
#define MYLCD_UPDATE()
|
||||
#define MYXLCD(fn) grey_ub_ ## fn
|
||||
#define CFORMAT &format_grey
|
||||
#else
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#define MYLCD_UPDATE() rb->lcd_update();
|
||||
#define MYXLCD(fn) xlcd_ ## fn
|
||||
#define CFORMAT NULL
|
||||
#endif
|
||||
|
||||
|
@ -80,7 +75,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
rb->lcd_bitmap((fb_data *)bm.data, (LCD_WIDTH - bm.width) >> 1,
|
||||
(LCD_HEIGHT - bm.height) >> 1, bm.width, bm.height);
|
||||
#endif
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
while (rb->get_action(CONTEXT_STD,1) != ACTION_STD_OK) rb->yield();
|
||||
#ifdef USEGSLIB
|
||||
grey_release();
|
||||
|
|
|
@ -19,16 +19,14 @@
|
|||
#include "plugin.h"
|
||||
#include "lib/grey.h"
|
||||
#include "lib/helper.h"
|
||||
#include "lib/mylcd.h"
|
||||
|
||||
//#define TEST_GREYLIB /* Uncomment for testing greylib instead of core gfx */
|
||||
|
||||
#ifdef TEST_GREYLIB
|
||||
#define MYLCD(fn) grey_ ## fn
|
||||
GREY_INFO_STRUCT
|
||||
static unsigned char *gbuf;
|
||||
static size_t gbuf_size = 0;
|
||||
#else
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#endif
|
||||
|
||||
#define DURATION (HZ) /* longer duration gives more precise results */
|
||||
|
@ -67,45 +65,45 @@ static void time_drawpixel(void)
|
|||
int count1, count2, count3, count4;
|
||||
|
||||
/* Test 1: DRMODE_SOLID */
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
count1 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count1++ & 0x3ff];
|
||||
MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
}
|
||||
|
||||
/* Test 2: DRMODE_FG */
|
||||
MYLCD(set_drawmode)(DRMODE_FG);
|
||||
mylcd_set_drawmode(DRMODE_FG);
|
||||
count2 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count2++ & 0x3ff];
|
||||
MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
}
|
||||
/* Test 3: DRMODE_BG */
|
||||
MYLCD(set_drawmode)(DRMODE_BG);
|
||||
mylcd_set_drawmode(DRMODE_BG);
|
||||
count3 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count3++ & 0x3ff];
|
||||
MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
}
|
||||
/* Test 4: DRMODE_COMPLEMENT */
|
||||
MYLCD(set_drawmode)(DRMODE_COMPLEMENT);
|
||||
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
count4 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count4++ & 0x3ff];
|
||||
MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
mylcd_drawpixel((rnd >> 8) & 0x3f, rnd & 0x3f);
|
||||
}
|
||||
|
||||
rb->fdprintf(log_fd, "lcd_drawpixel (pixels/s): %d/%d/%d/%d\n",
|
||||
|
@ -119,7 +117,7 @@ static void time_drawline(void)
|
|||
int count1, count2, count3, count4;
|
||||
|
||||
/* Test 1: DRMODE_SOLID */
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
count1 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -127,12 +125,12 @@ static void time_drawline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
||||
MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
/* Test 2: DRMODE_FG */
|
||||
MYLCD(set_drawmode)(DRMODE_FG);
|
||||
mylcd_set_drawmode(DRMODE_FG);
|
||||
count2 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -140,11 +138,11 @@ static void time_drawline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
||||
MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 3: DRMODE_BG */
|
||||
MYLCD(set_drawmode)(DRMODE_BG);
|
||||
mylcd_set_drawmode(DRMODE_BG);
|
||||
count3 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -152,11 +150,11 @@ static void time_drawline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
||||
MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 4: DRMODE_COMPLEMENT */
|
||||
MYLCD(set_drawmode)(DRMODE_COMPLEMENT);
|
||||
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
count4 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -164,7 +162,7 @@ static void time_drawline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
||||
MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_drawline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
|
@ -179,7 +177,7 @@ static void time_hline(void)
|
|||
int count1, count2, count3, count4;
|
||||
|
||||
/* Test 1: DRMODE_SOLID */
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
count1 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -187,11 +185,11 @@ static void time_hline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
||||
MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
/* Test 2: DRMODE_FG */
|
||||
MYLCD(set_drawmode)(DRMODE_FG);
|
||||
mylcd_set_drawmode(DRMODE_FG);
|
||||
count2 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -199,10 +197,10 @@ static void time_hline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
||||
MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 3: DRMODE_BG */
|
||||
MYLCD(set_drawmode)(DRMODE_BG);
|
||||
mylcd_set_drawmode(DRMODE_BG);
|
||||
count3 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -210,10 +208,10 @@ static void time_hline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
||||
MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 4: DRMODE_COMPLEMENT */
|
||||
MYLCD(set_drawmode)(DRMODE_COMPLEMENT);
|
||||
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
count4 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -221,7 +219,7 @@ static void time_hline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
||||
MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_hline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
rb->fdprintf(log_fd, "lcd_hline (lines/s): %d/%d/%d/%d\n",
|
||||
|
@ -235,7 +233,7 @@ static void time_vline(void)
|
|||
int count1, count2, count3, count4;
|
||||
|
||||
/* Test 1: DRMODE_SOLID */
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
count1 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -243,11 +241,11 @@ static void time_vline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
||||
MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
/* Test 2: DRMODE_FG */
|
||||
MYLCD(set_drawmode)(DRMODE_FG);
|
||||
mylcd_set_drawmode(DRMODE_FG);
|
||||
count2 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -255,10 +253,10 @@ static void time_vline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
||||
MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 3: DRMODE_BG */
|
||||
MYLCD(set_drawmode)(DRMODE_BG);
|
||||
mylcd_set_drawmode(DRMODE_BG);
|
||||
count3 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -266,10 +264,10 @@ static void time_vline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
||||
MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 4: DRMODE_COMPLEMENT */
|
||||
MYLCD(set_drawmode)(DRMODE_COMPLEMENT);
|
||||
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
count4 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -277,7 +275,7 @@ static void time_vline(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
||||
MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
mylcd_vline((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
rb->fdprintf(log_fd, "lcd_vline (lines/s): %d/%d/%d/%d\n",
|
||||
|
@ -291,7 +289,7 @@ static void time_fillrect(void)
|
|||
int count1, count2, count3, count4;
|
||||
|
||||
/* Test 1: DRMODE_SOLID */
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
count1 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -299,12 +297,12 @@ static void time_fillrect(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count1++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count1++ & 0x3ff];
|
||||
MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
/* Test 2: DRMODE_FG */
|
||||
MYLCD(set_drawmode)(DRMODE_FG);
|
||||
mylcd_set_drawmode(DRMODE_FG);
|
||||
count2 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -312,11 +310,11 @@ static void time_fillrect(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count2++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count2++ & 0x3ff];
|
||||
MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 3: DRMODE_BG */
|
||||
MYLCD(set_drawmode)(DRMODE_BG);
|
||||
mylcd_set_drawmode(DRMODE_BG);
|
||||
count3 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -324,11 +322,11 @@ static void time_fillrect(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count3++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count3++ & 0x3ff];
|
||||
MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
/* Test 4: DRMODE_COMPLEMENT */
|
||||
MYLCD(set_drawmode)(DRMODE_COMPLEMENT);
|
||||
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
count4 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
|
@ -336,7 +334,7 @@ static void time_fillrect(void)
|
|||
{
|
||||
unsigned rnd1 = rand_table[count4++ & 0x3ff];
|
||||
unsigned rnd2 = rand_table[count4++ & 0x3ff];
|
||||
MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
mylcd_fillrect((rnd1 >> 8) & 0x3f, rnd1 & 0x3f,
|
||||
(rnd2 >> 8) & 0x3f, rnd2 & 0x3f);
|
||||
}
|
||||
|
||||
|
@ -353,45 +351,45 @@ static void time_text(void) /* tests mono_bitmap performance */
|
|||
rb->lcd_setfont(FONT_SYSFIXED);
|
||||
|
||||
/* Test 1: DRMODE_SOLID */
|
||||
MYLCD(set_drawmode)(DRMODE_SOLID);
|
||||
mylcd_set_drawmode(DRMODE_SOLID);
|
||||
count1 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count1++ & 0x3ff];
|
||||
MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
}
|
||||
|
||||
/* Test 2: DRMODE_FG */
|
||||
MYLCD(set_drawmode)(DRMODE_FG);
|
||||
mylcd_set_drawmode(DRMODE_FG);
|
||||
count2 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count2++ & 0x3ff];
|
||||
MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
}
|
||||
/* Test 3: DRMODE_BG */
|
||||
MYLCD(set_drawmode)(DRMODE_BG);
|
||||
mylcd_set_drawmode(DRMODE_BG);
|
||||
count3 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count3++ & 0x3ff];
|
||||
MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
}
|
||||
/* Test 4: DRMODE_COMPLEMENT */
|
||||
MYLCD(set_drawmode)(DRMODE_COMPLEMENT);
|
||||
mylcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
count4 = 0;
|
||||
rb->sleep(0); /* sync to tick */
|
||||
time_start = *rb->current_tick;
|
||||
while((time_end = *rb->current_tick) - time_start < DURATION)
|
||||
{
|
||||
unsigned rnd = rand_table[count4++ & 0x3ff];
|
||||
MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
mylcd_putsxy((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!");
|
||||
}
|
||||
|
||||
rb->fdprintf(log_fd, "lcd_putsxy (strings/s): %d/%d/%d/%d\n",
|
||||
|
|
|
@ -24,20 +24,15 @@
|
|||
#include "plugin.h"
|
||||
#include "lib/grey.h"
|
||||
#include "lib/jpeg_mem.h"
|
||||
#include "lib/mylcd.h"
|
||||
PLUGIN_HEADER
|
||||
|
||||
/* different graphics libraries */
|
||||
#if LCD_DEPTH < 8
|
||||
#define USEGSLIB
|
||||
GREY_INFO_STRUCT
|
||||
#define MYLCD(fn) grey_ub_ ## fn
|
||||
#define MYLCD_UPDATE()
|
||||
#define MYXLCD(fn) grey_ub_ ## fn
|
||||
#define CFORMAT &format_grey
|
||||
#else
|
||||
#define MYLCD(fn) rb->lcd_ ## fn
|
||||
#define MYLCD_UPDATE() rb->lcd_update();
|
||||
#define MYXLCD(fn) xlcd_ ## fn
|
||||
#define CFORMAT &format_native
|
||||
#endif
|
||||
|
||||
|
@ -94,7 +89,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
rb->lcd_bitmap((fb_data *)bm.data, (LCD_WIDTH - bm.width) >> 1,
|
||||
(LCD_HEIGHT - bm.height) >> 1, bm.width, bm.height);
|
||||
#endif
|
||||
MYLCD_UPDATE();
|
||||
mylcd_ub_update();
|
||||
while (rb->get_action(CONTEXT_STD,1) != ACTION_STD_OK) rb->yield();
|
||||
#ifdef USEGSLIB
|
||||
grey_release();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue