static void pixel_format_message (VncState *vs) {

    char pad[3] = { 0, 0, 0 };



    vnc_write_u8(vs, vs->depth * 8); /* bits-per-pixel */

    if (vs->depth == 4) vnc_write_u8(vs, 24); /* depth */

    else vnc_write_u8(vs, vs->depth * 8); /* depth */



#ifdef WORDS_BIGENDIAN

    vnc_write_u8(vs, 1);             /* big-endian-flag */

#else

    vnc_write_u8(vs, 0);             /* big-endian-flag */

#endif

    vnc_write_u8(vs, 1);             /* true-color-flag */

    if (vs->depth == 4) {

        vnc_write_u16(vs, 0xFF);     /* red-max */

        vnc_write_u16(vs, 0xFF);     /* green-max */

        vnc_write_u16(vs, 0xFF);     /* blue-max */

        vnc_write_u8(vs, 16);        /* red-shift */

        vnc_write_u8(vs, 8);         /* green-shift */

        vnc_write_u8(vs, 0);         /* blue-shift */

        vs->send_hextile_tile = send_hextile_tile_32;

    } else if (vs->depth == 2) {

        vnc_write_u16(vs, 31);       /* red-max */

        vnc_write_u16(vs, 63);       /* green-max */

        vnc_write_u16(vs, 31);       /* blue-max */

        vnc_write_u8(vs, 11);        /* red-shift */

        vnc_write_u8(vs, 5);         /* green-shift */

        vnc_write_u8(vs, 0);         /* blue-shift */

        vs->send_hextile_tile = send_hextile_tile_16;

    } else if (vs->depth == 1) {

        /* XXX: change QEMU pixel 8 bit pixel format to match the VNC one ? */

        vnc_write_u16(vs, 7);        /* red-max */

        vnc_write_u16(vs, 7);        /* green-max */

        vnc_write_u16(vs, 3);        /* blue-max */

        vnc_write_u8(vs, 5);         /* red-shift */

        vnc_write_u8(vs, 2);         /* green-shift */

        vnc_write_u8(vs, 0);         /* blue-shift */

        vs->send_hextile_tile = send_hextile_tile_8;

    }

    vs->client_red_max = vs->server_red_max;

    vs->client_green_max = vs->server_green_max;

    vs->client_blue_max = vs->server_blue_max;

    vs->client_red_shift = vs->server_red_shift;

    vs->client_green_shift = vs->server_green_shift;

    vs->client_blue_shift = vs->server_blue_shift;

    vs->pix_bpp = vs->depth * 8;

    vs->write_pixels = vnc_write_pixels_copy;



    vnc_write(vs, pad, 3);           /* padding */

}

