summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/lcd-2bit-horz.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-02-20 18:15:49 +0000
committerJens Arnold <amiconn@rockbox.org>2006-02-20 18:15:49 +0000
commit2705a894f0127167b1296f0a564e5db23087def9 (patch)
tree4269a332a66d00629325296243caf77906845e3b /firmware/drivers/lcd-2bit-horz.c
parentfe2eadd79360faea97ab7dd9f3c0d3bd02dd20b8 (diff)
downloadrockbox-2705a894f0127167b1296f0a564e5db23087def9.tar.gz
rockbox-2705a894f0127167b1296f0a564e5db23087def9.tar.bz2
rockbox-2705a894f0127167b1296f0a564e5db23087def9.zip
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
Diffstat (limited to 'firmware/drivers/lcd-2bit-horz.c')
-rw-r--r--firmware/drivers/lcd-2bit-horz.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index f9f5152faa..185affbcad 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -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);
}