diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-07-02 07:21:21 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-07-02 07:21:21 +0000 |
commit | 3291ae6bfac7a0cd39dafe12b006f73cbcb874d1 (patch) | |
tree | 3ddbd67cc25fd390e62708bbdd00dd115fbdb9b6 /apps/plugins/lib/playergfx.c | |
parent | 876a044ae054fb85d3290b8e457faa2271f3d9f5 (diff) | |
download | rockbox-3291ae6bfac7a0cd39dafe12b006f73cbcb874d1.tar.gz rockbox-3291ae6bfac7a0cd39dafe12b006f73cbcb874d1.zip |
A couple of optimisations.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6981 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/playergfx.c')
-rw-r--r-- | apps/plugins/lib/playergfx.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c index 5b756a7727..87be782d4d 100644 --- a/apps/plugins/lib/playergfx.c +++ b/apps/plugins/lib/playergfx.c @@ -317,7 +317,7 @@ void pgfx_hline(int x1, int x2, int y) void pgfx_vline(int x, int y1, int y2) { int y; - unsigned char *dst; + unsigned char *dst, *dst_end; unsigned mask; lcd_blockfunc_type *bfunc; @@ -344,8 +344,10 @@ void pgfx_vline(int x, int y1, int y2) dst = &gfx_buffer[pixel_height * (x/5) + y1]; mask = 0x10 >> (x % 5); - for (y = y1; y <= y2; y++) + dst_end = dst + y2 - y1; + do bfunc(dst++, mask, 0x1F); + while (dst <= dst_end); } /* Draw a rectangular box */ @@ -366,8 +368,8 @@ void pgfx_drawrect(int x, int y, int width, int height) /* Fill a rectangular area */ void pgfx_fillrect(int x, int y, int width, int height) { - int nx, i; - unsigned char *dst; + int nx; + unsigned char *dst, *dst_end; unsigned mask, mask_right; lcd_blockfunc_type *bfunc; @@ -402,16 +404,20 @@ void pgfx_fillrect(int x, int y, int width, int height) { unsigned char *dst_col = dst; - for (i = height; i > 0; i--) + dst_end = dst_col + height; + do bfunc(dst_col++, mask, 0x1F); + while (dst_col < dst_end); dst += pixel_height; mask = 0x1F; } mask &= mask_right; - for (i = height; i > 0; i--) + dst_end = dst + height; + do bfunc(dst++, mask, 0x1F); + while (dst < dst_end); } /* About PlayerGFX internal bitmap format: @@ -429,7 +435,7 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, int stride, int x, int y, int width, int height) { int nx, shift; - unsigned char *dst; + unsigned char *dst, *dst_end; unsigned mask, mask_right; lcd_blockfunc_type *bfunc; @@ -465,10 +471,11 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, mask = 0x1F >> (x % 5); mask_right = 0x1F0 >> (nx % 5); - for (y = 0; y < height; y++) + dst_end = dst + height; + do { const unsigned char *src_row = src; - unsigned char *dst_row = dst; + unsigned char *dst_row = dst++; unsigned mask_row = mask; unsigned data = *src_row++; int extrabits = shift; @@ -493,8 +500,8 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, bfunc(dst_row, mask_row & mask_right, data >> extrabits); src += stride; - dst++; } + while (dst < dst_end); } /* Draw a full bitmap */ |