static void pixel_format_message (VncState *vs) {

    char pad[3] = { 0, 0, 0 };



    vnc_write_u8(vs, vs->depth * 8); 

    if (vs->depth == 4) vnc_write_u8(vs, 24); 

    else vnc_write_u8(vs, vs->depth * 8); 



#ifdef WORDS_BIGENDIAN

    vnc_write_u8(vs, 1);             

#else

    vnc_write_u8(vs, 0);             

#endif

    vnc_write_u8(vs, 1);             

    if (vs->depth == 4) {

        vnc_write_u16(vs, 0xFF);     

        vnc_write_u16(vs, 0xFF);     

        vnc_write_u16(vs, 0xFF);     

        vnc_write_u8(vs, 16);        

        vnc_write_u8(vs, 8);         

        vnc_write_u8(vs, 0);         

        vs->send_hextile_tile = send_hextile_tile_32;

    } else if (vs->depth == 2) {

        vnc_write_u16(vs, 31);       

        vnc_write_u16(vs, 63);       

        vnc_write_u16(vs, 31);       

        vnc_write_u8(vs, 11);        

        vnc_write_u8(vs, 5);         

        vnc_write_u8(vs, 0);         

        vs->send_hextile_tile = send_hextile_tile_16;

    } else if (vs->depth == 1) {

        

        vnc_write_u16(vs, 7);        

        vnc_write_u16(vs, 7);        

        vnc_write_u16(vs, 3);        

        vnc_write_u8(vs, 5);         

        vnc_write_u8(vs, 2);         

        vnc_write_u8(vs, 0);         

        vs->send_hextile_tile = send_hextile_tile_8;

    }

    vs->client_red_max = vs->server_red_max;

    vs->client_green_max = vs->server_green_max;

    vs->client_blue_max = vs->server_blue_max;

    vs->client_red_shift = vs->server_red_shift;

    vs->client_green_shift = vs->server_green_shift;

    vs->client_blue_shift = vs->server_blue_shift;

    vs->pix_bpp = vs->depth * 8;

    vs->write_pixels = vnc_write_pixels_copy;



    vnc_write(vs, pad, 3);           

}

    if (vs->depth == 4) {     } else if (vs->depth == 2) {     } else if (vs->depth == 1) { #ifdef WORDS_BIGENDIAN #else #endif         vs->send_hextile_tile = send_hextile_tile_32;         vs->send_hextile_tile = send_hextile_tile_16;         vs->send_hextile_tile = send_hextile_tile_8;     if (vs->depth == 4) {     } else if (vs->depth == 2) {     } else if (vs->depth == 1) {     vs->client_red_max = vs->server_red_max;     vs->client_green_max = vs->server_green_max;     vs->client_blue_max = vs->server_blue_max;     vs->client_red_shift = vs->server_red_shift;     vs->client_green_shift = vs->server_green_shift;     vs->client_blue_shift = vs->server_blue_shift;     vs->pix_bpp = vs->depth * 8; #ifdef WORDS_BIGENDIAN #else
static void FUNC_0 (VncState *VAR_0) {

    char VAR_1[3] = { 0, 0, 0 };



    vnc_write_u8(VAR_0, VAR_0->depth * 8); 

    if (VAR_0->depth == 4) vnc_write_u8(VAR_0, 24); 

    else vnc_write_u8(VAR_0, VAR_0->depth * 8); 



#ifdef WORDS_BIGENDIAN

    vnc_write_u8(VAR_0, 1);             

#else

    vnc_write_u8(VAR_0, 0);             

#endif

    vnc_write_u8(VAR_0, 1);             

    if (VAR_0->depth == 4) {

        vnc_write_u16(VAR_0, 0xFF);     

        vnc_write_u16(VAR_0, 0xFF);     

        vnc_write_u16(VAR_0, 0xFF);     

        vnc_write_u8(VAR_0, 16);        

        vnc_write_u8(VAR_0, 8);         

        vnc_write_u8(VAR_0, 0);         

        VAR_0->send_hextile_tile = send_hextile_tile_32;

    } else if (VAR_0->depth == 2) {

        vnc_write_u16(VAR_0, 31);       

        vnc_write_u16(VAR_0, 63);       

        vnc_write_u16(VAR_0, 31);       

        vnc_write_u8(VAR_0, 11);        

        vnc_write_u8(VAR_0, 5);         

        vnc_write_u8(VAR_0, 0);         

        VAR_0->send_hextile_tile = send_hextile_tile_16;

    } else if (VAR_0->depth == 1) {

        

        vnc_write_u16(VAR_0, 7);        

        vnc_write_u16(VAR_0, 7);        

        vnc_write_u16(VAR_0, 3);        

        vnc_write_u8(VAR_0, 5);         

        vnc_write_u8(VAR_0, 2);         

        vnc_write_u8(VAR_0, 0);         

        VAR_0->send_hextile_tile = send_hextile_tile_8;

    }

    VAR_0->client_red_max = VAR_0->server_red_max;

    VAR_0->client_green_max = VAR_0->server_green_max;

    VAR_0->client_blue_max = VAR_0->server_blue_max;

    VAR_0->client_red_shift = VAR_0->server_red_shift;

    VAR_0->client_green_shift = VAR_0->server_green_shift;

    VAR_0->client_blue_shift = VAR_0->server_blue_shift;

    VAR_0->pix_bpp = VAR_0->depth * 8;

    VAR_0->write_pixels = vnc_write_pixels_copy;



    vnc_write(VAR_0, VAR_1, 3);           

}

static void FUNC_0 (VncState *VAR_0) { char VAR_1[3] = { 0, 0, 0 }; vnc_write_u8(VAR_0, VAR_0->depth * 8); if (VAR_0->depth == 4) vnc_write_u8(VAR_0, 24); else vnc_write_u8(VAR_0, VAR_0->depth * 8); #ifdef WORDS_BIGENDIAN
vnc_write_u8(VAR_0, 1); #else
vnc_write_u8(VAR_0, 0); #endif
vnc_write_u8(VAR_0, 1); if (VAR_0->depth == 4) { vnc_write_u16(VAR_0, 0xFF); vnc_write_u16(VAR_0, 0xFF); vnc_write_u16(VAR_0, 0xFF); vnc_write_u8(VAR_0, 16); vnc_write_u8(VAR_0, 8); vnc_write_u8(VAR_0, 0); VAR_0->send_hextile_tile = send_hextile_tile_32; } else if (VAR_0->depth == 2) { vnc_write_u16(VAR_0, 31); vnc_write_u16(VAR_0, 63); vnc_write_u16(VAR_0, 31); vnc_write_u8(VAR_0, 11); vnc_write_u8(VAR_0, 5); vnc_write_u8(VAR_0, 0); VAR_0->send_hextile_tile = send_hextile_tile_16; } else if (VAR_0->depth == 1) { vnc_write_u16(VAR_0, 7); vnc_write_u16(VAR_0, 7); vnc_write_u16(VAR_0, 3); vnc_write_u8(VAR_0, 5); vnc_write_u8(VAR_0, 2); vnc_write_u8(VAR_0, 0); VAR_0->send_hextile_tile = send_hextile_tile_8; } VAR_0->client_red_max = VAR_0->server_red_max; VAR_0->client_green_max = VAR_0->server_green_max; VAR_0->client_blue_max = VAR_0->server_blue_max; VAR_0->client_red_shift = VAR_0->server_red_shift; VAR_0->client_green_shift = VAR_0->server_green_shift; VAR_0->client_blue_shift = VAR_0->server_blue_shift; VAR_0->pix_bpp = VAR_0->depth * 8; VAR_0->write_pixels = vnc_write_pixels_copy; vnc_write(VAR_0, VAR_1, 3); }