forked from len0rd/rockbox
o killed trailing whitespace
o uses the new grayscale.h header o #ifdef'ed out the code that builds a plugin, as this is now only part of the libplugin. we should probably build a separate plugin instead. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4639 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a9244032d2
commit
a08fa7142a
1 changed files with 67 additions and 144 deletions
|
@ -23,13 +23,11 @@
|
|||
#include "plugin.h"
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
|
||||
#include "grayscale.h"
|
||||
|
||||
/******************************* Globals ***********************************/
|
||||
|
||||
static struct plugin_api* rb; /* global api struct pointer */
|
||||
static char pbuf[32]; /* global printf buffer */
|
||||
static unsigned char *gbuf;
|
||||
static unsigned int gbuf_size = 0;
|
||||
|
||||
/*********************** Begin grayscale framework *************************/
|
||||
|
||||
|
@ -55,43 +53,6 @@ static unsigned int gbuf_size = 0;
|
|||
* order to not waste space. Don't forget to cut the prototype as well.
|
||||
*/
|
||||
|
||||
/**** internal core functions and definitions ****/
|
||||
|
||||
/* You do not want to touch these if you don't know exactly what you're
|
||||
* doing. */
|
||||
|
||||
#define GRAY_RUNNING 0x0001 /* grayscale overlay is running */
|
||||
#define GRAY_DEFERRED_UPDATE 0x0002 /* lcd_update() requested */
|
||||
|
||||
/* unsigned 16 bit multiplication (a single instruction on the SH) */
|
||||
#define MULU16(a, b) (((unsigned short) (a)) * ((unsigned short) (b)))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int by; /* 8-pixel units */
|
||||
int width;
|
||||
int height;
|
||||
int bheight; /* 8-pixel units */
|
||||
int plane_size;
|
||||
int depth; /* number_of_bitplanes = (number_of_grayscales - 1) */
|
||||
int cur_plane; /* for the timer isr */
|
||||
unsigned long randmask; /* mask for random value in graypixel() */
|
||||
unsigned long flags; /* various flags, see #defines */
|
||||
unsigned char *data; /* pointer to start of bitplane data */
|
||||
unsigned long *bitpattern; /* pointer to start of pattern table */
|
||||
} tGraybuf;
|
||||
|
||||
static tGraybuf *graybuf = NULL;
|
||||
static short gray_random_buffer;
|
||||
|
||||
/** prototypes **/
|
||||
|
||||
void gray_timer_isr(void);
|
||||
void graypixel(int x, int y, unsigned long pattern);
|
||||
void grayblock(int x, int by, unsigned char* src, int stride);
|
||||
void grayinvertmasked(int x, int by, unsigned char mask);
|
||||
|
||||
/** implementation **/
|
||||
|
||||
/* timer interrupt handler: display next bitplane */
|
||||
|
@ -426,16 +387,6 @@ void grayinvertmasked(int x, int by, unsigned char mask)
|
|||
);
|
||||
}
|
||||
|
||||
/*** public core functions ***/
|
||||
|
||||
/** prototypes **/
|
||||
|
||||
int gray_init_buffer(unsigned char *gbuf, int gbuf_size, int width,
|
||||
int bheight, int depth);
|
||||
void gray_release_buffer(void);
|
||||
void gray_position_display(int x, int by);
|
||||
void gray_show_display(bool enable);
|
||||
|
||||
/** implementation **/
|
||||
|
||||
/* Prepare the grayscale display buffer
|
||||
|
@ -629,39 +580,6 @@ void gray_show_display(bool enable)
|
|||
|
||||
/** prototypes **/
|
||||
|
||||
/* functions affecting the whole display */
|
||||
void gray_clear_display(void);
|
||||
void gray_black_display(void);
|
||||
void gray_deferred_update(void);
|
||||
|
||||
/* scrolling functions */
|
||||
void gray_scroll_left(int count, bool black_border);
|
||||
void gray_scroll_right(int count, bool black_border);
|
||||
void gray_scroll_up8(bool black_border);
|
||||
void gray_scroll_down8(bool black_border);
|
||||
void gray_scroll_up(int count, bool black_border);
|
||||
void gray_scroll_down(int count, bool black_border);
|
||||
|
||||
/* pixel functions */
|
||||
void gray_drawpixel(int x, int y, int brightness);
|
||||
void gray_invertpixel(int x, int y);
|
||||
|
||||
/* line functions */
|
||||
void gray_drawline(int x1, int y1, int x2, int y2, int brightness);
|
||||
void gray_invertline(int x1, int y1, int x2, int y2);
|
||||
|
||||
/* rectangle functions */
|
||||
void gray_drawrect(int x1, int y1, int x2, int y2, int brightness);
|
||||
void gray_fillrect(int x1, int y1, int x2, int y2, int brightness);
|
||||
void gray_invertrect(int x1, int y1, int x2, int y2);
|
||||
|
||||
/* bitmap functions */
|
||||
void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny,
|
||||
int stride);
|
||||
void gray_drawbitmap(unsigned char *src, int x, int y, int nx, int ny,
|
||||
int stride, bool draw_bg, int fg_brightness,
|
||||
int bg_brightness);
|
||||
|
||||
/** implementation **/
|
||||
|
||||
/* Clear the grayscale display (sets all pixels to white)
|
||||
|
@ -1610,6 +1528,11 @@ void gray_drawbitmap(unsigned char *src, int x, int y, int nx, int ny,
|
|||
|
||||
/*********************** end grayscale framework ***************************/
|
||||
|
||||
#ifdef GRAYSCALE_PLUGIN
|
||||
static char pbuf[32]; /* global printf buffer */
|
||||
static unsigned char *gbuf;
|
||||
static unsigned int gbuf_size = 0;
|
||||
|
||||
/**************************** main function ********************************/
|
||||
|
||||
/* this is only a demo of what the framework can do */
|
||||
|
@ -1810,7 +1733,6 @@ int main(void)
|
|||
}
|
||||
|
||||
/*************************** Plugin entry point ****************************/
|
||||
|
||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1828,6 +1750,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
|||
rb->usb_screen();
|
||||
return ret;
|
||||
}
|
||||
#endif /* GRAYSCALE_PLUGIN */
|
||||
|
||||
#endif // #ifdef HAVE_LCD_BITMAP
|
||||
#endif // #ifndef SIMULATOR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue