diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-04-12 07:53:33 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-04-12 07:53:33 +0000 |
commit | 00ac809cc71e3747c81bf01be95d5cf21d93d9a0 (patch) | |
tree | 4d79755bdc07bdad65e9a524ac8fab572564494d /firmware/drivers/lcd-2bit-vert.c | |
parent | 02eb1d83a79c265b0273e18630553efcf8b9196c (diff) |
LCD drivers: * Automatically optimise horizontal and vertical lines drawn via _drawline(), with debug message to show possible optimisations in the caller. * Get rid of the extra ICODE function declarations by putting the attribute into the definition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17081 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd-2bit-vert.c')
-rw-r--r-- | firmware/drivers/lcd-2bit-vert.c | 88 |
1 files changed, 42 insertions, 46 deletions
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index 5373bb9f0a..d43bf6cc81 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c @@ -242,43 +242,38 @@ lcd_pixelfunc_type* const lcd_pixelfuncs_backdrop[8] = { lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; /* 'mask' and 'bits' contain 2 bits per pixel */ -static void flipblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void flipblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR flipblock(fb_data *address, unsigned mask, + unsigned bits) { *address ^= bits & mask; } -static void bgblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void bgblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR bgblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ bg_pattern) & mask & ~bits); } -static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); } -static void fgblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void fgblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR fgblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ fg_pattern) & mask & bits); } -static void solidblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void solidblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR solidblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; unsigned bgp = bg_pattern; @@ -287,9 +282,8 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits) *address = data ^ ((data ^ bits) & mask); } -static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; unsigned bgp = *(address + lcd_backdrop_offset); @@ -298,43 +292,38 @@ static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) *address = data ^ ((data ^ bits) & mask); } -static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR flipinvblock(fb_data *address, unsigned mask, + unsigned bits) { *address ^= ~bits & mask; } -static void bginvblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void bginvblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR bginvblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ bg_pattern) & mask & bits); } -static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); } -static void fginvblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void fginvblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; *address = data ^ ((data ^ fg_pattern) & mask & ~bits); } -static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; unsigned fgp = fg_pattern; @@ -343,9 +332,8 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) *address = data ^ ((data ^ bits) & mask); } -static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) - ICODE_ATTR; -static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) +static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask, + unsigned bits) { unsigned data = *address; unsigned fgp = fg_pattern; @@ -463,7 +451,19 @@ void lcd_drawline(int x1, int y1, int x2, int y2) lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; deltax = abs(x2 - x1); + if (deltax == 0) + { + DEBUGF("lcd_drawline() called for vertical line - optimisation.\n"); + lcd_vline(x1, y1, y2); + return; + } deltay = abs(y2 - y1); + if (deltay == 0) + { + DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n"); + lcd_hline(x1, x2, y1); + return; + } xinc2 = 1; yinc2 = 1; @@ -729,11 +729,9 @@ void lcd_fillrect(int x, int y, int width, int height) * This is similar to the internal lcd hw format. */ /* Draw a partial monochrome bitmap */ -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) - ICODE_ATTR; -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) +void ICODE_ATTR 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; fb_data *dst, *dst_end; @@ -901,11 +899,9 @@ 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 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 fb_data *src, int src_x, int src_y, - int stride, int x, int y, int width, int height) +void ICODE_ATTR 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; fb_data *dst, *dst_end; |