diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index 2e5ce208b0..467d9f32a6 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c | |||
@@ -606,6 +606,7 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig | |||
606 | #define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH) | 606 | #define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH) |
607 | #ifdef CPU_ARM | 607 | #ifdef CPU_ARM |
608 | #define BLEND_INIT do {} while (0) | 608 | #define BLEND_INIT do {} while (0) |
609 | #define BLEND_FINISH do {} while(0) | ||
609 | #define BLEND_START(acc, color, alpha) \ | 610 | #define BLEND_START(acc, color, alpha) \ |
610 | asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha)) | 611 | asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha)) |
611 | #define BLEND_CONT(acc, color, alpha) \ | 612 | #define BLEND_CONT(acc, color, alpha) \ |
@@ -613,13 +614,18 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig | |||
613 | #define BLEND_OUT(acc) do {} while (0) | 614 | #define BLEND_OUT(acc) do {} while (0) |
614 | #elif defined(CPU_COLDFIRE) | 615 | #elif defined(CPU_COLDFIRE) |
615 | #define ALPHA_BITMAP_READ_WORDS | 616 | #define ALPHA_BITMAP_READ_WORDS |
616 | #define BLEND_INIT coldfire_set_macsr(EMAC_UNSIGNED) | 617 | #define BLEND_INIT \ |
618 | unsigned long _macsr = coldfire_get_macsr(); \ | ||
619 | coldfire_set_macsr(EMAC_UNSIGNED) | ||
620 | #define BLEND_FINISH \ | ||
621 | coldfire_set_macsr(_macsr) | ||
617 | #define BLEND_START(acc, color, alpha) \ | 622 | #define BLEND_START(acc, color, alpha) \ |
618 | asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha)) | 623 | asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha)) |
619 | #define BLEND_CONT BLEND_START | 624 | #define BLEND_CONT BLEND_START |
620 | #define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc)) | 625 | #define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc)) |
621 | #else | 626 | #else |
622 | #define BLEND_INIT do {} while (0) | 627 | #define BLEND_INIT do {} while (0) |
628 | #define BLEND_FINISH do {} while(0) | ||
623 | #define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha)) | 629 | #define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha)) |
624 | #define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha)) | 630 | #define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha)) |
625 | #define BLEND_OUT(acc) do {} while (0) | 631 | #define BLEND_OUT(acc) do {} while (0) |
@@ -701,7 +707,10 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
701 | /* nothing to draw? */ | 707 | /* nothing to draw? */ |
702 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 708 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
703 | || (x + width <= 0) || (y + height <= 0)) | 709 | || (x + width <= 0) || (y + height <= 0)) |
710 | { | ||
711 | BLEND_FINISH; | ||
704 | return; | 712 | return; |
713 | } | ||
705 | 714 | ||
706 | /* clip image in viewport in screen */ | 715 | /* clip image in viewport in screen */ |
707 | if (x < 0) | 716 | if (x < 0) |
@@ -908,6 +917,8 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
908 | } | 917 | } |
909 | #endif | 918 | #endif |
910 | } while (--row); | 919 | } while (--row); |
920 | |||
921 | BLEND_FINISH; | ||
911 | } | 922 | } |
912 | 923 | ||
913 | /* Draw a full native bitmap */ | 924 | /* Draw a full native bitmap */ |