Quoting Sven Neumann ([EMAIL PROTECTED]):
> Hi,
> 
> Felix recently suggested a change to SET_ALPHA_PIXEL_RGB32 in 
> DirectFB/src/gfx/generic/generic.h) that resulted in a  nice 
> performance improvement and that we are now using. I tried to 
> do the same optimization to SET_ALPHA_PIXEL_RGB16 today and
> here's what I have come up with:
> 
> #define SET_ALPHA_PIXEL_RGB16(d,r,g,b,a) \
>      if (a) {\
>           if (a == 0xFF) {\
>                *(d) = (((r)&0xf8) << 8) | (((g)&0xfc) << 3) | (((b)&0xf8) >> 3);\
>           }\
>           else {\
>                __u32 pixel;\
>                __u8  s=((a)>>2)+1;\
>              __u8 s1=(64-s);\
>                \
>                pixel = *(d);\
>              pixel = (((((pixel & 0x0000f81f) * s1) + ((((r)<<8) | ((b)>>3)) * s)) & 
>0x003e07c0) + \
>                       ((((pixel & 0x000007e0) * s1) +  (((g)<<3)             * s)) & 
>0x0001f800)) >> 6; \
>                *(d) = pixel;\
>           }\
>      }

Just saw another thing:
You have to AND "r" and "g" before shifting them to the left.
Mask r with 0xF8 and g with 0xFC in the complex double line[tm].

-- 
Denis Oliver Kropp
( convergence           )
( integrated media gmbh )


-- 
Info:  To unsubscribe send a mail to [EMAIL PROTECTED] with 
"unsubscribe directfb-dev" as subject.

Reply via email to