static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)

{

    VncState *vs;

    int sty = y / VNC_STAT_RECT;

    int stx = x / VNC_STAT_RECT;

    int has_dirty = 0;



    y = y / VNC_STAT_RECT * VNC_STAT_RECT;

    x = x / VNC_STAT_RECT * VNC_STAT_RECT;



    QTAILQ_FOREACH(vs, &vd->clients, next) {

        int j;



        /* kernel send buffers are full -> refresh later */

        if (vs->output.offset) {

            continue;

        }



        if (!vs->lossy_rect[sty][stx]) {

            continue;

        }

        vs->lossy_rect[sty][stx] = 0;

        for (j = 0; j < VNC_STAT_RECT; ++j) {

            vnc_set_bits(vs->dirty[y + j], x / 16, VNC_STAT_RECT / 16);

        }

        has_dirty++;

    }

    return has_dirty;

}

static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)

{

    VncState *vs;

    int sty = y / VNC_STAT_RECT;

    int stx = x / VNC_STAT_RECT;

    int has_dirty = 0;



    y = y / VNC_STAT_RECT * VNC_STAT_RECT;

    x = x / VNC_STAT_RECT * VNC_STAT_RECT;



    QTAILQ_FOREACH(vs, &vd->clients, next) {

        int j;



        

        if (vs->output.offset) {

            continue;

        }



        if (!vs->lossy_rect[sty][stx]) {

            continue;

        }

        vs->lossy_rect[sty][stx] = 0;

        for (j = 0; j < VNC_STAT_RECT; ++j) {

            vnc_set_bits(vs->dirty[y + j], x / 16, VNC_STAT_RECT / 16);

        }

        has_dirty++;

    }

    return has_dirty;

}

static int FUNC_0(VncDisplay *VAR_0, int VAR_1, int VAR_2)

{

    VncState *vs;

    int VAR_3 = VAR_2 / VNC_STAT_RECT;

    int VAR_4 = VAR_1 / VNC_STAT_RECT;

    int VAR_5 = 0;



    VAR_2 = VAR_2 / VNC_STAT_RECT * VNC_STAT_RECT;

    VAR_1 = VAR_1 / VNC_STAT_RECT * VNC_STAT_RECT;



    QTAILQ_FOREACH(vs, &VAR_0->clients, next) {

        int j;



        

        if (vs->output.offset) {

            continue;

        }



        if (!vs->lossy_rect[VAR_3][VAR_4]) {

            continue;

        }

        vs->lossy_rect[VAR_3][VAR_4] = 0;

        for (j = 0; j < VNC_STAT_RECT; ++j) {

            vnc_set_bits(vs->dirty[VAR_2 + j], VAR_1 / 16, VNC_STAT_RECT / 16);

        }

        VAR_5++;

    }

    return VAR_5;

}

static int FUNC_0(VncDisplay *VAR_0, int VAR_1, int VAR_2)
{ VncState *vs; int VAR_3 = VAR_2 / VNC_STAT_RECT; int VAR_4 = VAR_1 / VNC_STAT_RECT; int VAR_5 = 0; VAR_2 = VAR_2 / VNC_STAT_RECT * VNC_STAT_RECT; VAR_1 = VAR_1 / VNC_STAT_RECT * VNC_STAT_RECT; QTAILQ_FOREACH(vs, &VAR_0->clients, next) { int j; if (vs->output.offset) { continue; } if (!vs->lossy_rect[VAR_3][VAR_4]) { continue; } vs->lossy_rect[VAR_3][VAR_4] = 0; for (j = 0; j < VNC_STAT_RECT; ++j) { vnc_set_bits(vs->dirty[VAR_2 + j], VAR_1 / 16, VNC_STAT_RECT / 16); } VAR_5++; } return VAR_5; }