From cb36fec3922cb1317bdb06a6497370f188694d4e Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 28 Jul 2006 07:17:00 +0000 Subject: LCD drivers: * Slight speedup for 2bit greyscale drivers. Use the same scrolltext drawing anywhere. * Cleanup, fixes and definitions in preparation for X5 remote. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10346 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-16bit.c | 3 +- firmware/drivers/lcd-2bit-horz.c | 71 ++++++++++++++--------------- firmware/drivers/lcd-h100-remote.c | 70 ++++++++++++++--------------- firmware/drivers/lcd-h100.c | 91 ++++++++++++++++++++------------------ 4 files changed, 120 insertions(+), 115 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index d237dac858..fd95f2aa16 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -34,7 +34,7 @@ #include "rbunicode.h" #include "bidi.h" -#define SCROLLABLE_LINES 26 +#define SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32) enum fill_opt { OPT_NONE = 0, @@ -972,4 +972,3 @@ static void scroll_thread(void) sleep(scroll_ticks); } } - diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 4ee2e2ea28..68074e36e8 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c @@ -34,7 +34,7 @@ #include "rbunicode.h" #include "bidi.h" -#define SCROLLABLE_LINES 26 +#define SCROLLABLE_LINES (((LCD_HEIGHT+4)/5 < 32) ? (LCD_HEIGHT+4)/5 : 32) /*** globals ***/ @@ -148,21 +148,28 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h) static void setpixel(int x, int y) { - unsigned char *data = &lcd_framebuffer[y][x>>2]; unsigned mask = pixmask[x & 3]; - *data = (*data & ~mask) | (fg_pattern & mask); + fb_data *address = &lcd_framebuffer[y][x>>2]; + unsigned data = *address; + + *address = data ^ ((data ^ fg_pattern) & mask); } static void clearpixel(int x, int y) { - unsigned char *data = &lcd_framebuffer[y][x>>2]; unsigned mask = pixmask[x & 3]; - *data = (*data & ~mask) | (bg_pattern & mask); + fb_data *address = &lcd_framebuffer[y][x>>2]; + unsigned data = *address; + + *address = data ^ ((data ^ bg_pattern) & mask); } static void flippixel(int x, int y) { - lcd_framebuffer[y][x>>2] ^= pixmask[x & 3]; + unsigned mask = pixmask[x & 3]; + fb_data *address = &lcd_framebuffer[y][x>>2]; + + *address ^= mask; } static void nopixel(int x, int y) @@ -177,34 +184,34 @@ lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { }; /* 'mask' and 'bits' contain 2 bits per pixel */ -static void flipblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipblock(fb_data *address, unsigned mask, unsigned bits) { *address ^= bits & mask; } -static void bgblock(unsigned char *address, unsigned mask, unsigned bits) +static void bgblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bgblock(unsigned char *address, unsigned mask, unsigned bits) +static void bgblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ bg_pattern) & mask & ~bits); } -static void fgblock(unsigned char *address, unsigned mask, unsigned bits) +static void fgblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fgblock(unsigned char *address, unsigned mask, unsigned bits) +static void fgblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ fg_pattern) & mask & bits); } -static void solidblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; unsigned bgp = bg_pattern; @@ -213,34 +220,34 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits) *address = data ^ ((data ^ bits) & mask); } -static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) { *address ^= ~bits & mask; } -static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void bginvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void bginvblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ bg_pattern) & mask & bits); } -static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void fginvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void fginvblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ fg_pattern) & mask & ~bits); } -static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; unsigned fgp = fg_pattern; @@ -254,7 +261,7 @@ lcd_blockfunc_type* const lcd_blockfuncs[8] = { flipinvblock, bginvblock, fginvblock, solidinvblock }; -static inline void setblock(unsigned char *address, unsigned mask, unsigned bits) +static inline void setblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; @@ -510,11 +517,11 @@ void lcd_fillrect(int x, int y, int width, int height) /* About Rockbox' internal monochrome bitmap format: * * A bitmap contains one bit for every pixel that defines if that pixel is - * black (1) or white (0). Bits within a byte are arranged horizontally, LSB + * black (1) or white (0). Bits within a byte are arranged vertically, LSB * at top. * The bytes are stored in row-major order, with byte 0 being top left, - * byte 1 2nd from left etc. The first row of bytes defines pixel row - * 0, the second row defines pixel row 1 etc. */ + * byte 1 2nd from left etc. The first row of bytes defines pixel rows + * 0..7, the second row defines pixel row 8..15 etc. */ /* Draw a partial monochrome bitmap */ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, @@ -937,15 +944,9 @@ static void scroll_thread(void) } lastmode = drawmode; - drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); - lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); - drawmode = DRMODE_SOLID; - lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line); - if (s->invert) - { - drawmode = DRMODE_COMPLEMENT; - lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); - } + drawmode = s->invert ? + (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + lcd_putsxyofs(xpos, ypos, s->offset, s->line); drawmode = lastmode; lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); } diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index f7b3c21f48..0c71f0b168 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c @@ -65,8 +65,8 @@ /*** globals ***/ -unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH] - IBSS_ATTR; +fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH] + IBSS_ATTR; static int drawmode = DRMODE_SOLID; static int xmargin = 0; @@ -686,35 +686,35 @@ static void nopixel(int x, int y) (void)y; } -lcd_pixelfunc_type* const lcd_remote_pixelfuncs[8] = { +lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8] = { flippixel, nopixel, setpixel, setpixel, nopixel, clearpixel, nopixel, clearpixel }; -static void flipblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits) { *address ^= bits & mask; } -static void bgblock(unsigned char *address, unsigned mask, unsigned bits) +static void bgblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bgblock(unsigned char *address, unsigned mask, unsigned bits) +static void bgblock(fb_remote_data *address, unsigned mask, unsigned bits) { *address &= bits | ~mask; } -static void fgblock(unsigned char *address, unsigned mask, unsigned bits) +static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fgblock(unsigned char *address, unsigned mask, unsigned bits) +static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits) { *address |= bits & mask; } -static void solidblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits) { unsigned data = *address; @@ -722,30 +722,30 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits) *address = data ^ (bits & mask); } -static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits) { *address ^= ~bits & mask; } -static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void bginvblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void bginvblock(fb_remote_data *address, unsigned mask, unsigned bits) { *address &= ~(bits & mask); } -static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits) { *address |= ~bits & mask; } -static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits) { unsigned data = *address; @@ -753,7 +753,7 @@ static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) *address = data ^ (bits & mask); } -lcd_blockfunc_type* const lcd_remote_blockfuncs[8] = { +lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8] = { flipblock, bgblock, fgblock, solidblock, flipinvblock, bginvblock, fginvblock, solidinvblock }; @@ -785,7 +785,7 @@ void lcd_remote_drawline(int x1, int y1, int x2, int y2) int d, dinc1, dinc2; int x, xinc1, xinc2; int y, yinc1, yinc2; - lcd_pixelfunc_type *pfunc = lcd_remote_pixelfuncs[drawmode]; + lcd_remote_pixelfunc_type *pfunc = lcd_remote_pixelfuncs[drawmode]; deltax = abs(x2 - x1); deltay = abs(y2 - y1); @@ -851,9 +851,9 @@ void lcd_remote_drawline(int x1, int y1, int x2, int y2) void lcd_remote_hline(int x1, int x2, int y) { int x; - unsigned char *dst, *dst_end; + fb_remote_data *dst, *dst_end; unsigned mask; - lcd_blockfunc_type *bfunc; + lcd_remote_blockfunc_type *bfunc; /* direction flip */ if (x2 < x1) @@ -888,9 +888,9 @@ void lcd_remote_hline(int x1, int x2, int y) void lcd_remote_vline(int x, int y1, int y2) { int ny; - unsigned char *dst; + fb_remote_data *dst; unsigned mask, mask_bottom; - lcd_blockfunc_type *bfunc; + lcd_remote_blockfunc_type *bfunc; /* direction flip */ if (y2 < y1) @@ -946,10 +946,10 @@ void lcd_remote_drawrect(int x, int y, int width, int height) void lcd_remote_fillrect(int x, int y, int width, int height) { int ny; - unsigned char *dst, *dst_end; + fb_remote_data *dst, *dst_end; unsigned mask, mask_bottom; unsigned bits = 0; - lcd_blockfunc_type *bfunc; + lcd_remote_blockfunc_type *bfunc; bool fillopt = false; /* nothing to draw? */ @@ -1000,7 +1000,7 @@ void lcd_remote_fillrect(int x, int y, int width, int height) memset(dst, bits, width); else { - unsigned char *dst_row = dst; + fb_remote_data *dst_row = dst; dst_end = dst_row + width; do @@ -1043,9 +1043,9 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, int stride, int x, int y, int width, int height) { int shift, ny; - unsigned char *dst, *dst_end; + fb_remote_data *dst, *dst_end; unsigned mask, mask_bottom; - lcd_blockfunc_type *bfunc; + lcd_remote_blockfunc_type *bfunc; /* nothing to draw? */ if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH) @@ -1070,9 +1070,9 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, if (y + height > LCD_REMOTE_HEIGHT) height = LCD_REMOTE_HEIGHT - y; - src += stride * (src_y >> 3) + src_x; /* move starting point */ - src_y &= 7; - y -= src_y; + src += stride * (src_y >> 3) + src_x; /* move starting point */ + src_y &= 7; + y -= src_y; dst = &lcd_remote_framebuffer[y>>3][x]; shift = y & 7; ny = height - 1 + shift + src_y; @@ -1092,7 +1092,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, else { const unsigned char *src_row = src; - unsigned char *dst_row = dst; + fb_remote_data *dst_row = dst; dst_end = dst_row + width; do @@ -1122,7 +1122,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, do { const unsigned char *src_col = src++; - unsigned char *dst_col = dst++; + fb_remote_data *dst_col = dst++; unsigned mask_col = mask; unsigned data = 0; diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c index 369833944f..39497cc2ec 100644 --- a/firmware/drivers/lcd-h100.c +++ b/firmware/drivers/lcd-h100.c @@ -63,7 +63,7 @@ /*** globals ***/ -unsigned char lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH] IBSS_ATTR; +fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH] IBSS_ATTR; static const unsigned char dibits[16] ICONST_ATTR = { 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F, @@ -357,21 +357,28 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h) static void setpixel(int x, int y) { - unsigned char *data = &lcd_framebuffer[y>>2][x]; unsigned mask = pixmask[y & 3]; - *data = (*data & ~mask) | (fg_pattern & mask); + fb_data *address = &lcd_framebuffer[y>>2][x]; + unsigned data = *address; + + *address = data ^ ((data ^ fg_pattern) & mask); } static void clearpixel(int x, int y) { - unsigned char *data = &lcd_framebuffer[y>>2][x]; unsigned mask = pixmask[y & 3]; - *data = (*data & ~mask) | (bg_pattern & mask); + fb_data *address = &lcd_framebuffer[y>>2][x]; + unsigned data = *address; + + *address = data ^ ((data ^ bg_pattern) & mask); } static void flippixel(int x, int y) { - lcd_framebuffer[y>>2][x] ^= pixmask[y & 3]; + unsigned mask = pixmask[y & 3]; + fb_data *address = &lcd_framebuffer[y>>2][x]; + + *address ^= mask; } static void nopixel(int x, int y) @@ -386,34 +393,34 @@ lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { }; /* 'mask' and 'bits' contain 2 bits per pixel */ -static void flipblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipblock(fb_data *address, unsigned mask, unsigned bits) { *address ^= bits & mask; } -static void bgblock(unsigned char *address, unsigned mask, unsigned bits) +static void bgblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bgblock(unsigned char *address, unsigned mask, unsigned bits) +static void bgblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ bg_pattern) & mask & ~bits); } -static void fgblock(unsigned char *address, unsigned mask, unsigned bits) +static void fgblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fgblock(unsigned char *address, unsigned mask, unsigned bits) +static void fgblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ fg_pattern) & mask & bits); } -static void solidblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; unsigned bgp = bg_pattern; @@ -422,34 +429,34 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits) *address = data ^ ((data ^ bits) & mask); } -static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) { *address ^= ~bits & mask; } -static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void bginvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void bginvblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ bg_pattern) & mask & bits); } -static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void fginvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) +static void fginvblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ fg_pattern) & mask & ~bits); } -static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) ICODE_ATTR; -static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) +static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; unsigned fgp = fg_pattern; @@ -463,7 +470,7 @@ lcd_blockfunc_type* const lcd_blockfuncs[8] = { flipinvblock, bginvblock, fginvblock, solidinvblock }; -static inline void setblock(unsigned char *address, unsigned mask, unsigned bits) +static inline void setblock(fb_data *address, unsigned mask, unsigned bits) { unsigned data = *address; @@ -564,7 +571,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2) void lcd_hline(int x1, int x2, int y) { int x; - unsigned char *dst, *dst_end; + fb_data *dst, *dst_end; unsigned mask; lcd_blockfunc_type *bfunc; @@ -600,7 +607,7 @@ void lcd_hline(int x1, int x2, int y) void lcd_vline(int x, int y1, int y2) { int ny; - unsigned char *dst; + fb_data *dst; unsigned mask, mask_bottom; lcd_blockfunc_type *bfunc; @@ -657,7 +664,7 @@ void lcd_drawrect(int x, int y, int width, int height) void lcd_fillrect(int x, int y, int width, int height) { int ny; - unsigned char *dst, *dst_end; + fb_data *dst, *dst_end; unsigned mask, mask_bottom; unsigned bits = 0; lcd_blockfunc_type *bfunc; @@ -712,7 +719,7 @@ void lcd_fillrect(int x, int y, int width, int height) memset(dst, bits, width); else { - unsigned char *dst_row = dst; + fb_data *dst_row = dst; dst_end = dst_row + width; do @@ -755,7 +762,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, int stride, int x, int y, int width, int height) { int shift, ny; - unsigned char *dst, *dst_end; + fb_data *dst, *dst_end; unsigned mask, mask_bottom; lcd_blockfunc_type *bfunc; @@ -800,7 +807,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, for (; ny >= 8; ny -= 8) { const unsigned char *src_row = src; - unsigned char *dst_row = dst + LCD_WIDTH; + fb_data *dst_row = dst + LCD_WIDTH; dmask1 = dibits[mask&0x0F]; dmask2 = dibits[(mask>>4)&0x0F]; @@ -863,7 +870,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, do { const unsigned char *src_col = src++; - unsigned char *dst_col = dst++; + fb_data *dst_col = dst++; unsigned mask_col = mask; unsigned data = 0; @@ -916,14 +923,14 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig * This is the same as the internal lcd hw format. */ /* Draw a partial native bitmap */ -void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, +void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, int stride, int x, int y, int width, int height) ICODE_ATTR; -void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, +void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, int stride, int x, int y, int width, int height) { int shift, ny; - unsigned char *dst, *dst_end; + fb_data *dst, *dst_end; unsigned mask, mask_bottom; /* nothing to draw? */ @@ -949,9 +956,9 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; - src += stride * (src_y >> 2) + src_x; /* move starting point */ - src_y &= 3; - y -= src_y; + src += stride * (src_y >> 2) + src_x; /* move starting point */ + src_y &= 3; + y -= src_y; dst = &lcd_framebuffer[y>>2][x]; shift = y & 3; ny = height - 1 + shift + src_y; @@ -967,15 +974,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, memcpy(dst, src, width); else { - const unsigned char *src_row = src; - unsigned char *dst_row = dst; + const fb_data *src_row = src; + fb_data *dst_row = dst; dst_end = dst_row + width; do setblock(dst_row++, mask, *src_row++); while (dst_row < dst_end); } - src += stride; dst += LCD_WIDTH; mask = 0xFFu; @@ -998,8 +1004,8 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, dst_end = dst + width; do { - const unsigned char *src_col = src++; - unsigned char *dst_col = dst++; + const fb_data *src_col = src++; + fb_data *dst_col = dst++; unsigned mask_col = mask; unsigned data = 0; @@ -1027,7 +1033,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, } /* Draw a full native bitmap */ -void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height) +void lcd_bitmap(const fb_data *src, int x, int y, int width, int height) { lcd_bitmap_part(src, 0, 0, width, x, y, width, height); } @@ -1290,4 +1296,3 @@ static void scroll_thread(void) sleep(scroll_ticks); } } - -- cgit v1.2.3