5 #include "evas_common_private.h"
6 #include "evas_xcb_image.h"
9 _evas_xcb_image_update(void *image, int x, int y, int w, int h)
11 RGBA_Image *im = image;
16 if (ecore_x_image_get(n->ns_data.x11.exim, n->ns_data.x11.pixmap, 0, 0, x, y, w, h))
21 pix = ecore_x_image_data_get(n->ns_data.x11.exim, &bpl, &rows, &bpp);
22 if (!ecore_x_image_is_argb32_get(n->ns_data.x11.exim))
24 Ecore_X_Colormap colormap;
27 im->image.data = (DATA32 *)malloc(im->cache_entry.w * im->cache_entry.h * sizeof(DATA32));
28 colormap = ecore_x_default_colormap_get(ecore_x_display_get(), ecore_x_default_screen_get());
29 ecore_x_image_to_argb_convert(pix, bpp, bpl, colormap, n->ns_data.x11.visual,
30 x, y, w, h, im->image.data,
31 (w * sizeof(int)), 0, 0);
34 im->image.data = (DATA32 *)pix;
39 _native_cb_bind(void *image, int x, int y, int w, int h)
41 RGBA_Image *im = image;
46 if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_X11))
47 _evas_xcb_image_update(image, x, y, w, h);
51 _native_cb_free(void *image)
59 if (n->ns_data.x11.exim)
61 ecore_x_image_free(n->ns_data.x11.exim);
62 n->ns_data.x11.exim = NULL;
64 n->ns_data.x11.visual = NULL;
66 im->native.data = NULL;
67 im->native.func.bind = NULL;
68 im->native.func.unbind = NULL;
69 im->native.func.free = NULL;
70 im->image.data = NULL;
76 evas_xcb_image_native_set(void *data EINA_UNUSED, void *image, void *native)
79 Evas_Native_Surface *ns;
83 if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_X11))
86 Ecore_X_Image *exim = NULL;
87 Ecore_X_Visual *vis = NULL;
88 Ecore_X_Pixmap pm = 0;
91 vis = ns->data.x11.visual;
92 pm = ns->data.x11.pixmap;
94 depth = ecore_x_drawable_depth_get(pm);
95 w = im->cache_entry.w;
96 h = im->cache_entry.h;
98 n = calloc(1, sizeof(Native));
101 exim = ecore_x_image_new(w, h, vis, depth);
104 ERR("Failed to create new Ecore_X_Image");
109 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
110 n->ns_data.x11.pixmap = pm;
111 n->ns_data.x11.visual = vis;
112 n->ns_data.x11.exim = exim;
115 im->native.func.bind = _native_cb_bind;
116 im->native.func.unbind = NULL;
117 im->native.func.free = _native_cb_free;
119 _evas_xcb_image_update(image, 0, 0, w, h);