summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/mpegplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 2e84a870a9..97fe7d3f4c 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -702,7 +702,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
702 dst_col--; 702 dst_col--;
703 703
704 if (data & 1) 704 if (data & 1)
705 *dst_col = fg_pattern; 705 *dst_col = FB_SCALARPACK(fg_pattern);
706#if 0 706#if 0
707 else 707 else
708 *dst_col = bg_pattern; 708 *dst_col = bg_pattern;
@@ -719,7 +719,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
719 while (src < src_end); 719 while (src < src_end);
720} 720}
721 721
722/* draw alpha bitmap for anti-alias font */ 722
723#define ALPHA_COLOR_FONT_DEPTH 2 723#define ALPHA_COLOR_FONT_DEPTH 2
724#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH) 724#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH)
725#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1) 725#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1)
@@ -727,6 +727,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
727#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH) 727#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH)
728#ifdef CPU_ARM 728#ifdef CPU_ARM
729#define BLEND_INIT do {} while (0) 729#define BLEND_INIT do {} while (0)
730#define BLEND_FINISH do {} while(0)
730#define BLEND_START(acc, color, alpha) \ 731#define BLEND_START(acc, color, alpha) \
731 asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha)) 732 asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha))
732#define BLEND_CONT(acc, color, alpha) \ 733#define BLEND_CONT(acc, color, alpha) \
@@ -734,13 +735,18 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
734#define BLEND_OUT(acc) do {} while (0) 735#define BLEND_OUT(acc) do {} while (0)
735#elif defined(CPU_COLDFIRE) 736#elif defined(CPU_COLDFIRE)
736#define ALPHA_BITMAP_READ_WORDS 737#define ALPHA_BITMAP_READ_WORDS
737#define BLEND_INIT coldfire_set_macsr(EMAC_UNSIGNED) 738#define BLEND_INIT \
739 unsigned long _macsr = coldfire_get_macsr(); \
740 coldfire_set_macsr(EMAC_UNSIGNED)
741#define BLEND_FINISH \
742 coldfire_set_macsr(_macsr)
738#define BLEND_START(acc, color, alpha) \ 743#define BLEND_START(acc, color, alpha) \
739 asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha)) 744 asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha))
740#define BLEND_CONT BLEND_START 745#define BLEND_CONT BLEND_START
741#define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc)) 746#define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc))
742#else 747#else
743#define BLEND_INIT do {} while (0) 748#define BLEND_INIT do {} while (0)
749#define BLEND_FINISH do {} while(0)
744#define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha)) 750#define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha))
745#define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha)) 751#define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha))
746#define BLEND_OUT(acc) do {} while (0) 752#define BLEND_OUT(acc) do {} while (0)
@@ -749,6 +755,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
749/* Blend the given two colors */ 755/* Blend the given two colors */
750static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a) 756static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
751{ 757{
758#if LCD_DEPTH == 16
752 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1); 759 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
753#if (LCD_PIXELFORMAT == RGB565SWAPPED) 760#if (LCD_PIXELFORMAT == RGB565SWAPPED)
754 c1 = swap16(c1); 761 c1 = swap16(c1);
@@ -767,6 +774,20 @@ static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
767#else 774#else
768 return p; 775 return p;
769#endif 776#endif
777
778#else /* LCD_DEPTH == 24 */
779 unsigned s = c1;
780 unsigned d = c2;
781 unsigned s1 = s & 0xff00ff;
782 unsigned d1 = d & 0xff00ff;
783 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
784 d1 = (d1 + ((s1 - d1) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00ff;
785 s &= 0xff00;
786 d &= 0xff00;
787 d = (d + ((s - d) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00;
788
789 return d1 | d;
790#endif
770} 791}
771 792
772static void draw_oriented_alpha_bitmap_part(const unsigned char *src, 793static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
@@ -849,8 +870,9 @@ static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
849#endif 870#endif
850 do 871 do
851 { 872 {
852 *dst=blend_two_colors(*dst, fg_pattern, 873 unsigned color = blend_two_colors(FB_UNPACK_SCALAR_LCD(*dst), fg_pattern,
853 data & ALPHA_COLOR_LOOKUP_SIZE ); 874 data & ALPHA_COLOR_LOOKUP_SIZE );
875 *dst= FB_SCALARPACK(color);
854 dst += LCD_WIDTH; 876 dst += LCD_WIDTH;
855 UPDATE_SRC_ALPHA; 877 UPDATE_SRC_ALPHA;
856 } 878 }