Make the driver work with LCD widths which aren't integer multiples of 4, i.e. the last byte of a row is only partially used (upcoming iPod mini build).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8748 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-02-20 18:15:49 +00:00
parent fe2eadd793
commit 2705a894f0

View file

@ -38,7 +38,9 @@
/*** globals ***/
unsigned char lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH/4] IBSS_ATTR;
#define FB_WIDTH ((LCD_WIDTH+3)/4)
unsigned char lcd_framebuffer[LCD_HEIGHT][FB_WIDTH] IBSS_ATTR;
static const unsigned char dibits[16] ICONST_ATTR = {
0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F,
@ -419,11 +421,11 @@ void lcd_vline(int x, int y1, int y2)
dst = &lcd_framebuffer[y1][x>>2];
mask = pixmask[x & 3];
dst_end = dst + (y2 - y1) * (LCD_WIDTH/4);
dst_end = dst + (y2 - y1) * FB_WIDTH;
do
{
bfunc(dst, mask, 0xFFu);
dst += (LCD_WIDTH/4);
dst += FB_WIDTH;
}
while (dst <= dst_end);
}
@ -482,11 +484,11 @@ void lcd_fillrect(int x, int y, int width, int height)
{
unsigned char *dst_col = dst;
dst_end = dst_col + height * (LCD_WIDTH/4);
dst_end = dst_col + height * FB_WIDTH;
do
{
bfunc(dst_col, mask, 0xFFu);
dst_col += (LCD_WIDTH/4);
dst_col += FB_WIDTH;
}
while (dst_col < dst_end);
@ -495,11 +497,11 @@ void lcd_fillrect(int x, int y, int width, int height)
}
mask &= mask_right;
dst_end = dst + height * (LCD_WIDTH/4);
dst_end = dst + height * FB_WIDTH;
do
{
bfunc(dst, mask, 0xFFu);
dst += (LCD_WIDTH/4);
dst += FB_WIDTH;
}
while (dst < dst_end);
}
@ -651,7 +653,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
mask_right = 0xFFu >> (2 * (~nx & 3));
shift *= 2;
dst_end = dst + height * (LCD_WIDTH/4);
dst_end = dst + height * FB_WIDTH;
do
{
const unsigned char *src_row = src;
@ -678,7 +680,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
setblock(dst_row, mask_row & mask_right, data);
src += stride;
dst += (LCD_WIDTH/4);
dst += FB_WIDTH;
}
while (dst < dst_end);
}