static inline u32 DecodePixel_RGB565(u16 val)
{
	int r,g,b,a;
	r=Convert5To8((val>>11) & 0x1f);
	g=Convert6To8((val>>5 ) & 0x3f);
	b=Convert5To8((val    ) & 0x1f);
	a=0xFF;
	return  r | (g<<8) | (b << 16) | (a << 24);
}
static inline u32 DecodePixel_RGB5A3(u16 val)
{
	int r,g,b,a;
	if ((val&0x8000))
	{
		r=Convert5To8((val>>10) & 0x1f);
		g=Convert5To8((val>>5 ) & 0x1f);
		b=Convert5To8((val    ) & 0x1f);
		a=0xFF;
	}
Beispiel #3
0
	void ConvertRGBA565_RGBA(u32 *dst, const s32 dstPitch, u16 *pIn, const s32 width, const s32 height, const s32 pitch)
	{
		u16 *currentsrc = pIn;
		u32 *currentdst = dst;
		for (s32 i = 0; i < height; i++)
		{
			for (s32 j = 0; j < width; j++)
			{
				u16 val = currentsrc[j];
				u32 output = Convert5To8((val >> 11) & 0x1f);//red
				output |= (Convert6To8((val >> 5) & 0x3f) << 8);//green
				output |= (Convert5To8((val)& 0x1f) << 16);//blue
				output |= (0xFF << 24);//alpha
				currentdst[j] = output;
			}
			currentdst += dstPitch;
			currentsrc += pitch;
		}
	}