static void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint32_t v)

{

    uint8_t r, g, b;



    r = ((v >> vs->server_red_shift) & vs->server_red_max) * (vs->client_red_max + 1) /

        (vs->server_red_max + 1);

    g = ((v >> vs->server_green_shift) & vs->server_green_max) * (vs->client_green_max + 1) /

        (vs->server_green_max + 1);

    b = ((v >> vs->server_blue_shift) & vs->server_blue_max) * (vs->client_blue_max + 1) /

        (vs->server_blue_max + 1);

    v = (r << vs->client_red_shift) |

        (g << vs->client_green_shift) |

        (b << vs->client_blue_shift);

    switch(vs->pix_bpp) {

    case 1:

        buf[0] = v;

        break;

    case 2:

        if (vs->pix_big_endian) {

            buf[0] = v >> 8;

            buf[1] = v;

        } else {

            buf[1] = v >> 8;

            buf[0] = v;

        }

        break;

    default:

    case 4:

        if (vs->pix_big_endian) {

            buf[0] = v >> 24;

            buf[1] = v >> 16;

            buf[2] = v >> 8;

            buf[3] = v;

        } else {

            buf[3] = v >> 24;

            buf[2] = v >> 16;

            buf[1] = v >> 8;

            buf[0] = v;

        }

        break;

    }

}

static void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint32_t v)

{

    uint8_t r, g, b;



    r = ((v >> vs->server_red_shift) & vs->server_red_max) * (vs->client_red_max + 1) /

        (vs->server_red_max + 1);

    g = ((v >> vs->server_green_shift) & vs->server_green_max) * (vs->client_green_max + 1) /

        (vs->server_green_max + 1);

    b = ((v >> vs->server_blue_shift) & vs->server_blue_max) * (vs->client_blue_max + 1) /

        (vs->server_blue_max + 1);

    v = (r << vs->client_red_shift) |

        (g << vs->client_green_shift) |

        (b << vs->client_blue_shift);

    switch(vs->pix_bpp) {

    case 1:

        buf[0] = v;

        break;

    case 2:

        if (vs->pix_big_endian) {

            buf[0] = v >> 8;

            buf[1] = v;

        } else {

            buf[1] = v >> 8;

            buf[0] = v;

        }

        break;

    default:

    case 4:

        if (vs->pix_big_endian) {

            buf[0] = v >> 24;

            buf[1] = v >> 16;

            buf[2] = v >> 8;

            buf[3] = v;

        } else {

            buf[3] = v >> 24;

            buf[2] = v >> 16;

            buf[1] = v >> 8;

            buf[0] = v;

        }

        break;

    }

}

    r = ((v >> vs->server_red_shift) & vs->server_red_max) * (vs->client_red_max + 1) /         (vs->server_red_max + 1);     g = ((v >> vs->server_green_shift) & vs->server_green_max) * (vs->client_green_max + 1) /         (vs->server_green_max + 1);     b = ((v >> vs->server_blue_shift) & vs->server_blue_max) * (vs->client_blue_max + 1) /         (vs->server_blue_max + 1);     v = (r << vs->client_red_shift) |         (g << vs->client_green_shift) |         (b << vs->client_blue_shift);     switch(vs->pix_bpp) {         if (vs->pix_big_endian) {         if (vs->pix_big_endian) {         } else {         } else {
static void FUNC_0(VncState *VAR_0, uint8_t *VAR_1, uint32_t VAR_2)

{

    uint8_t r, g, b;



    r = ((VAR_2 >> VAR_0->server_red_shift) & VAR_0->server_red_max) * (VAR_0->client_red_max + 1) /

        (VAR_0->server_red_max + 1);

    g = ((VAR_2 >> VAR_0->server_green_shift) & VAR_0->server_green_max) * (VAR_0->client_green_max + 1) /

        (VAR_0->server_green_max + 1);

    b = ((VAR_2 >> VAR_0->server_blue_shift) & VAR_0->server_blue_max) * (VAR_0->client_blue_max + 1) /

        (VAR_0->server_blue_max + 1);

    VAR_2 = (r << VAR_0->client_red_shift) |

        (g << VAR_0->client_green_shift) |

        (b << VAR_0->client_blue_shift);

    switch(VAR_0->pix_bpp) {

    case 1:

        VAR_1[0] = VAR_2;

        break;

    case 2:

        if (VAR_0->pix_big_endian) {

            VAR_1[0] = VAR_2 >> 8;

            VAR_1[1] = VAR_2;

        } else {

            VAR_1[1] = VAR_2 >> 8;

            VAR_1[0] = VAR_2;

        }

        break;

    default:

    case 4:

        if (VAR_0->pix_big_endian) {

            VAR_1[0] = VAR_2 >> 24;

            VAR_1[1] = VAR_2 >> 16;

            VAR_1[2] = VAR_2 >> 8;

            VAR_1[3] = VAR_2;

        } else {

            VAR_1[3] = VAR_2 >> 24;

            VAR_1[2] = VAR_2 >> 16;

            VAR_1[1] = VAR_2 >> 8;

            VAR_1[0] = VAR_2;

        }

        break;

    }

}

static void FUNC_0(VncState *VAR_0, uint8_t *VAR_1, uint32_t VAR_2)
{ uint8_t r, g, b; r = ((VAR_2 >> VAR_0->server_red_shift) & VAR_0->server_red_max) * (VAR_0->client_red_max + 1) /
(VAR_0->server_red_max + 1); g = ((VAR_2 >> VAR_0->server_green_shift) & VAR_0->server_green_max) * (VAR_0->client_green_max + 1) /
(VAR_0->server_green_max + 1); b = ((VAR_2 >> VAR_0->server_blue_shift) & VAR_0->server_blue_max) * (VAR_0->client_blue_max + 1) /
(VAR_0->server_blue_max + 1); VAR_2 = (r << VAR_0->client_red_shift) |
(g << VAR_0->client_green_shift) |
(b << VAR_0->client_blue_shift); switch(VAR_0->pix_bpp) { case 1:
VAR_1[0] = VAR_2; break; case 2:
if (VAR_0->pix_big_endian) { VAR_1[0] = VAR_2 >> 8; VAR_1[1] = VAR_2; } else { VAR_1[1] = VAR_2 >> 8; VAR_1[0] = VAR_2; } break; default:
case 4:
if (VAR_0->pix_big_endian) { VAR_1[0] = VAR_2 >> 24; VAR_1[1] = VAR_2 >> 16; VAR_1[2] = VAR_2 >> 8; VAR_1[3] = VAR_2; } else { VAR_1[3] = VAR_2 >> 24; VAR_1[2] = VAR_2 >> 16; VAR_1[1] = VAR_2 >> 8; VAR_1[0] = VAR_2; } break; } }