diff options
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c index d8ad5a8df3..224ff3d0fc 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | |||
@@ -566,11 +566,26 @@ void lcd_update_rect(int x, int y, int w, int h) | |||
566 | if(!lcd_on) | 566 | if(!lcd_on) |
567 | return; | 567 | return; |
568 | #endif | 568 | #endif |
569 | /* make sure the rectangle is included in the screen */ | 569 | /* make sure the rectangle is bounded in the screen */ |
570 | x = MIN(x, LCD_WIDTH); | 570 | if (w > LCD_WIDTH - x)/* Clip right */ |
571 | y = MIN(y, LCD_HEIGHT); | 571 | w = LCD_WIDTH - x; |
572 | w = MIN(w, LCD_WIDTH - x); | 572 | if (x < 0)/* Clip left */ |
573 | h = MIN(h, LCD_HEIGHT - y); | 573 | { |
574 | w += x; | ||
575 | x = 0; | ||
576 | } | ||
577 | if (w <= 0) | ||
578 | return; /* nothing left to do */ | ||
579 | |||
580 | if (h > LCD_HEIGHT - y) /* Clip bottom */ | ||
581 | h = LCD_HEIGHT - y; | ||
582 | if (y < 0) /* Clip top */ | ||
583 | { | ||
584 | h += y; | ||
585 | y = 0; | ||
586 | } | ||
587 | if (h <= 0) | ||
588 | return; /* nothing left to do */ | ||
574 | 589 | ||
575 | imx233_lcdif_wait_ready(); | 590 | imx233_lcdif_wait_ready(); |
576 | lcd_write_reg(0x50, x); | 591 | lcd_write_reg(0x50, x); |
@@ -612,7 +627,7 @@ void lcd_update_rect(int x, int y, int w, int h) | |||
612 | * of w or h is odd, we will send a copy of the first pixels as dummy writes. We will | 627 | * of w or h is odd, we will send a copy of the first pixels as dummy writes. We will |
613 | * send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes. | 628 | * send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes. |
614 | */ | 629 | */ |
615 | if(w % 2 == 1 || h % 2 == 1) | 630 | if(w % 4 || (h & 1) == 1) |
616 | { | 631 | { |
617 | /* copy three pixel after the last one */ | 632 | /* copy three pixel after the last one */ |
618 | for(int i = 0; i < 3; i++) | 633 | for(int i = 0; i < 3; i++) |