From df5c3e15e8d04d519b7870fe809c15053783c14c Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Thu, 10 Jan 2008 22:51:33 +0000 Subject: Greyscale library: * Introduced some extra macros dealing with block size, allowing to write some parts with less #ifdefing. * Optimised grey_update_rect() for horizontally packed LCDs, and unbuffered scrolling. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16050 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lib/grey_draw.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'apps/plugins/lib/grey_draw.c') diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c index ccb8deae7b..683793129e 100644 --- a/apps/plugins/lib/grey_draw.c +++ b/apps/plugins/lib/grey_draw.c @@ -634,18 +634,15 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, if (y + height > _grey_info.height) height = _grey_info.height - y; - src += _GREY_MULUQ(stride, src_y) + src_x; /* move starting point */ - + src += _GREY_MULUQ(stride, src_y) + src_x; /* move starting point */ + do { #if LCD_PIXELFORMAT == HORIZONTAL_PACKING int idx = _GREY_MULUQ(_grey_info.width, y) + x; #else -#if LCD_DEPTH == 1 - int idx = _GREY_MULUQ(_grey_info.width, y & ~7) + (x << 3) + (~y & 7); -#elif LCD_DEPTH == 2 - int idx = _GREY_MULUQ(_grey_info.width, y & ~3) + (x << 2) + (~y & 3); -#endif + int idx = _GREY_MULUQ(_grey_info.width, y & ~_GREY_BMASK) + + (x << _GREY_BSHIFT) + (~y & _GREY_BMASK); #endif /* LCD_PIXELFORMAT */ unsigned char *dst_row = _grey_info.values + idx; const unsigned char *src_row = src; @@ -654,7 +651,7 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, do { *dst_row = _grey_info.gvalue[*src_row++]; - dst_row += _GREY_X_ADVANCE; + dst_row += _GREY_BSIZE; } while (src_row < src_end); -- cgit v1.2.3