diff options
author | Felix Arends <edx@rockbox.org> | 2002-05-01 17:05:55 +0000 |
---|---|---|
committer | Felix Arends <edx@rockbox.org> | 2002-05-01 17:05:55 +0000 |
commit | fea4cfa41adec3fd95de8bf4982de3d4395ffe6d (patch) | |
tree | 027784837f231d83adefeca678ad378dda6e80fa /firmware/drivers | |
parent | fa16227b254f9b7595825bf61d90abea13b1dcae (diff) |
fixed lcd_bitmap, again. Works for y%8 != 0 as well now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@374 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index 80e46adbdf..ba7b8dc63c 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c @@ -487,46 +487,41 @@ void lcd_puts(int x, int y, char *str, int font) void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, bool clear) { - unsigned char *dst; unsigned char *dst2; - unsigned int data, mask, mask2, mask3, mask4; + unsigned int mask1, mask2; int shift; int nny, _nnx = x, _nny = y; for (nny = ny; nny > 0; nny -= 8, _nny += 8) { - x = _nnx; y = _nny; ny = 8; + x = _nnx; y = _nny; ny = (nny >= 8)?8:nny; dst2 = &display[x][y/8]; shift = y & 7; + mask1 = 0xFF >> (8 - shift); + mask2 = ~mask1; + ny += shift; - /* Calculate bit masks */ - mask4 = ~(0xfe << ((ny-1) & 7)); + /* Loop for each column */ if (clear) { - mask = ~(0xff << shift); - mask2 = 0; - mask3 = ~mask4; - if (ny <= 8) - mask3 |= mask; + for (x = 0; x < nx; x++) + { + *dst2 = (*dst2 & mask1) | ((*(src)) << shift); + *(dst2 + 1) = (*(dst2+1) & mask2) | ((*(src++)) >> (8 - shift)); + dst2 += LCD_HEIGHT/8; + } } else - mask = mask2 = mask3 = 0xff; - - /* Loop for each column */ - for (x = 0; x < nx; x++) { - dst = dst2; - dst2 += LCD_HEIGHT/8; - data = 0; - y = 0; - - /* Last partial row */ - if (y + shift < ny) - data |= *src++ << shift; - *dst = (*dst & mask3) ^ (data & mask4); + for (x = 0; x < nx; x++) + { + *dst2 |= (*(src)) << shift; + *(dst2 + 1) |= (*(src++)) >> (8 - shift); + dst2 += LCD_HEIGHT/8; + } } } } |