paint_mouse_pointer(XImage *image, struct x11_grab *s)

{

    int x_off = s->x_off;

    int y_off = s->y_off;

    int width = s->width;

    int height = s->height;

    Display *dpy = s->dpy;

    XFixesCursorImage *xcim;

    int x, y;

    int line, column;

    int to_line, to_column;

    int image_addr, xcim_addr;



    xcim = XFixesGetCursorImage(dpy);



    x = xcim->x - xcim->xhot;

    y = xcim->y - xcim->yhot;



    to_line = FFMIN((y + xcim->height), (height + y_off));

    to_column = FFMIN((x + xcim->width), (width + x_off));



    for (line = FFMAX(y, y_off); line < to_line; line++) {

        for (column = FFMAX(x, x_off); column < to_column; column++) {

            xcim_addr = (line - y) * xcim->width + column - x;



            if ((unsigned char)(xcim->pixels[xcim_addr] >> 24) != 0) { // skip fully transparent pixel

                image_addr = ((line - y_off) * width + column - x_off) * 4;



                image->data[image_addr] = (unsigned char)(xcim->pixels[xcim_addr] >> 0);

                image->data[image_addr+1] = (unsigned char)(xcim->pixels[xcim_addr] >> 8);

                image->data[image_addr+2] = (unsigned char)(xcim->pixels[xcim_addr] >> 16);

            }

        }

    }



    XFree(xcim);

    xcim = NULL;

}

paint_mouse_pointer(XImage *image, struct x11_grab *s)

{

    int x_off = s->x_off;

    int y_off = s->y_off;

    int width = s->width;

    int height = s->height;

    Display *dpy = s->dpy;

    XFixesCursorImage *xcim;

    int x, y;

    int line, column;

    int to_line, to_column;

    int image_addr, xcim_addr;



    xcim = XFixesGetCursorImage(dpy);



    x = xcim->x - xcim->xhot;

    y = xcim->y - xcim->yhot;



    to_line = FFMIN((y + xcim->height), (height + y_off));

    to_column = FFMIN((x + xcim->width), (width + x_off));



    for (line = FFMAX(y, y_off); line < to_line; line++) {

        for (column = FFMAX(x, x_off); column < to_column; column++) {

            xcim_addr = (line - y) * xcim->width + column - x;



            if ((unsigned char)(xcim->pixels[xcim_addr] >> 24) != 0) { 

                image_addr = ((line - y_off) * width + column - x_off) * 4;



                image->data[image_addr] = (unsigned char)(xcim->pixels[xcim_addr] >> 0);

                image->data[image_addr+1] = (unsigned char)(xcim->pixels[xcim_addr] >> 8);

                image->data[image_addr+2] = (unsigned char)(xcim->pixels[xcim_addr] >> 16);

            }

        }

    }



    XFree(xcim);

    xcim = NULL;

}

    int image_addr, xcim_addr;             xcim_addr = (line - y) * xcim->width + column - x;                 image_addr = ((line - y_off) * width + column - x_off) * 4;                 image->data[image_addr] = (unsigned char)(xcim->pixels[xcim_addr] >> 0);                 image->data[image_addr+1] = (unsigned char)(xcim->pixels[xcim_addr] >> 8);                 image->data[image_addr+2] = (unsigned char)(xcim->pixels[xcim_addr] >> 16);
FUNC_0(XImage *VAR_0, struct x11_grab *VAR_1)

{

    int VAR_2 = VAR_1->VAR_2;

    int VAR_3 = VAR_1->VAR_3;

    int VAR_4 = VAR_1->VAR_4;

    int VAR_5 = VAR_1->VAR_5;

    Display *dpy = VAR_1->dpy;

    XFixesCursorImage *xcim;

    int VAR_6, VAR_7;

    int VAR_8, VAR_9;

    int VAR_10, VAR_11;

    int VAR_12, VAR_13;



    xcim = XFixesGetCursorImage(dpy);



    VAR_6 = xcim->VAR_6 - xcim->xhot;

    VAR_7 = xcim->VAR_7 - xcim->yhot;



    VAR_10 = FFMIN((VAR_7 + xcim->VAR_5), (VAR_5 + VAR_3));

    VAR_11 = FFMIN((VAR_6 + xcim->VAR_4), (VAR_4 + VAR_2));



    for (VAR_8 = FFMAX(VAR_7, VAR_3); VAR_8 < VAR_10; VAR_8++) {

        for (VAR_9 = FFMAX(VAR_6, VAR_2); VAR_9 < VAR_11; VAR_9++) {

            VAR_13 = (VAR_8 - VAR_7) * xcim->VAR_4 + VAR_9 - VAR_6;



            if ((unsigned char)(xcim->pixels[VAR_13] >> 24) != 0) { 

                VAR_12 = ((VAR_8 - VAR_3) * VAR_4 + VAR_9 - VAR_2) * 4;



                VAR_0->data[VAR_12] = (unsigned char)(xcim->pixels[VAR_13] >> 0);

                VAR_0->data[VAR_12+1] = (unsigned char)(xcim->pixels[VAR_13] >> 8);

                VAR_0->data[VAR_12+2] = (unsigned char)(xcim->pixels[VAR_13] >> 16);

            }

        }

    }



    XFree(xcim);

    xcim = NULL;

}

FUNC_0(XImage *VAR_0, struct x11_grab *VAR_1)
{ int VAR_2 = VAR_1->VAR_2; int VAR_3 = VAR_1->VAR_3; int VAR_4 = VAR_1->VAR_4; int VAR_5 = VAR_1->VAR_5; Display *dpy = VAR_1->dpy; XFixesCursorImage *xcim; int VAR_6, VAR_7; int VAR_8, VAR_9; int VAR_10, VAR_11; int VAR_12, VAR_13; xcim = XFixesGetCursorImage(dpy); VAR_6 = xcim->VAR_6 - xcim->xhot; VAR_7 = xcim->VAR_7 - xcim->yhot; VAR_10 = FFMIN((VAR_7 + xcim->VAR_5), (VAR_5 + VAR_3)); VAR_11 = FFMIN((VAR_6 + xcim->VAR_4), (VAR_4 + VAR_2)); for (VAR_8 = FFMAX(VAR_7, VAR_3); VAR_8 < VAR_10; VAR_8++) { for (VAR_9 = FFMAX(VAR_6, VAR_2); VAR_9 < VAR_11; VAR_9++) { VAR_13 = (VAR_8 - VAR_7) * xcim->VAR_4 + VAR_9 - VAR_6; if ((unsigned char)(xcim->pixels[VAR_13] >> 24) != 0) { VAR_12 = ((VAR_8 - VAR_3) * VAR_4 + VAR_9 - VAR_2) * 4; VAR_0->data[VAR_12] = (unsigned char)(xcim->pixels[VAR_13] >> 0); VAR_0->data[VAR_12+1] = (unsigned char)(xcim->pixels[VAR_13] >> 8); VAR_0->data[VAR_12+2] = (unsigned char)(xcim->pixels[VAR_13] >> 16); } } } XFree(xcim); xcim = NULL; }