Problem with PIXEL_FROM_RGBA on 16 bit screens and Big endian systems

Hi,

On Big endian systems CPU register hold the color bits as this.to convert
the data with that macro Gloss must set to 5.
But the produce C code does not rotate so the lower bits are truncate and
green color have only 8 steps then and sdl on 16 bit look so ugly then.

gggbbbbbrrrrrggg

#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \
{ \
Pixel = ((r>>fmt->Rloss)<Rshift)| \
((g>>fmt->Gloss)<Gshift)| \
((b>>fmt->Bloss)<Bshift)| \
((a>>fmt->Aloss)<Ashift); \
\
}

I see there is for little endian a table.when i set all mask bits to 0 (SDL
used the default then ), speed is higher.seem code dont use the
PIXEL_FROM_RGBA macro then

Maybe somebody know how this table can modify, so big endian systems work
faster ?.Is it ok, when the table is byteswap ?.

is in sdl_blit_n (1.2.13 i use)

  • Special optimized blit for RGB 5-6-5 --> ARGB 8-8-8-8 */
    static const Uint32 RGB565_ARGB8888_LUT[512] = {
    0x00000000, 0xff000000, 0x00000008, 0xff002000,
    0x00000010, 0xff004000, 0x00000018, 0xff006100,
    0x00000020, 0xff008100, 0x00000029, 0xff00a100,

I have done for test a faster macro for big endian, but it is still slower
tan little endian.the sdl_swap16 is only a asm instruction and the macro
is because of no alpha and 1 shift fewer faster execute and speedup big
endian a little and show full colors.

if (fmt->Gloss == 5)
{
Pixel = SDL_Swap16(((g>>2)<<5)|
((r>>3)<<11)|
(b>>3)); \
*((Uint16 *)(buf)) = Pixel;
}
else
PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a);
*((Uint16 *)(buf)) = (Pixel);
}

Bye