forked from len0rd/rockbox
JPEG viewer adapted to colour targets (greyscale only for now). New functions in the lcd extensions plugin library for drawing canonical greyscale bitmaps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8617 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cb0c5a3c03
commit
56647275b5
3 changed files with 199 additions and 19 deletions
|
|
@ -23,11 +23,11 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef SIMULATOR /* not for simulator by now */
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
|
#if defined(HAVE_LCD_BITMAP) && ((LCD_DEPTH >= 8) || !defined(SIMULATOR))
|
||||||
#include "gray.h"
|
#include "gray.h"
|
||||||
|
#include "xlcd.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
|
@ -51,7 +51,8 @@ PLUGIN_HEADER
|
||||||
#define JPEG_RIGHT BUTTON_RIGHT
|
#define JPEG_RIGHT BUTTON_RIGHT
|
||||||
#define JPEG_QUIT BUTTON_OFF
|
#define JPEG_QUIT BUTTON_OFF
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == IRIVER_H100_PAD
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
||||||
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
||||||
#define JPEG_ZOOM_IN BUTTON_SELECT
|
#define JPEG_ZOOM_IN BUTTON_SELECT
|
||||||
#define JPEG_ZOOM_OUT BUTTON_MODE
|
#define JPEG_ZOOM_OUT BUTTON_MODE
|
||||||
#define JPEG_UP BUTTON_UP
|
#define JPEG_UP BUTTON_UP
|
||||||
|
|
@ -69,6 +70,27 @@ PLUGIN_HEADER
|
||||||
#define JPEG_RIGHT BUTTON_RIGHT
|
#define JPEG_RIGHT BUTTON_RIGHT
|
||||||
#define JPEG_QUIT BUTTON_SELECT
|
#define JPEG_QUIT BUTTON_SELECT
|
||||||
|
|
||||||
|
#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
|
||||||
|
#define JPEG_ZOOM_IN_PRE BUTTON_MENU
|
||||||
|
#define JPEG_ZOOM_IN (BUTTON_MENU | BUTTON_REL)
|
||||||
|
#define JPEG_ZOOM_OUT (BUTTON_MENU | BUTTON_REPEAT)
|
||||||
|
#define JPEG_UP BUTTON_UP
|
||||||
|
#define JPEG_DOWN BUTTON_DOWN
|
||||||
|
#define JPEG_LEFT BUTTON_LEFT
|
||||||
|
#define JPEG_RIGHT BUTTON_RIGHT
|
||||||
|
#define JPEG_QUIT BUTTON_POWER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* different graphics libraries */
|
||||||
|
#if LCD_DEPTH < 8
|
||||||
|
#define USEGSLIB
|
||||||
|
#define MYLCD(fn) gray_ub_ ## fn
|
||||||
|
#define MYLCD_UPDATE()
|
||||||
|
#define MYXLCD(fn) gray_ub_ ## fn
|
||||||
|
#else
|
||||||
|
#define MYLCD(fn) rb->lcd_ ## fn
|
||||||
|
#define MYLCD_UPDATE() rb->lcd_update();
|
||||||
|
#define MYXLCD(fn) xlcd_ ## fn
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************************* Globals ***********************************/
|
/******************************* Globals ***********************************/
|
||||||
|
|
@ -1538,8 +1560,9 @@ int root_size;
|
||||||
void cleanup(void *parameter)
|
void cleanup(void *parameter)
|
||||||
{
|
{
|
||||||
(void)parameter;
|
(void)parameter;
|
||||||
|
#ifdef USEGSLIB
|
||||||
gray_show(false);
|
gray_show(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VSCROLL (LCD_HEIGHT/8)
|
#define VSCROLL (LCD_HEIGHT/8)
|
||||||
|
|
@ -1570,12 +1593,13 @@ int scroll_bmp(struct t_disp* pdisp)
|
||||||
move = MIN(HSCROLL, pdisp->x);
|
move = MIN(HSCROLL, pdisp->x);
|
||||||
if (move > 0)
|
if (move > 0)
|
||||||
{
|
{
|
||||||
gray_ub_scroll_right(move); /* scroll right */
|
MYXLCD(scroll_right)(move); /* scroll right */
|
||||||
pdisp->x -= move;
|
pdisp->x -= move;
|
||||||
gray_ub_gray_bitmap_part(
|
MYXLCD(gray_bitmap_part)(
|
||||||
pdisp->bitmap, pdisp->x, pdisp->y, pdisp->stride,
|
pdisp->bitmap, pdisp->x, pdisp->y, pdisp->stride,
|
||||||
0, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
0, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
||||||
move, MIN(LCD_HEIGHT, pdisp->height)); /* w, h */
|
move, MIN(LCD_HEIGHT, pdisp->height)); /* w, h */
|
||||||
|
MYLCD_UPDATE();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1584,13 +1608,14 @@ int scroll_bmp(struct t_disp* pdisp)
|
||||||
move = MIN(HSCROLL, pdisp->width - pdisp->x - LCD_WIDTH);
|
move = MIN(HSCROLL, pdisp->width - pdisp->x - LCD_WIDTH);
|
||||||
if (move > 0)
|
if (move > 0)
|
||||||
{
|
{
|
||||||
gray_ub_scroll_left(move); /* scroll left */
|
MYXLCD(scroll_left)(move); /* scroll left */
|
||||||
pdisp->x += move;
|
pdisp->x += move;
|
||||||
gray_ub_gray_bitmap_part(
|
MYXLCD(gray_bitmap_part)(
|
||||||
pdisp->bitmap, pdisp->x + LCD_WIDTH - move,
|
pdisp->bitmap, pdisp->x + LCD_WIDTH - move,
|
||||||
pdisp->y, pdisp->stride,
|
pdisp->y, pdisp->stride,
|
||||||
LCD_WIDTH - move, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
LCD_WIDTH - move, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
||||||
move, MIN(LCD_HEIGHT, pdisp->height)); /* w, h */
|
move, MIN(LCD_HEIGHT, pdisp->height)); /* w, h */
|
||||||
|
MYLCD_UPDATE();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1599,12 +1624,13 @@ int scroll_bmp(struct t_disp* pdisp)
|
||||||
move = MIN(VSCROLL, pdisp->y);
|
move = MIN(VSCROLL, pdisp->y);
|
||||||
if (move > 0)
|
if (move > 0)
|
||||||
{
|
{
|
||||||
gray_ub_scroll_down(move); /* scroll down */
|
MYXLCD(scroll_down)(move); /* scroll down */
|
||||||
pdisp->y -= move;
|
pdisp->y -= move;
|
||||||
gray_ub_gray_bitmap_part(
|
MYXLCD(gray_bitmap_part)(
|
||||||
pdisp->bitmap, pdisp->x, pdisp->y, pdisp->stride,
|
pdisp->bitmap, pdisp->x, pdisp->y, pdisp->stride,
|
||||||
MAX(0, (LCD_WIDTH-pdisp->width)/2), 0, /* x, y */
|
MAX(0, (LCD_WIDTH-pdisp->width)/2), 0, /* x, y */
|
||||||
MIN(LCD_WIDTH, pdisp->width), move); /* w, h */
|
MIN(LCD_WIDTH, pdisp->width), move); /* w, h */
|
||||||
|
MYLCD_UPDATE();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1613,13 +1639,14 @@ int scroll_bmp(struct t_disp* pdisp)
|
||||||
move = MIN(VSCROLL, pdisp->height - pdisp->y - LCD_HEIGHT);
|
move = MIN(VSCROLL, pdisp->height - pdisp->y - LCD_HEIGHT);
|
||||||
if (move > 0)
|
if (move > 0)
|
||||||
{
|
{
|
||||||
gray_ub_scroll_up(move); /* scroll up */
|
MYXLCD(scroll_up)(move); /* scroll up */
|
||||||
pdisp->y += move;
|
pdisp->y += move;
|
||||||
gray_ub_gray_bitmap_part(
|
MYXLCD(gray_bitmap_part)(
|
||||||
pdisp->bitmap, pdisp->x,
|
pdisp->bitmap, pdisp->x,
|
||||||
pdisp->y + LCD_HEIGHT - move, pdisp->stride,
|
pdisp->y + LCD_HEIGHT - move, pdisp->stride,
|
||||||
MAX(0, (LCD_WIDTH-pdisp->width)/2), LCD_HEIGHT - move, /* x, y */
|
MAX(0, (LCD_WIDTH-pdisp->width)/2), LCD_HEIGHT - move, /* x, y */
|
||||||
MIN(LCD_WIDTH, pdisp->width), move); /* w, h */
|
MIN(LCD_WIDTH, pdisp->width), move); /* w, h */
|
||||||
|
MYLCD_UPDATE();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1821,12 +1848,14 @@ void get_view(struct t_disp* p_disp, int* p_cx, int* p_cy)
|
||||||
|
|
||||||
|
|
||||||
/* load, decode, display the image */
|
/* load, decode, display the image */
|
||||||
int main(char* filename)
|
int plugin_main(char* filename)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int filesize;
|
int filesize;
|
||||||
|
#ifdef USEGSLIB
|
||||||
int grayscales;
|
int grayscales;
|
||||||
long graysize; // helper
|
long graysize; // helper
|
||||||
|
#endif
|
||||||
unsigned char* buf_jpeg; /* compressed JPEG image */
|
unsigned char* buf_jpeg; /* compressed JPEG image */
|
||||||
static struct jpeg jpg; /* too large for stack */
|
static struct jpeg jpg; /* too large for stack */
|
||||||
int status;
|
int status;
|
||||||
|
|
@ -1847,6 +1876,7 @@ int main(char* filename)
|
||||||
buf = rb->plugin_get_audio_buffer(&buf_size); /* start munching memory */
|
buf = rb->plugin_get_audio_buffer(&buf_size); /* start munching memory */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USEGSLIB
|
||||||
/* initialize the grayscale buffer: 32 bitplanes for 33 shades of gray. */
|
/* initialize the grayscale buffer: 32 bitplanes for 33 shades of gray. */
|
||||||
grayscales = gray_init(rb, buf, buf_size, false, LCD_WIDTH, LCD_HEIGHT/8,
|
grayscales = gray_init(rb, buf, buf_size, false, LCD_WIDTH, LCD_HEIGHT/8,
|
||||||
32, &graysize) + 1;
|
32, &graysize) + 1;
|
||||||
|
|
@ -1858,6 +1888,9 @@ int main(char* filename)
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
xlcd_init(rb);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* allocate JPEG buffer */
|
/* allocate JPEG buffer */
|
||||||
|
|
@ -1927,15 +1960,18 @@ int main(char* filename)
|
||||||
rb->lcd_puts(0, 3, print);
|
rb->lcd_puts(0, 3, print);
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
gray_ub_clear_display();
|
MYLCD(clear_display)();
|
||||||
gray_ub_gray_bitmap_part(
|
MYXLCD(gray_bitmap_part)(
|
||||||
p_disp->bitmap, p_disp->x, p_disp->y, p_disp->stride,
|
p_disp->bitmap, p_disp->x, p_disp->y, p_disp->stride,
|
||||||
MAX(0, (LCD_WIDTH - p_disp->width) / 2),
|
MAX(0, (LCD_WIDTH - p_disp->width) / 2),
|
||||||
MAX(0, (LCD_HEIGHT - p_disp->height) / 2),
|
MAX(0, (LCD_HEIGHT - p_disp->height) / 2),
|
||||||
MIN(LCD_WIDTH, p_disp->width),
|
MIN(LCD_WIDTH, p_disp->width),
|
||||||
MIN(LCD_HEIGHT, p_disp->height));
|
MIN(LCD_HEIGHT, p_disp->height));
|
||||||
|
MYLCD_UPDATE();
|
||||||
|
|
||||||
|
#ifdef USEGSLIB
|
||||||
gray_show(true); /* switch on grayscale overlay */
|
gray_show(true); /* switch on grayscale overlay */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* drawing is now finished, play around with scrolling
|
/* drawing is now finished, play around with scrolling
|
||||||
* until you press OFF or connect USB
|
* until you press OFF or connect USB
|
||||||
|
|
@ -1971,12 +2007,18 @@ int main(char* filename)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USEGSLIB
|
||||||
gray_show(false); /* switch off overlay */
|
gray_show(false); /* switch off overlay */
|
||||||
|
#else
|
||||||
|
rb->lcd_clear_display();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
while (status != PLUGIN_OK && status != PLUGIN_USB_CONNECTED);
|
while (status != PLUGIN_OK && status != PLUGIN_USB_CONNECTED);
|
||||||
|
|
||||||
|
#ifdef USEGSLIB
|
||||||
gray_release(); /* deinitialize */
|
gray_release(); /* deinitialize */
|
||||||
|
#endif
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -1987,9 +2029,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
{
|
{
|
||||||
rb = api; /* copy to global api pointer */
|
rb = api; /* copy to global api pointer */
|
||||||
|
|
||||||
return main((char*)parameter);
|
return plugin_main((char*)parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* #ifdef HAVE_LCD_BITMAP */
|
#endif /* HAVE_LCD_BITMAP && ((LCD_DEPTH >= 8) || !defined(SIMULATOR))*/
|
||||||
#endif /* #ifndef SIMULATOR */
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,138 @@ void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3)
|
||||||
|
|
||||||
#if LCD_DEPTH >= 8
|
#if LCD_DEPTH >= 8
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
static const fb_data graylut[256] = {
|
||||||
|
#if LCD_PIXELFORMAT == RGB565
|
||||||
|
0x0000, 0x0000, 0x0000, 0x0020, 0x0020, 0x0821, 0x0821, 0x0841,
|
||||||
|
0x0841, 0x0841, 0x0841, 0x0861, 0x0861, 0x1062, 0x1062, 0x1082,
|
||||||
|
0x1082, 0x1082, 0x1082, 0x10a2, 0x10a2, 0x18a3, 0x18a3, 0x18c3,
|
||||||
|
0x18c3, 0x18c3, 0x18c3, 0x18e3, 0x18e3, 0x20e4, 0x20e4, 0x2104,
|
||||||
|
0x2104, 0x2104, 0x2104, 0x2124, 0x2124, 0x2124, 0x2925, 0x2945,
|
||||||
|
0x2945, 0x2945, 0x2945, 0x2965, 0x2965, 0x2965, 0x3166, 0x3186,
|
||||||
|
0x3186, 0x3186, 0x3186, 0x31a6, 0x31a6, 0x31a6, 0x39a7, 0x39c7,
|
||||||
|
0x39c7, 0x39c7, 0x39c7, 0x39e7, 0x39e7, 0x39e7, 0x41e8, 0x4208,
|
||||||
|
0x4208, 0x4208, 0x4208, 0x4228, 0x4228, 0x4228, 0x4a29, 0x4a49,
|
||||||
|
0x4a49, 0x4a49, 0x4a49, 0x4a69, 0x4a69, 0x4a69, 0x4a69, 0x528a,
|
||||||
|
0x528a, 0x528a, 0x528a, 0x52aa, 0x52aa, 0x52aa, 0x52aa, 0x5aab,
|
||||||
|
0x5acb, 0x5acb, 0x5acb, 0x5acb, 0x5aeb, 0x5aeb, 0x5aeb, 0x62ec,
|
||||||
|
0x630c, 0x630c, 0x630c, 0x630c, 0x632c, 0x632c, 0x632c, 0x6b2d,
|
||||||
|
0x6b4d, 0x6b4d, 0x6b4d, 0x6b4d, 0x6b6d, 0x6b6d, 0x6b6d, 0x6b6d,
|
||||||
|
0x738e, 0x738e, 0x738e, 0x738e, 0x73ae, 0x73ae, 0x73ae, 0x73ae,
|
||||||
|
0x7bcf, 0x7bcf, 0x7bcf, 0x7bcf, 0x7bef, 0x7bef, 0x7bef, 0x7bef,
|
||||||
|
0x8410, 0x8410, 0x8410, 0x8410, 0x8430, 0x8430, 0x8430, 0x8430,
|
||||||
|
0x8c51, 0x8c51, 0x8c51, 0x8c51, 0x8c71, 0x8c71, 0x8c71, 0x8c71,
|
||||||
|
0x9492, 0x9492, 0x9492, 0x9492, 0x94b2, 0x94b2, 0x94b2, 0x94b2,
|
||||||
|
0x94d2, 0x9cd3, 0x9cd3, 0x9cd3, 0x9cf3, 0x9cf3, 0x9cf3, 0x9cf3,
|
||||||
|
0x9d13, 0xa514, 0xa514, 0xa514, 0xa534, 0xa534, 0xa534, 0xa534,
|
||||||
|
0xa554, 0xad55, 0xad55, 0xad55, 0xad55, 0xad75, 0xad75, 0xad75,
|
||||||
|
0xad75, 0xb596, 0xb596, 0xb596, 0xb596, 0xb5b6, 0xb5b6, 0xb5b6,
|
||||||
|
0xb5b6, 0xb5d6, 0xbdd7, 0xbdd7, 0xbdd7, 0xbdf7, 0xbdf7, 0xbdf7,
|
||||||
|
0xbdf7, 0xbe17, 0xc618, 0xc618, 0xc618, 0xc638, 0xc638, 0xc638,
|
||||||
|
0xc638, 0xc658, 0xce59, 0xce59, 0xce59, 0xce79, 0xce79, 0xce79,
|
||||||
|
0xce79, 0xce99, 0xd69a, 0xd69a, 0xd69a, 0xd6ba, 0xd6ba, 0xd6ba,
|
||||||
|
0xd6ba, 0xd6da, 0xd6da, 0xdedb, 0xdedb, 0xdefb, 0xdefb, 0xdefb,
|
||||||
|
0xdefb, 0xdf1b, 0xdf1b, 0xe71c, 0xe71c, 0xe73c, 0xe73c, 0xe73c,
|
||||||
|
0xe73c, 0xe75c, 0xe75c, 0xef5d, 0xef5d, 0xef7d, 0xef7d, 0xef7d,
|
||||||
|
0xef7d, 0xef9d, 0xef9d, 0xf79e, 0xf79e, 0xf7be, 0xf7be, 0xf7be,
|
||||||
|
0xf7be, 0xf7de, 0xf7de, 0xffdf, 0xffdf, 0xffff, 0xffff, 0xffff
|
||||||
|
#elif LCD_PIXELFORMAT == RGB565SWAPPED
|
||||||
|
0x0000, 0x0000, 0x0000, 0x2000, 0x2000, 0x2108, 0x2108, 0x4108,
|
||||||
|
0x4108, 0x4108, 0x4108, 0x6108, 0x6108, 0x6210, 0x6210, 0x8210,
|
||||||
|
0x8210, 0x8210, 0x8210, 0xa210, 0xa210, 0xa318, 0xa318, 0xc318,
|
||||||
|
0xc318, 0xc318, 0xc318, 0xe318, 0xe318, 0xe420, 0xe420, 0x0421,
|
||||||
|
0x0421, 0x0421, 0x0421, 0x2421, 0x2421, 0x2421, 0x2529, 0x4529,
|
||||||
|
0x4529, 0x4529, 0x4529, 0x6529, 0x6529, 0x6529, 0x6631, 0x8631,
|
||||||
|
0x8631, 0x8631, 0x8631, 0xa631, 0xa631, 0xa631, 0xa739, 0xc739,
|
||||||
|
0xc739, 0xc739, 0xc739, 0xe739, 0xe739, 0xe739, 0xe841, 0x0842,
|
||||||
|
0x0842, 0x0842, 0x0842, 0x2842, 0x2842, 0x2842, 0x294a, 0x494a,
|
||||||
|
0x494a, 0x494a, 0x494a, 0x694a, 0x694a, 0x694a, 0x694a, 0x8a52,
|
||||||
|
0x8a52, 0x8a52, 0x8a52, 0xaa52, 0xaa52, 0xaa52, 0xaa52, 0xab5a,
|
||||||
|
0xcb5a, 0xcb5a, 0xcb5a, 0xcb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xec62,
|
||||||
|
0x0c63, 0x0c63, 0x0c63, 0x0c63, 0x2c63, 0x2c63, 0x2c63, 0x2d6b,
|
||||||
|
0x4d6b, 0x4d6b, 0x4d6b, 0x4d6b, 0x6d6b, 0x6d6b, 0x6d6b, 0x6d6b,
|
||||||
|
0x8e73, 0x8e73, 0x8e73, 0x8e73, 0xae73, 0xae73, 0xae73, 0xae73,
|
||||||
|
0xcf7b, 0xcf7b, 0xcf7b, 0xcf7b, 0xef7b, 0xef7b, 0xef7b, 0xef7b,
|
||||||
|
0x1084, 0x1084, 0x1084, 0x1084, 0x3084, 0x3084, 0x3084, 0x3084,
|
||||||
|
0x518c, 0x518c, 0x518c, 0x518c, 0x718c, 0x718c, 0x718c, 0x718c,
|
||||||
|
0x9294, 0x9294, 0x9294, 0x9294, 0xb294, 0xb294, 0xb294, 0xb294,
|
||||||
|
0xd294, 0xd39c, 0xd39c, 0xd39c, 0xf39c, 0xf39c, 0xf39c, 0xf39c,
|
||||||
|
0x139d, 0x14a5, 0x14a5, 0x14a5, 0x34a5, 0x34a5, 0x34a5, 0x34a5,
|
||||||
|
0x54a5, 0x55ad, 0x55ad, 0x55ad, 0x55ad, 0x75ad, 0x75ad, 0x75ad,
|
||||||
|
0x75ad, 0x96b5, 0x96b5, 0x96b5, 0x96b5, 0xb6b5, 0xb6b5, 0xb6b5,
|
||||||
|
0xb6b5, 0xd6b5, 0xd7bd, 0xd7bd, 0xd7bd, 0xf7bd, 0xf7bd, 0xf7bd,
|
||||||
|
0xf7bd, 0x17be, 0x18c6, 0x18c6, 0x18c6, 0x38c6, 0x38c6, 0x38c6,
|
||||||
|
0x38c6, 0x58c6, 0x59ce, 0x59ce, 0x59ce, 0x79ce, 0x79ce, 0x79ce,
|
||||||
|
0x79ce, 0x99ce, 0x9ad6, 0x9ad6, 0x9ad6, 0xbad6, 0xbad6, 0xbad6,
|
||||||
|
0xbad6, 0xdad6, 0xdad6, 0xdbde, 0xdbde, 0xfbde, 0xfbde, 0xfbde,
|
||||||
|
0xfbde, 0x1bdf, 0x1bdf, 0x1ce7, 0x1ce7, 0x3ce7, 0x3ce7, 0x3ce7,
|
||||||
|
0x3ce7, 0x5ce7, 0x5ce7, 0x5def, 0x5def, 0x7def, 0x7def, 0x7def,
|
||||||
|
0x7def, 0x9def, 0x9def, 0x9ef7, 0x9ef7, 0xbef7, 0xbef7, 0xbef7,
|
||||||
|
0xbef7, 0xdef7, 0xdef7, 0xdfff, 0xdfff, 0xffff, 0xffff, 0xffff
|
||||||
|
#endif /* LCD_PIXELFORMAT */
|
||||||
|
};
|
||||||
|
#endif /* HAVE_LCD_COLOR */
|
||||||
|
|
||||||
|
/* Draw a partial greyscale bitmap, canonical 8 bit format */
|
||||||
|
void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
||||||
|
int stride, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
const unsigned char *src_end;
|
||||||
|
fb_data *dst;
|
||||||
|
|
||||||
|
/* nothing to draw? */
|
||||||
|
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|
||||||
|
|| (x + width <= 0) || (y + height <= 0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* clipping */
|
||||||
|
if (x < 0)
|
||||||
|
{
|
||||||
|
width += x;
|
||||||
|
src_x -= x;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (y < 0)
|
||||||
|
{
|
||||||
|
height += y;
|
||||||
|
src_y -= y;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
if (x + width > LCD_WIDTH)
|
||||||
|
width = LCD_WIDTH - x;
|
||||||
|
if (y + height > LCD_HEIGHT)
|
||||||
|
height = LCD_HEIGHT - y;
|
||||||
|
|
||||||
|
src += stride * src_y + src_x; /* move starting point */
|
||||||
|
src_end = src + stride * height;
|
||||||
|
dst = local_rb->lcd_framebuffer + LCD_WIDTH * y + x;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
const unsigned char *src_row = src;
|
||||||
|
const unsigned char *row_end = src_row + width;
|
||||||
|
fb_data *dst_row = dst;
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
do
|
||||||
|
*dst_row++ = graylut[*src_row++];
|
||||||
|
while (src_row < row_end);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
src += stride;
|
||||||
|
dst += LCD_WIDTH;
|
||||||
|
}
|
||||||
|
while (src < src_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Draw a full greyscale bitmap, canonical 8 bit format */
|
||||||
|
void xlcd_gray_bitmap(const unsigned char *src, int x, int y, int width,
|
||||||
|
int height)
|
||||||
|
{
|
||||||
|
xlcd_gray_bitmap_part(src, 0, 0, width, x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xlcd_scroll_left(int count)
|
void xlcd_scroll_left(int count)
|
||||||
{
|
{
|
||||||
fb_data *data, *data_end;
|
fb_data *data, *data_end;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,13 @@
|
||||||
void xlcd_init(struct plugin_api* newrb);
|
void xlcd_init(struct plugin_api* newrb);
|
||||||
void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3);
|
void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3);
|
||||||
|
|
||||||
|
#if LCD_DEPTH >= 8
|
||||||
|
void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
||||||
|
int stride, int x, int y, int width, int height);
|
||||||
|
void xlcd_gray_bitmap(const unsigned char *src, int x, int y, int width,
|
||||||
|
int height);
|
||||||
|
#endif
|
||||||
|
|
||||||
void xlcd_scroll_left(int count);
|
void xlcd_scroll_left(int count);
|
||||||
void xlcd_scroll_right(int count);
|
void xlcd_scroll_right(int count);
|
||||||
void xlcd_scroll_up(int count);
|
void xlcd_scroll_up(int count);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue