LCD_DUAL_BUFFER optional (speed vs RAM)

This commit is contained in:
Damjan Adamic
2014-12-06 18:19:32 +01:00
parent e4de0da0bb
commit f2ed441916
6 changed files with 52 additions and 19 deletions
+8 -11
View File
@@ -64,8 +64,8 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
void lcd_plot(coord_t x, coord_t y, LcdFlags att)
{
if (x<0 || x>=LCD_W || y<0 || y>=LCD_H)
return;
if (x<0 || x>=LCD_W || y<0 || y>=LCD_H) return;
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ];
uint8_t mask = PIXEL_GREY_MASK(y, att);
if (p<DISPLAY_END) {
@@ -77,12 +77,11 @@ void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
{
if (y >= LCD_H) return;
if (x+w > LCD_W) {
if (x >= LCD_W ) {
return;
}
if (x >= LCD_W ) return;
w = LCD_W - x;
}
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ];
uint8_t mask = PIXEL_GREY_MASK(y, att);
while (w--) {
@@ -123,6 +122,7 @@ void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
void lcd_invert_line(int8_t line)
{
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[line * 4 * LCD_W];
for (coord_t x=0; x<LCD_W*4; x++) {
ASSERT_IN_DISPLAY(p);
@@ -159,20 +159,17 @@ void lcd_bmp(coord_t x, coord_t y, const uint8_t * img, coord_t offset, coord_t
width = w;
}
if (x+width > LCD_W) {
if (x >= LCD_W ) {
return;
}
if (x >= LCD_W ) return;
width = LCD_W-x;
}
uint8_t rows = (*q++ + 1) / 2;
lcdWaitDmaEnd();
for (uint8_t row=0; row<rows; row++) {
q = img + 2 + row*w + offset;
uint8_t *p = &displayBuf[(row + (y/2)) * LCD_W + x];
for (coord_t i=0; i<width; i++) {
if ((p) >= DISPLAY_END) {
return;
}
if ((p) >= DISPLAY_END) return;
uint8_t b = *q++;
if (y & 1) {
*p = (*p & 0x0f) + ((b & 0x0f) << 4);