00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "mmsgui/fb/mmsfbconv.h"
00034
00035 #ifdef __HAVE_PF_AYUV__
00036
00037 #include "mmstools/mmstools.h"
00038
00039 void mmsfb_fillrectangle_ayuv(MMSFBSurfacePlanes *dst_planes, int dst_height,
00040 int dx, int dy, int dw, int dh, MMSFBColor color) {
00041
00042 static bool firsttime = true;
00043 if (firsttime) {
00044 printf("DISKO: Using accelerated fill rectangle to AYUV.\n");
00045 firsttime = false;
00046 }
00047
00048
00049 unsigned int *dst = (unsigned int *)dst_planes->ptr;
00050 int dst_pitch = dst_planes->pitch;
00051
00052
00053 int dst_pitch_pix = dst_pitch >> 2;
00054 dst+= dx + dy * dst_pitch_pix;
00055
00056 unsigned int *dst_end = dst + dst_pitch_pix * dh;
00057 #ifndef __HAVE_SSE__
00058 int dst_pitch_diff = dst_pitch_pix - dw;
00059 #endif
00060
00061
00062 register unsigned int A = color.a;
00063 register unsigned int SRC;
00064 SRC = (A << 24)
00065 | ((MMSFB_CONV_RGB2Y(color.r, color.g, color.b)) << 16)
00066 | ((MMSFB_CONV_RGB2U(color.r, color.g, color.b)) << 8)
00067 | MMSFB_CONV_RGB2V(color.r, color.g, color.b);
00068
00069
00070
00071 while (dst < dst_end) {
00072
00073 #ifdef __HAVE_SSE__
00074
00075
00076 short d0, d1, d2;
00077 __asm__ __volatile__ ( "\tcld\n\trep stosl" \
00078 : "=&D" (d0), "=&a" (d1), "=&c" (d2) \
00079 : "0" (dst), "1" (SRC), "2" (dw) \
00080 : "memory", "cc");
00081
00082
00083 dst+= dst_pitch_pix;
00084 #else
00085 unsigned int *line_end = dst + dw;
00086 while (dst < line_end) {
00087 *dst = SRC;
00088 dst++;
00089 }
00090
00091
00092 dst+= dst_pitch_diff;
00093 #endif
00094 }
00095 }
00096
00097 #endif