diff options
Diffstat (limited to 'firmware/drivers/lcd-16bit-common.c')
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index 39edda5939..7f6a51790d 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c | |||
@@ -853,12 +853,6 @@ static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a) | |||
853 | #endif | 853 | #endif |
854 | } | 854 | } |
855 | 855 | ||
856 | /* Blend the given color with the value from the alpha_color_lookup table */ | ||
857 | static inline unsigned blend_color(unsigned c, unsigned a) | ||
858 | { | ||
859 | return blend_two_colors(c, current_vp->fg_pattern, a); | ||
860 | } | ||
861 | |||
862 | /* Blend an image with an alpha channel | 856 | /* Blend an image with an alpha channel |
863 | * if image is NULL, drawing will happen according to the drawmode | 857 | * if image is NULL, drawing will happen according to the drawmode |
864 | * src is the alpha channel (4bit per pixel) */ | 858 | * src is the alpha channel (4bit per pixel) */ |
@@ -979,7 +973,10 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
979 | /* go through the rows and update each pixel */ | 973 | /* go through the rows and update each pixel */ |
980 | do | 974 | do |
981 | { | 975 | { |
982 | unsigned bg; | 976 | /* saving current_vp->fg/bg_pattern and lcd_backdrop_offset into these |
977 | * temp vars just before the loop helps gcc to opimize the loop better | ||
978 | * (testing showed ~15% speedup) */ | ||
979 | unsigned fg, bg; | ||
983 | uintptr_t bo; | 980 | uintptr_t bo; |
984 | col = width; | 981 | col = width; |
985 | dst = dst_row; | 982 | dst = dst_row; |
@@ -1053,9 +1050,10 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
1053 | while (--col); | 1050 | while (--col); |
1054 | break; | 1051 | break; |
1055 | case DRMODE_FG: | 1052 | case DRMODE_FG: |
1053 | fg = current_vp->fg_pattern; | ||
1056 | do | 1054 | do |
1057 | { | 1055 | { |
1058 | *dst = blend_color(*dst, data & ALPHA_COLOR_LOOKUP_SIZE ); | 1056 | *dst = blend_two_colors(*dst, fg, data & ALPHA_COLOR_LOOKUP_SIZE ); |
1059 | dst += COL_INC; | 1057 | dst += COL_INC; |
1060 | UPDATE_SRC_ALPHA; | 1058 | UPDATE_SRC_ALPHA; |
1061 | } | 1059 | } |
@@ -1063,10 +1061,11 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
1063 | break; | 1061 | break; |
1064 | case DRMODE_SOLID|DRMODE_INT_MOD: | 1062 | case DRMODE_SOLID|DRMODE_INT_MOD: |
1065 | bo = lcd_backdrop_offset; | 1063 | bo = lcd_backdrop_offset; |
1064 | fg = current_vp->fg_pattern; | ||
1066 | do | 1065 | do |
1067 | { | 1066 | { |
1068 | fb_data *c = (fb_data *)((uintptr_t)dst + bo); | 1067 | fb_data *c = (fb_data *)((uintptr_t)dst + bo); |
1069 | *dst = blend_color(*c, data & ALPHA_COLOR_LOOKUP_SIZE ); | 1068 | *dst = blend_two_colors(*c, fg, data & ALPHA_COLOR_LOOKUP_SIZE ); |
1070 | dst += COL_INC; | 1069 | dst += COL_INC; |
1071 | UPDATE_SRC_ALPHA; | 1070 | UPDATE_SRC_ALPHA; |
1072 | } | 1071 | } |
@@ -1074,9 +1073,10 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
1074 | break; | 1073 | break; |
1075 | case DRMODE_SOLID: | 1074 | case DRMODE_SOLID: |
1076 | bg = current_vp->bg_pattern; | 1075 | bg = current_vp->bg_pattern; |
1076 | fg = current_vp->fg_pattern; | ||
1077 | do | 1077 | do |
1078 | { | 1078 | { |
1079 | *dst = blend_color(bg, | 1079 | *dst = blend_two_colors(bg, fg, |
1080 | data & ALPHA_COLOR_LOOKUP_SIZE ); | 1080 | data & ALPHA_COLOR_LOOKUP_SIZE ); |
1081 | dst += COL_INC; | 1081 | dst += COL_INC; |
1082 | UPDATE_SRC_ALPHA; | 1082 | UPDATE_SRC_ALPHA; |