summaryrefslogtreecommitdiff
path: root/firmware/drivers
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
parentfe2eadd79360faea97ab7dd9f3c0d3bd02dd20b8 (diff)
downloadrockbox-2705a894f0127167b1296f0a564e5db23087def9.tar.gz
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')
-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 @@
38 38
39/*** globals ***/ 39/*** globals ***/
40 40
41unsigned char lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH/4] IBSS_ATTR; 41#define FB_WIDTH ((LCD_WIDTH+3)/4)
42
43unsigned char lcd_framebuffer[LCD_HEIGHT][FB_WIDTH] IBSS_ATTR;
42 44
43static const unsigned char dibits[16] ICONST_ATTR = { 45static const unsigned char dibits[16] ICONST_ATTR = {
44 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F, 46 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F,
@@ -419,11 +421,11 @@ void lcd_vline(int x, int y1, int y2)
419 dst = &lcd_framebuffer[y1][x>>2]; 421 dst = &lcd_framebuffer[y1][x>>2];
420 mask = pixmask[x & 3]; 422 mask = pixmask[x & 3];
421 423
422 dst_end = dst + (y2 - y1) * (LCD_WIDTH/4); 424 dst_end = dst + (y2 - y1) * FB_WIDTH;
423 do 425 do
424 { 426 {
425 bfunc(dst, mask, 0xFFu); 427 bfunc(dst, mask, 0xFFu);
426 dst += (LCD_WIDTH/4); 428 dst += FB_WIDTH;
427 } 429 }
428 while (dst <= dst_end); 430 while (dst <= dst_end);
429} 431}
@@ -482,11 +484,11 @@ void lcd_fillrect(int x, int y, int width, int height)
482 { 484 {
483 unsigned char *dst_col = dst; 485 unsigned char *dst_col = dst;
484 486
485 dst_end = dst_col + height * (LCD_WIDTH/4); 487 dst_end = dst_col + height * FB_WIDTH;
486 do 488 do
487 { 489 {
488 bfunc(dst_col, mask, 0xFFu); 490 bfunc(dst_col, mask, 0xFFu);
489 dst_col += (LCD_WIDTH/4); 491 dst_col += FB_WIDTH;
490 } 492 }
491 while (dst_col < dst_end); 493 while (dst_col < dst_end);
492 494
@@ -495,11 +497,11 @@ void lcd_fillrect(int x, int y, int width, int height)
495 } 497 }
496 mask &= mask_right; 498 mask &= mask_right;
497 499
498 dst_end = dst + height * (LCD_WIDTH/4); 500 dst_end = dst + height * FB_WIDTH;
499 do 501 do
500 { 502 {
501 bfunc(dst, mask, 0xFFu); 503 bfunc(dst, mask, 0xFFu);
502 dst += (LCD_WIDTH/4); 504 dst += FB_WIDTH;
503 } 505 }
504 while (dst < dst_end); 506 while (dst < dst_end);
505} 507}
@@ -651,7 +653,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
651 mask_right = 0xFFu >> (2 * (~nx & 3)); 653 mask_right = 0xFFu >> (2 * (~nx & 3));
652 654
653 shift *= 2; 655 shift *= 2;
654 dst_end = dst + height * (LCD_WIDTH/4); 656 dst_end = dst + height * FB_WIDTH;
655 do 657 do
656 { 658 {
657 const unsigned char *src_row = src; 659 const unsigned char *src_row = src;
@@ -678,7 +680,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
678 setblock(dst_row, mask_row & mask_right, data); 680 setblock(dst_row, mask_row & mask_right, data);
679 681
680 src += stride; 682 src += stride;
681 dst += (LCD_WIDTH/4); 683 dst += FB_WIDTH;
682 } 684 }
683 while (dst < dst_end); 685 while (dst < dst_end);
684} 686}