static int tight_fill_palette(VncState *vs, int x, int y,

                              size_t count, uint32_t *bg, uint32_t *fg,

                              struct QDict **palette)

{

    int max;



    max = count / tight_conf[vs->tight_compression].idx_max_colors_divisor;

    if (max < 2 &&

        count >= tight_conf[vs->tight_compression].mono_min_rect_size) {

        max = 2;

    }

    if (max >= 256) {

        max = 256;

    }



    switch(vs->clientds.pf.bytes_per_pixel) {

    case 4:

        return tight_fill_palette32(vs, x, y, max, count, bg, fg, palette);

    case 2:

        return tight_fill_palette16(vs, x, y, max, count, bg, fg, palette);

    default:

        max = 2;

        return tight_fill_palette8(vs, x, y, max, count, bg, fg, palette);

    }

    return 0;

}

static int tight_fill_palette(VncState *vs, int x, int y,

                              size_t count, uint32_t *bg, uint32_t *fg,

                              struct QDict **palette)

{

    int max;



    max = count / tight_conf[vs->tight_compression].idx_max_colors_divisor;

    if (max < 2 &&

        count >= tight_conf[vs->tight_compression].mono_min_rect_size) {

        max = 2;

    }

    if (max >= 256) {

        max = 256;

    }



    switch(vs->clientds.pf.bytes_per_pixel) {

    case 4:

        return tight_fill_palette32(vs, x, y, max, count, bg, fg, palette);

    case 2:

        return tight_fill_palette16(vs, x, y, max, count, bg, fg, palette);

    default:

        max = 2;

        return tight_fill_palette8(vs, x, y, max, count, bg, fg, palette);

    }

    return 0;

}

static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2,

                              size_t VAR_3, uint32_t *VAR_4, uint32_t *VAR_5,

                              struct QDict **VAR_6)

{

    int VAR_7;



    VAR_7 = VAR_3 / tight_conf[VAR_0->tight_compression].idx_max_colors_divisor;

    if (VAR_7 < 2 &&

        VAR_3 >= tight_conf[VAR_0->tight_compression].mono_min_rect_size) {

        VAR_7 = 2;

    }

    if (VAR_7 >= 256) {

        VAR_7 = 256;

    }



    switch(VAR_0->clientds.pf.bytes_per_pixel) {

    case 4:

        return tight_fill_palette32(VAR_0, VAR_1, VAR_2, VAR_7, VAR_3, VAR_4, VAR_5, VAR_6);

    case 2:

        return tight_fill_palette16(VAR_0, VAR_1, VAR_2, VAR_7, VAR_3, VAR_4, VAR_5, VAR_6);

    default:

        VAR_7 = 2;

        return tight_fill_palette8(VAR_0, VAR_1, VAR_2, VAR_7, VAR_3, VAR_4, VAR_5, VAR_6);

    }

    return 0;

}

static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2,
size_t VAR_3, uint32_t *VAR_4, uint32_t *VAR_5,
struct QDict **VAR_6)
{ int VAR_7; VAR_7 = VAR_3 / tight_conf[VAR_0->tight_compression].idx_max_colors_divisor; if (VAR_7 < 2 &&
VAR_3 >= tight_conf[VAR_0->tight_compression].mono_min_rect_size) { VAR_7 = 2; } if (VAR_7 >= 256) { VAR_7 = 256; } switch(VAR_0->clientds.pf.bytes_per_pixel) { case 4:
return tight_fill_palette32(VAR_0, VAR_1, VAR_2, VAR_7, VAR_3, VAR_4, VAR_5, VAR_6); case 2:
return tight_fill_palette16(VAR_0, VAR_1, VAR_2, VAR_7, VAR_3, VAR_4, VAR_5, VAR_6); default:
VAR_7 = 2; return tight_fill_palette8(VAR_0, VAR_1, VAR_2, VAR_7, VAR_3, VAR_4, VAR_5, VAR_6); } return 0; }