From 3d64123f2c719555d1fab83e17d604a65132bfc6 Mon Sep 17 00:00:00 2001 From: doursse Date: Sun, 15 May 2005 09:30:26 +0000 Subject: [PATCH] add the modifications of raster, fix some potential bug, clean up. It is still a bit slower than xlib SVN revision: 14787 --- .../lib/engines/software_xcb/evas_engine.c | 78 +- .../lib/engines/software_xcb/evas_engine.h | 268 +-- .../lib/engines/software_xcb/evas_outbuf.c | 1497 ++++++----------- .../engines/software_xcb/evas_xcb_buffer.c | 126 +- .../lib/engines/software_xcb/evas_xcb_color.c | 202 ++- .../lib/engines/software_xcb/evas_xcb_main.c | 2 +- 6 files changed, 914 insertions(+), 1259 deletions(-) diff --git a/legacy/evas/src/lib/engines/software_xcb/evas_engine.c b/legacy/evas/src/lib/engines/software_xcb/evas_engine.c index d58284c7d6..3e071ca2dd 100644 --- a/legacy/evas/src/lib/engines/software_xcb/evas_engine.c +++ b/legacy/evas/src/lib/engines/software_xcb/evas_engine.c @@ -243,9 +243,9 @@ evas_engine_software_xcb_setup(Evas *e, void *in) e->engine.func->context_new(e->engine.data.output); re = e->engine.data.output; - evas_software_x11_outbuf_software_xcb_drawable_set(re->ob, info->info.drawable); - evas_software_x11_outbuf_software_xcb_mask_set(re->ob, info->info.mask); - evas_software_x11_outbuf_software_xcb_rotation_set(re->ob, info->info.rotation); + evas_software_xcb_outbuf_drawable_set(re->ob, info->info.drawable); + evas_software_xcb_outbuf_mask_set(re->ob, info->info.mask); + evas_software_xcb_outbuf_rotation_set(re->ob, info->info.rotation); } static void * @@ -281,36 +281,35 @@ evas_engine_software_xcb_output_setup(int w, evas_common_font_init(); evas_common_draw_init(); evas_common_tilebuf_init(); - - evas_software_x11_x_software_xcb_init(); - x_software_xcb_color_init(); - evas_software_x11_outbuf_software_xcb_init(); + + evas_software_xcb_x_init(); + evas_software_xcb_x_color_init(); + evas_software_xcb_outbuf_init(); /* get any stored performance metrics from device (xserver) */ - perf = evas_software_x11_outbuf_software_xcb_perf_restore_x(conn, draw, vis, cmap, depth); - re->ob = evas_software_x11_outbuf_software_xcb_setup_x(w, h, rot, - OUTBUF_DEPTH_INHERIT, - conn, - draw, - vis, - cmap, - depth, - perf, - grayscale, - max_colors, - mask, shape_dither); + perf = evas_software_xcb_outbuf_perf_restore_x(conn, draw, vis, cmap, depth); + re->ob = evas_software_xcb_outbuf_setup_x(w, h, rot, + OUTBUF_DEPTH_INHERIT, + conn, + draw, + vis, + cmap, + depth, + perf, + grayscale, + max_colors, + mask, shape_dither); if (!re->ob) { - evas_software_x11_outbuf_software_xcb_perf_free(perf); + evas_software_xcb_outbuf_perf_free(perf); free(re); return NULL; } - evas_software_x11_outbuf_software_xcb_debug_set(re->ob, debug); - evas_software_x11_outbuf_software_xcb_set_have_backbuf(re->ob, 0); + evas_software_xcb_outbuf_debug_set(re->ob, debug); re->tb = evas_common_tilebuf_new(w, h); if (!re->tb) { - evas_software_x11_outbuf_software_xcb_free(re->ob); + evas_software_xcb_outbuf_free(re->ob); free(re); return NULL; } @@ -325,7 +324,7 @@ evas_engine_software_xcb_output_free(void *data) Render_Engine *re; re = (Render_Engine *)data; - evas_software_x11_outbuf_software_xcb_free(re->ob); + evas_software_xcb_outbuf_free(re->ob); evas_common_tilebuf_free(re->tb); if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); free(re); @@ -340,10 +339,9 @@ evas_engine_software_xcb_output_resize(void *data, int w, int h) Render_Engine *re; re = (Render_Engine *)data; - evas_software_x11_outbuf_software_xcb_reconfigure(re->ob, w, h, - evas_software_x11_outbuf_software_xcb_get_rot(re->ob), + evas_software_xcb_outbuf_reconfigure(re->ob, w, h, + evas_software_xcb_outbuf_get_rot(re->ob), OUTBUF_DEPTH_INHERIT); - evas_software_x11_outbuf_software_xcb_set_have_backbuf(re->ob, 0); evas_common_tilebuf_free(re->tb); re->tb = evas_common_tilebuf_new(w, h); if (re->tb) @@ -416,9 +414,9 @@ evas_engine_software_xcb_output_redraws_next_update_get(void *data, int *x, int re->end = 1; } - surface = evas_software_x11_outbuf_software_xcb_new_region_for_update(re->ob, - ux, uy, uw, uh, - cx, cy, cw, ch); + surface = evas_software_xcb_outbuf_new_region_for_update(re->ob, + ux, uy, uw, uh, + cx, cy, cw, ch); *x = ux; *y = uy; *w = uw; *h = uh; return surface; } @@ -429,8 +427,8 @@ evas_engine_software_xcb_output_redraws_next_update_push(void *data, void *surfa Render_Engine *re; re = (Render_Engine *)data; - evas_software_x11_outbuf_software_xcb_push_updated_region(re->ob, surface, x, y, w, h); - evas_software_x11_outbuf_software_xcb_free_region_for_update(re->ob, surface); + evas_software_xcb_outbuf_push_updated_region(re->ob, surface, x, y, w, h); + evas_software_xcb_outbuf_free_region_for_update(re->ob, surface); evas_common_cpu_end_opt(); } @@ -440,7 +438,7 @@ evas_engine_software_xcb_output_flush(void *data) Render_Engine *re; re = (Render_Engine *)data; - XCBSync(re->ob->priv.x.conn, 0); + evas_software_xcb_outbuf_flush(re->ob); } static void * @@ -1235,43 +1233,43 @@ evas_engine_software_xcb_best_depth_get(XCBConnection *conn, int screen) static Evas_Performance * evas_engine_software_xcb_output_perf_new(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth) { - return evas_software_x11_outbuf_software_xcb_perf_new_x(conn, draw, vis, cmap, depth); + return evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, depth); e = NULL; } static Evas_Performance * evas_engine_software_xcb_output_perf_test(Evas *e, XCBConnection *conn, XCBVISUALTYPE *vis, XCBCOLORMAP cmap, XCBDRAWABLE draw, int depth) { - return evas_software_x11_outbuf_software_xcb_perf_x(conn, draw, vis, cmap, depth); + return evas_software_xcb_outbuf_perf_x(conn, draw, vis, cmap, depth); e = NULL; } static char * evas_engine_software_xcb_output_perf_data(Evas_Performance *perf) { - return evas_software_x11_outbuf_software_xcb_perf_serialize_x(perf); + return evas_software_xcb_outbuf_perf_serialize_x(perf); } static char * evas_engine_software_xcb_output_perf_key(Evas_Performance *perf) { - return evas_software_x11_outbuf_software_xcb_perf_serialize_info_x(perf); + return evas_software_xcb_outbuf_perf_serialize_info_x(perf); } static void evas_engine_software_xcb_output_perf_free(Evas_Performance *perf) { - evas_software_x11_outbuf_software_xcb_perf_free(perf); + evas_software_xcb_outbuf_perf_free(perf); } static void evas_engine_software_xcb_output_perf_build(Evas_Performance *perf, const char *data) { - evas_software_x11_outbuf_software_xcb_perf_deserialize_x(perf, data); + evas_software_xcb_outbuf_perf_deserialize_x(perf, data); } static void evas_engine_software_xcb_output_perf_device_store(Evas_Performance *perf) { - evas_software_x11_outbuf_software_xcb_perf_store_x(perf); + evas_software_xcb_outbuf_perf_store_x(perf); } diff --git a/legacy/evas/src/lib/engines/software_xcb/evas_engine.h b/legacy/evas/src/lib/engines/software_xcb/evas_engine.h index 52596176c3..8966688a08 100644 --- a/legacy/evas/src/lib/engines/software_xcb/evas_engine.h +++ b/legacy/evas/src/lib/engines/software_xcb/evas_engine.h @@ -2,9 +2,14 @@ #define EVAS_ENGINE_H #include +#include +#include +#include +#include typedef struct _Outbuf Outbuf; typedef struct _Outbuf_Perf Outbuf_Perf; +typedef struct _Outbuf_Region Outbuf_Region; typedef struct _Xcb_Output_Buffer Xcb_Output_Buffer; typedef enum _Outbuf_Depth Outbuf_Depth; @@ -45,7 +50,11 @@ struct _Outbuf struct { DATA32 r, g, b; } mask; - RGBA_Image *back_buf; + /* lets not do back buf for now */ + /* RGBA_Image *back_buf; */ + + /* a list of pending regions to write to the target */ + Evas_List *pending_writes; int mask_dither : 1; @@ -80,136 +89,155 @@ struct _Outbuf_Perf int min_shm_image_pixel_count; }; + +struct _Outbuf_Region +{ + Xcb_Output_Buffer *xcbob, *mxcbob; + int x, y, w, h; +}; + +struct _Xcb_Output_Buffer +{ + XCBConnection *connection; + XCBImage *image; + XCBShmSegmentInfo *shm_info; + void *data; +}; + /****/ /* main */ -void evas_software_x11_x_software_xcb_init (void); +void evas_software_xcb_x_init (void); /* buffer */ -void evas_software_x11_x_software_xcb_write_mask_line (Xcb_Output_Buffer *xcbob, - DATA32 *src, - int w, - int y); -int evas_software_x11_x_software_xcb_can_do_shm (XCBConnection *c); -Xcb_Output_Buffer *evas_software_x11_x_software_xcb_output_buffer_new (XCBConnection *c, - int depth, - int w, - int h, - int try_shm, - void *data); -void evas_software_x11_x_software_xcb_output_buffer_free (Xcb_Output_Buffer *xcbob); -void evas_software_x11_x_software_xcb_output_buffer_paste (Xcb_Output_Buffer *xcbob, - XCBDRAWABLE d, - XCBGCONTEXT gc, - int x, - int y); -DATA8 *evas_software_x11_x_software_xcb_output_buffer_data (Xcb_Output_Buffer *xcbob, - int *bytes_per_line_ret); -int evas_software_x11_x_software_xcb_output_buffer_depth (Xcb_Output_Buffer *xcbob); -int evas_software_x11_x_software_xcb_output_buffer_byte_order(Xcb_Output_Buffer *xcbob); +void evas_software_xcb_x_write_mask_line (Xcb_Output_Buffer *xcbob, + DATA32 *src, + int w, + int y); +int evas_software_xcb_x_can_do_shm (XCBConnection *c); +Xcb_Output_Buffer *evas_software_xcb_x_output_buffer_new (XCBConnection *c, + int depth, + int w, + int h, + int try_shm, + void *data); +void evas_software_xcb_x_output_buffer_free (Xcb_Output_Buffer *xcbob, + int sync); +void evas_software_xcb_x_output_buffer_paste (Xcb_Output_Buffer *xcbob, + XCBDRAWABLE d, + XCBGCONTEXT gc, + int x, + int y, + int sync); +DATA8 *evas_software_xcb_x_output_buffer_data (Xcb_Output_Buffer *xcbob, + int *bytes_per_line_ret); +int evas_software_xcb_x_output_buffer_depth (Xcb_Output_Buffer *xcbob); +int evas_software_xcb_x_output_buffer_byte_order(Xcb_Output_Buffer *xcbob); + /* color */ -void x_software_xcb_color_init (void); -Convert_Pal *evas_software_x11_x_software_xcb_color_allocate (XCBConnection *conn, - XCBCOLORMAP cmap, - XCBVISUALTYPE *vis, - Convert_Pal_Mode colors); -void evas_software_x11_x_software_xcb_color_deallocate (XCBConnection *conn, - XCBCOLORMAP cmap, - XCBVISUALTYPE *vis, - Convert_Pal *pal); +void evas_software_xcb_x_color_init (void); +Convert_Pal *evas_software_xcb_x_color_allocate (XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *vis, + Convert_Pal_Mode colors); +void evas_software_xcb_x_color_deallocate (XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *vis, + Convert_Pal *pal); /* outbuf */ -void evas_software_x11_outbuf_software_xcb_init (void); -void evas_software_x11_outbuf_software_xcb_free (Outbuf *buf); -Outbuf *evas_software_x11_outbuf_software_xcb_setup_x (int w, - int h, - int rot, - Outbuf_Depth depth, - XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth, - Outbuf_Perf *perf, - int grayscale, - int max_colors, - XCBDRAWABLE mask, - int shape_dither); +void evas_software_xcb_outbuf_init (void); +void evas_software_xcb_outbuf_free (Outbuf *buf); +Outbuf *evas_software_xcb_outbuf_setup_x (int w, + int h, + int rot, + Outbuf_Depth depth, + XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth, + Outbuf_Perf *perf, + int grayscale, + int max_colors, + XCBDRAWABLE mask, + int shape_dither); -char *evas_software_x11_outbuf_software_xcb_perf_serialize_x (Outbuf_Perf *perf); -void evas_software_x11_outbuf_software_xcb_perf_deserialize_x (Outbuf_Perf *perf, - const char *data); -Outbuf_Perf *evas_software_x11_outbuf_software_xcb_perf_new_x (XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth); +char *evas_software_xcb_outbuf_perf_serialize_x (Outbuf_Perf *perf); +void evas_software_xcb_outbuf_perf_deserialize_x (Outbuf_Perf *perf, + const char *data); +Outbuf_Perf *evas_software_xcb_outbuf_perf_new_x (XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth); -char *evas_software_x11_outbuf_software_xcb_perf_serialize_info_x (Outbuf_Perf *perf); -void evas_software_x11_outbuf_software_xcb_perf_store_x (Outbuf_Perf *perf); -Outbuf_Perf *evas_software_x11_outbuf_software_xcb_perf_restore_x (XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth); -void evas_software_x11_outbuf_software_xcb_perf_free (Outbuf_Perf *perf); -Outbuf_Perf *evas_software_x11_outbuf_software_xcb_perf_x (XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth); +char *evas_software_xcb_outbuf_perf_serialize_info_x (Outbuf_Perf *perf); +void evas_software_xcb_outbuf_perf_store_x (Outbuf_Perf *perf); +Outbuf_Perf *evas_software_xcb_outbuf_perf_restore_x (XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth); +void evas_software_xcb_outbuf_perf_free (Outbuf_Perf *perf); +Outbuf_Perf *evas_software_xcb_outbuf_perf_x (XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth); -void evas_software_x11_outbuf_software_xcb_blit (Outbuf *buf, - int src_x, - int src_y, - int w, - int h, - int dst_x, - int dst_y); -void evas_software_x11_outbuf_software_xcb_update (Outbuf *buf, - int x, - int y, - int w, - int h); -RGBA_Image *evas_software_x11_outbuf_software_xcb_new_region_for_update (Outbuf *buf, - int x, - int y, - int w, - int h, - int *cx, - int *cy, - int *cw, - int *ch); -void evas_software_x11_outbuf_software_xcb_free_region_for_update (Outbuf *buf, - RGBA_Image *update); -void evas_software_x11_outbuf_software_xcb_push_updated_region (Outbuf *buf, - RGBA_Image *update, - int x, - int y, - int w, - int h); -void evas_software_x11_outbuf_software_xcb_reconfigure (Outbuf *buf, - int w, - int h, - int rot, - Outbuf_Depth depth); -int evas_software_x11_outbuf_software_xcb_get_width (Outbuf *buf); -int evas_software_x11_outbuf_software_xcb_get_height (Outbuf *buf); -Outbuf_Depth evas_software_x11_outbuf_software_xcb_get_depth (Outbuf *buf); -int evas_software_x11_outbuf_software_xcb_get_rot (Outbuf *buf); -int evas_software_x11_outbuf_software_xcb_get_have_backbuf (Outbuf *buf); -void evas_software_x11_outbuf_software_xcb_set_have_backbuf (Outbuf *buf, int have_backbuf); -void evas_software_x11_outbuf_software_xcb_drawable_set (Outbuf *buf, XCBDRAWABLE draw); -void evas_software_x11_outbuf_software_xcb_mask_set (Outbuf *buf, XCBDRAWABLE mask); -void evas_software_x11_outbuf_software_xcb_rotation_set (Outbuf *buf, int rot); +void evas_software_xcb_outbuf_blit (Outbuf *buf, + int src_x, + int src_y, + int w, + int h, + int dst_x, + int dst_y); +void evas_software_xcb_outbuf_update (Outbuf *buf, + int x, + int y, + int w, + int h); +RGBA_Image *evas_software_xcb_outbuf_new_region_for_update (Outbuf *buf, + int x, + int y, + int w, + int h, + int *cx, + int *cy, + int *cw, + int *ch); +void evas_software_xcb_outbuf_free_region_for_update (Outbuf *buf, + RGBA_Image *update); +void evas_software_xcb_outbuf_flush (Outbuf *buf); +void evas_software_xcb_outbuf_push_updated_region (Outbuf *buf, + RGBA_Image *update, + int x, + int y, + int w, + int h); +void evas_software_xcb_outbuf_reconfigure (Outbuf *buf, + int w, + int h, + int rot, + Outbuf_Depth depth); +int evas_software_xcb_outbuf_get_width (Outbuf *buf); +int evas_software_xcb_outbuf_get_height (Outbuf *buf); +Outbuf_Depth evas_software_xcb_outbuf_get_depth (Outbuf *buf); +int evas_software_xcb_outbuf_get_rot (Outbuf *buf); +int evas_software_xcb_outbuf_get_have_backbuf (Outbuf *buf); +void evas_software_xcb_outbuf_set_have_backbuf (Outbuf *buf, int have_backbuf); +void evas_software_xcb_outbuf_drawable_set (Outbuf *buf, XCBDRAWABLE draw); +void evas_software_xcb_outbuf_mask_set (Outbuf *buf, XCBDRAWABLE mask); +void evas_software_xcb_outbuf_rotation_set (Outbuf *buf, int rot); + +void evas_software_xcb_outbuf_debug_set (Outbuf *buf, int debug); +void evas_software_xcb_outbuf_debug_show (Outbuf *buf, + XCBDRAWABLE draw, + int x, + int y, + int w, + int h); -void evas_software_x11_outbuf_software_xcb_debug_set (Outbuf *buf, int debug); -void evas_software_x11_outbuf_software_xcb_debug_show (Outbuf *buf, - XCBDRAWABLE draw, - int x, - int y, - int w, - int h); - #endif /* EVAS_ENGINE_H */ diff --git a/legacy/evas/src/lib/engines/software_xcb/evas_outbuf.c b/legacy/evas/src/lib/engines/software_xcb/evas_outbuf.c index 6216fef7a1..228309e7e1 100644 --- a/legacy/evas/src/lib/engines/software_xcb/evas_outbuf.c +++ b/legacy/evas/src/lib/engines/software_xcb/evas_outbuf.c @@ -2,65 +2,52 @@ #include "evas_engine.h" #include #include -#include +#include #include #include -static double evas_software_x11_outbuf_software_xcb_get_time(void); - -/* used for performance tester code */ -static double -evas_software_x11_outbuf_software_xcb_get_time(void) -{ - struct timeval timev; - - gettimeofday(&timev, NULL); - return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); -} - void -evas_software_x11_outbuf_software_xcb_init(void) +evas_software_xcb_outbuf_init(void) { } void -evas_software_x11_outbuf_software_xcb_free(Outbuf * buf) +evas_software_xcb_outbuf_free(Outbuf * buf) { + evas_software_xcb_outbuf_flush(buf); XCBFreeGC(buf->priv.x.conn, buf->priv.x.gc); if (buf->priv.x.gcm.xid) XCBFreeGC(buf->priv.x.conn, buf->priv.x.gcm); if (buf->priv.pal) - evas_software_x11_x_software_xcb_color_deallocate(buf->priv.x.conn, - buf->priv.x.cmap, - buf->priv.x.vis, - buf->priv.pal); - if (buf->priv.back_buf) - evas_common_image_free(buf->priv.back_buf); - evas_software_x11_outbuf_software_xcb_perf_free(buf->perf); + evas_software_xcb_x_color_deallocate(buf->priv.x.conn, + buf->priv.x.cmap, + buf->priv.x.vis, + buf->priv.pal); + evas_software_xcb_outbuf_perf_free(buf->perf); free(buf); } void -evas_software_x11_outbuf_software_xcb_rotation_set(Outbuf *buf, int rot) +evas_software_xcb_outbuf_rotation_set(Outbuf *buf, int rot) { buf->rot = rot; } Outbuf * -evas_software_x11_outbuf_software_xcb_setup_x(int w, - int h, - int rot, - Outbuf_Depth depth, - XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth, - Outbuf_Perf *perf, - int grayscale, - int max_colors, - XCBDRAWABLE mask, - int shape_dither) +evas_software_xcb_outbuf_setup_x(int w, + int h, + int rot, + Outbuf_Depth depth, + XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth, + Outbuf_Perf *perf, + int grayscale, + int max_colors, + XCBDRAWABLE mask, + int shape_dither) { Outbuf *buf; @@ -87,20 +74,20 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, Gfx_Func_Convert conv_func; Xcb_Output_Buffer *xcbob; - buf->priv.x.shm = evas_software_x11_x_software_xcb_can_do_shm(buf->priv.x.conn); - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - buf->priv.x.depth, - 1, 1, - buf->priv.x.shm, NULL); + buf->priv.x.shm = evas_software_xcb_x_can_do_shm(buf->priv.x.conn); + xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, + buf->priv.x.depth, + 1, 1, + buf->priv.x.shm, NULL); conv_func = NULL; if (xcbob) { #ifdef WORDS_BIGENDIAN - if (evas_software_x11_x_software_xcb_output_buffer_byte_order(xcbob) == LSBFirst) + if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == LSBFirst) buf->priv.x.swap = 1; #else - if (evas_software_x11_x_software_xcb_output_buffer_byte_order(xcbob) == MSBFirst) + if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == MSBFirst) buf->priv.x.swap = 1; #endif if ((vis->_class == TrueColor) || (vis->_class == DirectColor)) @@ -158,10 +145,10 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, pm = PAL_MODE_MONO; } buf->priv.pal = - evas_software_x11_x_software_xcb_color_allocate(conn, - cmap, - vis, - PAL_MODE_RGB666); + evas_software_xcb_x_color_allocate(conn, + cmap, + vis, + PAL_MODE_RGB666); if (!buf->priv.pal) { free(buf); @@ -174,7 +161,7 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, conv_func = evas_common_convert_func_get(0, buf->w, buf->h, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), + evas_software_xcb_x_output_buffer_depth (xcbob), buf->priv.mask.r, buf->priv.mask.g, buf->priv.mask.b, @@ -184,7 +171,7 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, conv_func = evas_common_convert_func_get(0, buf->h, buf->w, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), + evas_software_xcb_x_output_buffer_depth (xcbob), buf->priv.mask.r, buf->priv.mask.g, buf->priv.mask.b, @@ -194,7 +181,7 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, conv_func = evas_common_convert_func_get(0, buf->h, buf->w, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), + evas_software_xcb_x_output_buffer_depth(xcbob), buf->priv.mask.r, buf->priv.mask.g, buf->priv.mask.b, @@ -207,7 +194,7 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, conv_func = evas_common_convert_func_get(0, buf->w, buf->h, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), + evas_software_xcb_x_output_buffer_depth(xcbob), buf->priv.mask.r, buf->priv.mask.g, buf->priv.mask.b, @@ -217,7 +204,7 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, conv_func = evas_common_convert_func_get(0, buf->h, buf->w, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), + evas_software_xcb_x_output_buffer_depth(xcbob), buf->priv.mask.r, buf->priv.mask.g, buf->priv.mask.b, @@ -227,14 +214,14 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, conv_func = evas_common_convert_func_get(0, buf->h, buf->w, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), + evas_software_xcb_x_output_buffer_depth(xcbob), buf->priv.mask.r, buf->priv.mask.g, buf->priv.mask.b, PAL_MODE_NONE, buf->rot); } - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); + evas_software_xcb_x_output_buffer_free(xcbob, 1); if (!conv_func) { printf(".[ Evas Error ].\n" @@ -251,22 +238,453 @@ evas_software_x11_outbuf_software_xcb_setup_x(int w, buf->priv.pal->colors); } } - evas_software_x11_outbuf_software_xcb_drawable_set(buf, draw); - evas_software_x11_outbuf_software_xcb_mask_set(buf, mask); + evas_software_xcb_outbuf_drawable_set(buf, draw); + evas_software_xcb_outbuf_mask_set(buf, mask); } -#if 0 - if (buf->priv.x.depth < 24) - buf->priv.back_buf = evas_common_image_create(buf->w, buf->h); -#endif - buf->perf = perf; return buf; } + +RGBA_Image * +evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, + int x, + int y, + int w, + int h, + int *cx, + int *cy, + int *cw, + int *ch) +{ + RGBA_Image *im; + Outbuf_Region *obr; + int bpl = 0; + int use_shm = 1; + + obr = calloc(1, sizeof(Outbuf_Region)); + obr->x = x; + obr->y = y; + obr->w = w; + obr->h = h; + *cx = 0; + *cy = 0; + *cw = w; + *ch = h; + + use_shm = buf->priv.x.shm; + if (buf->perf) + { + if ((w * h) < buf->perf->min_shm_image_pixel_count) use_shm = 0; + } + else + { + if ((w * h) < (200 * 200)) use_shm = 0; + } + + if ((buf->rot == 0) && + (buf->priv.mask.r == 0xff0000) && + (buf->priv.mask.g == 0x00ff00) && + (buf->priv.mask.b == 0x0000ff)) + { + im = evas_common_image_new(); + im->image = evas_common_image_surface_new(im); + im->image->w = w; + im->image->h = h; + im->image->data = NULL; + im->image->no_free = 1; + im->extended_info = obr; + obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, + buf->priv.x.depth, + w, + h, + use_shm, + NULL); + im->image->data = evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl); + if (buf->priv.x.mask.pixmap.xid) + obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, + 1, + w, + h, + use_shm, + NULL); + } + else + { + im = evas_common_image_create(w, h); + im->extended_info = obr; + if ((buf->rot == 0) || (buf->rot == 180)) + obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, + buf->priv.x.depth, + w, + h, + use_shm, + NULL); + else if ((buf->rot == 90) || (buf->rot == 270)) + obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, + buf->priv.x.depth, + h, + w, + use_shm, + NULL); + if (buf->priv.x.mask.pixmap.xid) + obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn, + 1, + w, + h, + use_shm, + NULL); + } + if (buf->priv.x.mask.pixmap.xid) + { + im->flags |= RGBA_IMAGE_HAS_ALPHA; + /* FIXME: faster memset! */ + memset(im->image->data, 0, w * h * sizeof(DATA32)); + } + buf->priv.pending_writes = evas_list_append(buf->priv.pending_writes, im); + return im; +} + +void +evas_software_xcb_outbuf_free_region_for_update(Outbuf *buf, + RGBA_Image *update) +{ + /* no need to do anything - they are cleaned up on flush */ +} + +void +evas_software_xcb_outbuf_flush(Outbuf *buf) +{ + Evas_List *l; + + for (l = buf->priv.pending_writes; l; l = l->next) + { + RGBA_Image *im; + Outbuf_Region *obr; + + im = l->data; + obr = im->extended_info; + /* paste now */ + if (buf->priv.debug) + evas_software_xcb_outbuf_debug_show(buf, + buf->priv.x.win, + obr->x, + obr->y, + obr->w, + obr->h); + evas_software_xcb_x_output_buffer_paste(obr->xcbob, + buf->priv.x.win, + buf->priv.x.gc, + obr->x, + obr->y, 0); + if (obr->mxcbob) + evas_software_xcb_x_output_buffer_paste(obr->mxcbob, + buf->priv.x.mask, + buf->priv.x.gcm, + obr->x, + obr->y, 0); + } + XCBSync(buf->priv.x.conn, 0); + while (buf->priv.pending_writes) + { + RGBA_Image *im; + Outbuf_Region *obr; + + im = buf->priv.pending_writes->data; + buf->priv.pending_writes = evas_list_remove_list(buf->priv.pending_writes, + buf->priv.pending_writes); + obr = im->extended_info; + evas_common_image_free(im); + if (obr->xcbob) evas_software_xcb_x_output_buffer_free(obr->xcbob, 0); + if (obr->mxcbob) evas_software_xcb_x_output_buffer_free(obr->mxcbob, 0); + free(obr); + } + evas_common_cpu_end_opt(); +} + +void +evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, + RGBA_Image *update, + int x, + int y, + int w, + int h) +{ + Gfx_Func_Convert conv_func = NULL; + Outbuf_Region *obr; + DATA32 *src_data; + void *data; + int bpl = 0; + int yy; + + obr = update->extended_info; + if (buf->priv.pal) + { + if ((buf->rot == 0) || (buf->rot == 180)) + conv_func = evas_common_convert_func_get(0, w, h, + evas_software_xcb_x_output_buffer_depth + (obr->xcbob), buf->priv.mask.r, + buf->priv.mask.g, buf->priv.mask.b, + buf->priv.pal->colors, buf->rot); + else if ((buf->rot == 90) || (buf->rot == 270)) + conv_func = evas_common_convert_func_get(0, h, w, + evas_software_xcb_x_output_buffer_depth + (obr->xcbob), buf->priv.mask.r, + buf->priv.mask.g, buf->priv.mask.b, + buf->priv.pal->colors, buf->rot); + } + else + { + if ((buf->rot == 0) || (buf->rot == 180)) + conv_func = evas_common_convert_func_get(0, w, h, + evas_software_xcb_x_output_buffer_depth + (obr->xcbob), buf->priv.mask.r, + buf->priv.mask.g, buf->priv.mask.b, + PAL_MODE_NONE, buf->rot); + else if ((buf->rot == 90) || (buf->rot == 270)) + conv_func = evas_common_convert_func_get(0, h, w, + evas_software_xcb_x_output_buffer_depth + (obr->xcbob), buf->priv.mask.r, + buf->priv.mask.g, buf->priv.mask.b, + PAL_MODE_NONE, buf->rot); + } + if (!conv_func) return; + + data = evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl); + src_data = update->image->data; + if (buf->rot == 0) + { + obr->x = x; + obr->y = y; + } + else if (buf->rot == 90) + { + obr->x = y; + obr->y = buf->w - x - w; + } + else if (buf->rot == 180) + { + obr->x = buf->w - x - w; + obr->y = buf->h - y - h; + } + else if (buf->rot == 270) + { + obr->x = buf->h - y - h; + obr->y = x; + } + if ((buf->rot == 0) || (buf->rot == 180)) + { + obr->w = w; + obr->h = h; + } + else if ((buf->rot == 90) || (buf->rot == 270)) + { + obr->w = h; + obr->h = w; + } + if (buf->priv.pal) + { + if (data != src_data) + conv_func(src_data, data, + 0, + bpl / + ((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / + 8)) - obr->w, obr->w, obr->h, x, y, + buf->priv.pal->lookup); + } + else + { + if (data != src_data) + conv_func(src_data, data, + 0, + bpl / + ((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / + 8)) - obr->w, obr->w, obr->h, x, y, NULL); + } + if (obr->mxcbob) + { + for (yy = 0; yy < obr->h; yy++) + evas_software_xcb_x_write_mask_line(obr->mxcbob, + src_data + + (yy * obr->w), obr->w, yy); + } +} + +void +evas_software_xcb_outbuf_reconfigure(Outbuf *buf, + int w, + int h, + int rot, + Outbuf_Depth depth) +{ + if ((w == buf->w) && + (h == buf->h) && + (rot == buf->rot) && + (depth == buf->depth)) return; + buf->w = w; + buf->h = h; + buf->rot = rot; +} + +int +evas_software_xcb_outbuf_get_width(Outbuf * buf) +{ + return buf->w; +} + +int +evas_software_xcb_outbuf_get_height(Outbuf * buf) +{ + return buf->h; +} + +Outbuf_Depth +evas_software_xcb_outbuf_get_depth(Outbuf * buf) +{ + return buf->depth; +} + +int +evas_software_xcb_outbuf_get_rot(Outbuf * buf) +{ + return buf->rot; +} + +void +evas_software_xcb_outbuf_drawable_set(Outbuf *buf, + XCBDRAWABLE draw) +{ + if (buf->priv.x.win.window.xid == draw.window.xid) return; + if (buf->priv.x.gc.xid) + { + XCBFreeGC(buf->priv.x.conn, buf->priv.x.gc); + buf->priv.x.gc.xid = 0; + } + buf->priv.x.win = draw; + buf->priv.x.gc = XCBGCONTEXTNew(buf->priv.x.conn); + XCBCreateGC(buf->priv.x.conn, buf->priv.x.gc, buf->priv.x.win, 0, NULL); +} + +void +evas_software_xcb_outbuf_mask_set(Outbuf *buf, + XCBDRAWABLE mask) +{ + if (buf->priv.x.mask.pixmap.xid == mask.pixmap.xid) return; + if (buf->priv.x.gcm.xid) + { + XCBFreeGC(buf->priv.x.conn, buf->priv.x.gcm); + buf->priv.x.gcm.xid = 0; + } + buf->priv.x.mask = mask; + if (buf->priv.x.mask.pixmap.xid) + { + buf->priv.x.gcm = XCBGCONTEXTNew(buf->priv.x.conn); + XCBCreateGC(buf->priv.x.conn, buf->priv.x.gcm, buf->priv.x.win, 0, NULL); + } +} + +void +evas_software_xcb_outbuf_debug_set(Outbuf *buf, + int debug) +{ + buf->priv.debug = debug; +} +void +evas_software_xcb_outbuf_debug_show(Outbuf *buf, + XCBDRAWABLE draw, + int x, + int y, + int w, + int h) +{ + int i; + XCBSCREEN *screen; + + { + XCBGetGeometryRep *geom; + XCBDRAWABLE root; + XCBSCREENIter i; + int cur; + + geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, draw), 0); + root.window = geom->root; + free (geom); + geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, root), 0); + + i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(buf->priv.x.conn)); + for (cur = 0; cur < i.rem; XCBSCREENNext(&i), ++cur) + if (i.data->root.xid == geom->root.xid) + { + screen = i.data; + break; + } + free (geom); + } + for (i = 0; i < 10; i++) + { + XCBImage *image; + XCBRECTANGLE rect = { x, y, w, h}; + CARD32 mask; + CARD32 value[2]; + + mask = GCForeground | GCGraphicsExposures; + value[0] = screen->black_pixel; + value[1] = 0; /* no graphics exposures */ + XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); + XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); + XCBSync(buf->priv.x.conn, 0); + image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, 0xffffffff, ZPixmap); + if (image) + XCBImageDestroy(image); + XCBSync(buf->priv.x.conn, 0); + mask = GCForeground | GCGraphicsExposures; + value[0] = screen->white_pixel; + value[1] = 0; /* no graphics exposures */ + XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); + XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); + XCBSync(buf->priv.x.conn, 0); + image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, 0xffffffff, ZPixmap); + if (image) + XCBImageDestroy(image); + XCBSync(buf->priv.x.conn, 0); + } +} + + + + + + + + + + + + + + + + + + + + + + +/* used for performance tester code */ +static double +_evas_get_time(void) +{ + struct timeval timev; + + gettimeofday(&timev, NULL); + return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); +} + char * -evas_software_x11_outbuf_software_xcb_perf_serialize_x(Outbuf_Perf * perf) +evas_software_xcb_outbuf_perf_serialize_x(Outbuf_Perf *perf) { /* take performance results and turn it inot a munged string that can be */ /* written out somewhere by a program */ @@ -277,8 +695,8 @@ evas_software_x11_outbuf_software_xcb_perf_serialize_x(Outbuf_Perf * perf) } void -evas_software_x11_outbuf_software_xcb_perf_deserialize_x(Outbuf_Perf *perf, - const char *data) +evas_software_xcb_outbuf_perf_deserialize_x(Outbuf_Perf *perf, + const char *data) { /* take a munged string that is the result of outbuf_perf_serialize_x() */ /* and turn it back into a structure and fill the provided perf struct */ @@ -296,11 +714,11 @@ evas_software_x11_outbuf_software_xcb_perf_deserialize_x(Outbuf_Perf *perf, } Outbuf_Perf * -evas_software_x11_outbuf_software_xcb_perf_new_x(XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth) +evas_software_xcb_outbuf_perf_new_x(XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth) { /* create an "empty" perf struct with just the system & display info */ Outbuf_Perf *perf; @@ -416,8 +834,8 @@ evas_software_x11_outbuf_software_xcb_perf_new_x(XCBConnection *conn, cmap.xid = 0; } -char * -evas_software_x11_outbuf_software_xcb_perf_serialize_info_x(Outbuf_Perf * perf) +char * +evas_software_xcb_outbuf_perf_serialize_info_x(Outbuf_Perf *perf) { /* get a seriazed string that is a unique identifier for your */ /* hardware/x/connection setup. */ @@ -447,7 +865,7 @@ evas_software_x11_outbuf_software_xcb_perf_serialize_info_x(Outbuf_Perf * perf) } void -evas_software_x11_outbuf_software_xcb_perf_store_x(Outbuf_Perf * perf) +evas_software_xcb_outbuf_perf_store_x(Outbuf_Perf *perf) { /* write performance results to x root property */ XCBInternAtomRep *rep; @@ -463,9 +881,9 @@ evas_software_x11_outbuf_software_xcb_perf_store_x(Outbuf_Perf * perf) type_str), NULL); type = rep->atom; - format.xid = XA_STRING; + format = STRING; - str = evas_software_x11_outbuf_software_xcb_perf_serialize_x(perf); + str = evas_software_xcb_outbuf_perf_serialize_x(perf); XCBChangeProperty(perf->x.conn, PropModeReplace, perf->x.root.window, type, format, 8, strlen(str), str); @@ -474,11 +892,11 @@ evas_software_x11_outbuf_software_xcb_perf_store_x(Outbuf_Perf * perf) } Outbuf_Perf * -evas_software_x11_outbuf_software_xcb_perf_restore_x(XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth) +evas_software_xcb_outbuf_perf_restore_x(XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth) { /* read performance results from root window */ XCBInternAtomRep *type_rep; @@ -490,7 +908,7 @@ evas_software_x11_outbuf_software_xcb_perf_restore_x(XCBConnection *conn, char *retval; int retnum; - perf = evas_software_x11_outbuf_software_xcb_perf_new_x(conn, draw, vis, cmap, x_depth); + perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth); type_str = "__EVAS_PERF_ENGINE_SOFTWARE"; type_rep = XCBInternAtomReply(conn, @@ -500,7 +918,7 @@ evas_software_x11_outbuf_software_xcb_perf_restore_x(XCBConnection *conn, type_str), NULL); type = type_rep->atom; - format.xid = XA_STRING; + format = STRING; retval = NULL; cookie = XCBGetProperty(conn, 0, perf->x.root.window, @@ -520,7 +938,7 @@ evas_software_x11_outbuf_software_xcb_perf_restore_x(XCBConnection *conn, s = malloc(retnum + 1); strncpy(s, retval, retnum); s[retnum] = 0; - evas_software_x11_outbuf_software_xcb_perf_deserialize_x(perf, s); + evas_software_xcb_outbuf_perf_deserialize_x(perf, s); free(s); } /* FIXME: doesn't seem to be need (from valgrind) */ @@ -530,7 +948,7 @@ evas_software_x11_outbuf_software_xcb_perf_restore_x(XCBConnection *conn, } void -evas_software_x11_outbuf_software_xcb_perf_free(Outbuf_Perf * perf) +evas_software_xcb_outbuf_perf_free(Outbuf_Perf *perf) { /* free the perf struct */ free(perf->x.display); @@ -543,20 +961,20 @@ evas_software_x11_outbuf_software_xcb_perf_free(Outbuf_Perf * perf) } Outbuf_Perf * -evas_software_x11_outbuf_software_xcb_perf_x(XCBConnection *conn, - XCBDRAWABLE draw, - XCBVISUALTYPE *vis, - XCBCOLORMAP cmap, - int x_depth) +evas_software_xcb_outbuf_perf_x(XCBConnection *conn, + XCBDRAWABLE draw, + XCBVISUALTYPE *vis, + XCBCOLORMAP cmap, + int x_depth) { - Outbuf_Perf *perf; - XCBDRAWABLE win; - CARD32 mask; - CARD32 value[7]; - int w, h; - int do_shm = 0; + Outbuf_Perf *perf; + XCBDRAWABLE win; + CARD32 mask; + CARD32 value[7]; + int w, h; + int do_shm = 0; - perf = evas_software_x11_outbuf_software_xcb_perf_new_x(conn, draw, vis, cmap, x_depth); + perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth); mask = CWBackingStore | CWColormap | CWBackPixmap | CWBorderPixel | @@ -582,7 +1000,7 @@ evas_software_x11_outbuf_software_xcb_perf_x(XCBConnection *conn, XCBSync(conn, 0); XCBMapWindow (conn, win.window); - do_shm = evas_software_x11_x_software_xcb_can_do_shm(conn); + do_shm = evas_software_xcb_x_can_do_shm(conn); /* set it to something ridiculous to start */ perf->min_shm_image_pixel_count = w * w; @@ -611,48 +1029,50 @@ evas_software_x11_outbuf_software_xcb_perf_x(XCBConnection *conn, int loops; loops = (h * h * 5) / (i * i); - t0 = evas_software_x11_outbuf_software_xcb_get_time(); + t0 = _evas_get_time(); for (l = 0; l < loops; l++) { - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(conn, - x_depth, - i, i, - do_shm, - NULL); + xcbob = evas_software_xcb_x_output_buffer_new(conn, + x_depth, + i, i, + do_shm, + NULL); if (!xcbob) error = 1; else { - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - win, - gc, - 0, 0); - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); + evas_software_xcb_x_output_buffer_paste(xcbob, + win, + gc, + 0, 0, + 1); + evas_software_xcb_x_output_buffer_free(xcbob, 1); } } XCBSync(conn, 0); - t1 = evas_software_x11_outbuf_software_xcb_get_time() - t0; - t0 = evas_software_x11_outbuf_software_xcb_get_time(); + t1 = _evas_get_time() - t0; + t0 = _evas_get_time(); for (l = 0; l < loops; l++) { - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(conn, - x_depth, - i, i, - 0, - NULL); + xcbob = evas_software_xcb_x_output_buffer_new(conn, + x_depth, + i, i, + 0, + NULL); if (!xcbob) error = 1; else { - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - win, - gc, - 0, 0); - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); + evas_software_xcb_x_output_buffer_paste(xcbob, + win, + gc, + 0, 0, + 1); + evas_software_xcb_x_output_buffer_free(xcbob, 1); } } XCBSync(conn, 0); - t2 = evas_software_x11_outbuf_software_xcb_get_time() - t0; + t2 = _evas_get_time() - t0; if ((!chosen) && (!error)) { if ((t1 / t2) < 1.0) @@ -667,838 +1087,3 @@ evas_software_x11_outbuf_software_xcb_perf_x(XCBConnection *conn, XCBDestroyWindow(conn, win.window); return perf; } - -void -evas_software_x11_outbuf_software_xcb_blit(Outbuf *buf, - int src_x, - int src_y, - int w, - int h, - int dst_x, - int dst_y) -{ - if (buf->priv.back_buf) - { - evas_common_blit_rectangle(buf->priv.back_buf, buf->priv.back_buf, - src_x, src_y, w, h, dst_x, dst_y); - evas_software_x11_outbuf_software_xcb_update(buf, dst_x, dst_y, w, h); - } - else - { - if (buf->priv.x.conn) - { - if (buf->rot == 0) - XCBCopyArea(buf->priv.x.conn, - buf->priv.x.win, buf->priv.x.win, - buf->priv.x.gc, - src_x, src_y, - w, h, - dst_x, dst_y); - else if (buf->rot == 270) - XCBCopyArea(buf->priv.x.conn, - buf->priv.x.win, buf->priv.x.win, - buf->priv.x.gc, - buf->h - src_y - h, src_x, - h, w, - dst_y, dst_x); - else if (buf->rot == 90) - XCBCopyArea(buf->priv.x.conn, - buf->priv.x.win, buf->priv.x.win, - buf->priv.x.gc, - src_y, buf->w - src_x - w, - h, w, - dst_y, dst_x); - } - } -} - -void -evas_software_x11_outbuf_software_xcb_update(Outbuf *buf, int x, int y, int w, int h) -{ - Gfx_Func_Convert conv_func; - DATA8 *data; - Xcb_Output_Buffer *xcbob; - int bpl; - int use_shm; - - if (!(buf->priv.back_buf)) - return; - use_shm = buf->priv.x.shm; - if (buf->perf) - { - if ((w * h) < buf->perf->min_shm_image_pixel_count) - use_shm = 0; - } - else - { - if ((w * h) < (200 * 200)) - use_shm = 0; - } - xcbob = NULL; - if (buf->rot == 0) - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - buf->priv.x.depth, - w, h, - use_shm, - NULL); - else if (buf->rot == 270) - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - buf->priv.x.depth, - h, w, - use_shm, - NULL); - else if (buf->rot == 90) - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - buf->priv.x.depth, - h, w, - use_shm, - NULL); - if (!xcbob) - return; - data = evas_software_x11_x_software_xcb_output_buffer_data(xcbob, &bpl); - conv_func = NULL; - if (buf->priv.pal) - { - if (buf->rot == 0) - conv_func = evas_common_convert_func_get(0, w, h, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); - else if (buf->rot == 270) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); - else if (buf->rot == 90) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); - } - else - { - if (buf->rot == 0) - conv_func = evas_common_convert_func_get(0, w, h, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - PAL_MODE_NONE, - buf->rot); - else if (buf->rot == 270) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - PAL_MODE_NONE, - buf->rot); - else if (buf->rot == 90) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth(xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - PAL_MODE_NONE, - buf->rot); - } - if (conv_func) - { - DATA32 *src_data; - - src_data = buf->priv.back_buf->image->data + (y * buf->w) + x; - if (buf->priv.pal) - { - if (buf->rot == 0) - { - conv_func(src_data, data, - buf->w - w, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - w, - w, h, - x, y, - buf->priv.pal->lookup); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - x, y); - } - else if (buf->rot == 270) - { - conv_func(src_data, data, - buf->w - w, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, - x, y, - buf->priv.pal->lookup); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - buf->h - y - h, x); - } - else if (buf->rot == 90) - { - conv_func(src_data, data, - buf->w - w, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, x, y, buf->priv.pal->lookup); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - y, buf->w - x - w); - } - } - else - { - if (buf->rot == 0) - { - conv_func(src_data, data, - buf->w - w, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - w, - w, h, - x, y, - NULL); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - x, y); - } - else if (buf->rot == 270) - { - conv_func(src_data, data, - buf->w - w, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, - x, y, - NULL); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - buf->h - y - h, x); - } - else if (buf->rot == 90) - { - conv_func(src_data, data, - buf->w - w, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, - x, y, - NULL); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - y, buf->w - x - w); - } - } - } - else - { - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); - return; - } - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); -} - -RGBA_Image * -evas_software_x11_outbuf_software_xcb_new_region_for_update(Outbuf *buf, - int x, - int y, - int w, - int h, - int *cx, - int *cy, - int *cw, - int *ch) -{ - if (buf->priv.back_buf) - { - *cx = x; - *cy = y; - *cw = w; - *ch = h; - return buf->priv.back_buf; - } - else - { - RGBA_Image *im; - - *cx = 0; - *cy = 0; - *cw = w; - *ch = h; - im = evas_common_image_create(w, h); - if (buf->priv.x.mask.window.xid) - { - im->flags |= RGBA_IMAGE_HAS_ALPHA; - memset(im->image->data, 0, w * h * sizeof(DATA32)); - } - return im; - } - return NULL; -} - -void -evas_software_x11_outbuf_software_xcb_free_region_for_update(Outbuf *buf, - RGBA_Image *update) -{ - if (update != buf->priv.back_buf) - evas_common_image_free(update); -} - -void -evas_software_x11_outbuf_software_xcb_push_updated_region(Outbuf *buf, - RGBA_Image *update, - int x, - int y, - int w, - int h) -{ - if (buf->priv.back_buf) - { - if (update != buf->priv.back_buf) - evas_common_blit_rectangle(update, buf->priv.back_buf, 0, 0, w, h, x, y); - evas_software_x11_outbuf_software_xcb_update(buf, x, y, w, h); - } - else - { - Gfx_Func_Convert conv_func; - DATA8 *data; - Xcb_Output_Buffer *xcbob; - int bpl; - int use_shm = 1; - void *orig_data; - int direct_data = 0; - - use_shm = buf->priv.x.shm; - if (buf->perf) - { - if ((w * h) < buf->perf->min_shm_image_pixel_count) - use_shm = 0; - } - else - { - if ((w * h) < (200 * 200)) - use_shm = 0; - } - xcbob = NULL; - orig_data = update->image->data; - /* Punch thru - if our output format is our */ - /* input format - then avoid convert since we used */ - /* the image data directly */ - if ((buf->rot == 0) && - (buf->priv.mask.r == 0xff0000) && - (buf->priv.mask.g == 0x00ff00) && - (buf->priv.mask.b == 0x0000ff) && - (!use_shm) && (w == update->image->w) && (h == update->image->h)) - direct_data = 1; - if (!direct_data) - orig_data = NULL; - if (buf->rot == 0) - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - buf->priv.x.depth, - w, h, - use_shm, orig_data); - else if (buf->rot == 270) - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - buf->priv.x.depth, - h, w, - use_shm, orig_data); - else if (buf->rot == 90) - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - buf->priv.x.depth, - h, w, - use_shm, orig_data); - if (!xcbob) - return; - data = evas_software_x11_x_software_xcb_output_buffer_data(xcbob, &bpl); - conv_func = NULL; - if (buf->priv.pal) - { - if (buf->rot == 0) - conv_func = evas_common_convert_func_get(0, w, h, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); - else if (buf->rot == 270) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); - else if (buf->rot == 90) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); - } - else - { - if (buf->rot == 0) - conv_func = evas_common_convert_func_get(0, w, h, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - PAL_MODE_NONE, - buf->rot); - else if (buf->rot == 270) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - PAL_MODE_NONE, - buf->rot); - else if (buf->rot == 90) - conv_func = evas_common_convert_func_get(0, h, w, - evas_software_x11_x_software_xcb_output_buffer_depth (xcbob), - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - PAL_MODE_NONE, - buf->rot); - } - if (conv_func) - { - DATA32 *src_data; - Xcb_Output_Buffer *mxcbob = NULL; - - if (buf->priv.x.mask.window.xid) - { - if (buf->rot == 0) - mxcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - 1, - w, h, - 0, NULL); - else if (buf->rot == 270) - mxcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - 1, - h, w, - 0, NULL); - else if (buf->rot == 90) - mxcbob = evas_software_x11_x_software_xcb_output_buffer_new(buf->priv.x.conn, - 1, - h, w, - 0, NULL); - } - src_data = update->image->data; - if (buf->priv.pal) - { - if (buf->rot == 0) - { - if (!direct_data) - conv_func(src_data, data, - 0, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - w, - w, h, - x, y, - buf->priv.pal->lookup); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - x, y); - if (mxcbob) - { - int yy; - - for (yy = 0; yy < h; yy++) - evas_software_x11_x_software_xcb_write_mask_line(mxcbob, - src_data + (yy * w), w, yy); - evas_software_x11_x_software_xcb_output_buffer_paste(mxcbob, - buf->priv.x.mask, - buf->priv.x.gcm, - x, y); - } - } - else if (buf->rot == 270) - { - if (!direct_data) - conv_func(src_data, data, - 0, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, - x, y, - buf->priv.pal->lookup); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - buf->h - y - h, x); - if (mxcbob) - { - evas_software_x11_x_software_xcb_output_buffer_paste(mxcbob, - buf->priv.x.mask, - buf->priv.x.gcm, - buf->h - y - h, x); - } - } - else if (buf->rot == 90) - { - if (!direct_data) - conv_func(src_data, data, - 0, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, - x, y, - buf->priv.pal->lookup); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - y, buf->w - x - w); - if (mxcbob) - { - evas_software_x11_x_software_xcb_output_buffer_paste(mxcbob, - buf->priv.x.mask, - buf->priv.x.gcm, - y, buf->w - x - w); - } - } - } - else - { - if (buf->rot == 0) - { - if (!direct_data) - conv_func(src_data, data, - 0, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - w, - w, h, - x, y, - NULL); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - x, y); - if (mxcbob) - { - int yy; - - for (yy = 0; yy < h; yy++) - evas_software_x11_x_software_xcb_write_mask_line(mxcbob, - src_data + (yy * w), - w, yy); - evas_software_x11_x_software_xcb_output_buffer_paste(mxcbob, - buf->priv.x.mask, - buf->priv.x.gcm, - x, y); - } - } - else if (buf->rot == 270) - { - if (!direct_data) - conv_func(src_data, data, - 0, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, - x, y, - NULL); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - buf->h - y - h, x); - if (mxcbob) - { - evas_software_x11_x_software_xcb_output_buffer_paste(mxcbob, - buf->priv.x.mask, - buf->priv.x.gcm, - buf->h - y - h, x); - } - } - else if (buf->rot == 90) - { - if (!direct_data) - conv_func(src_data, data, - 0, - bpl / ((evas_software_x11_x_software_xcb_output_buffer_depth(xcbob) >> 3)) - h, - h, w, - x, y, - NULL); - if (buf->priv.debug) - evas_software_x11_outbuf_software_xcb_debug_show(buf, - buf->priv.x.win, - x, y, - w, h); - evas_software_x11_x_software_xcb_output_buffer_paste(xcbob, - buf->priv.x.win, - buf->priv.x.gc, - y, buf->w - x - w); - if (mxcbob) - { - evas_software_x11_x_software_xcb_output_buffer_paste(mxcbob, - buf->priv.x.mask, - buf->priv.x.gcm, - y, buf->w - x - w); - } - } - } - if (mxcbob) - evas_software_x11_x_software_xcb_output_buffer_free(mxcbob); - } - else - { - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); - return; - } - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); - } -} - -void -evas_software_x11_outbuf_software_xcb_reconfigure(Outbuf *buf, - int w, - int h, - int rot, - Outbuf_Depth depth) -{ - if ((w == buf->w) && (h == buf->h) && - (rot == buf->rot) && (depth == buf->depth)) - return; - buf->w = w; - buf->h = h; - buf->rot = rot; - if (buf->priv.back_buf) - { - evas_common_image_free(buf->priv.back_buf); - buf->priv.back_buf = NULL; - } - if (buf->priv.x.conn) - { - if (buf->priv.x.depth < 24) - buf->priv.back_buf = evas_common_image_create(buf->w, buf->h); - } -} - -int -evas_software_x11_outbuf_software_xcb_get_width(Outbuf * buf) -{ - return buf->w; -} - -int -evas_software_x11_outbuf_software_xcb_get_height(Outbuf * buf) -{ - return buf->h; -} - -Outbuf_Depth -evas_software_x11_outbuf_software_xcb_get_depth(Outbuf * buf) -{ - return buf->depth; -} - -int -evas_software_x11_outbuf_software_xcb_get_rot(Outbuf * buf) -{ - return buf->rot; -} - -int -evas_software_x11_outbuf_software_xcb_get_have_backbuf(Outbuf * buf) -{ - if (buf->priv.back_buf) - return 1; - return 0; -} - -void -evas_software_x11_outbuf_software_xcb_set_have_backbuf(Outbuf *buf, - int have_backbuf) -{ - if (buf->priv.back_buf) - { - if (have_backbuf) - return; - evas_common_image_free(buf->priv.back_buf); - buf->priv.back_buf = NULL; - } - else - { - if (!have_backbuf) - return; - if (buf->priv.x.conn) - { - if (buf->priv.x.depth < 24) - buf->priv.back_buf = evas_common_image_create(buf->w, buf->h); - } - } -} - -void -evas_software_x11_outbuf_software_xcb_drawable_set(Outbuf *buf, - XCBDRAWABLE draw) -{ - CARD32 gcv; - - if (buf->priv.x.win.window.xid == draw.window.xid) - return; - - if (buf->priv.x.gc.xid) - { - XCBFreeGC(buf->priv.x.conn, buf->priv.x.gc); - buf->priv.x.gc.xid = 0; - } - - buf->priv.x.win.window = draw.window; - buf->priv.x.gc = XCBGCONTEXTNew(buf->priv.x.conn); - XCBCreateGC(buf->priv.x.conn, buf->priv.x.gc, buf->priv.x.win, 0, &gcv); -} - -void -evas_software_x11_outbuf_software_xcb_mask_set(Outbuf *buf, - XCBDRAWABLE mask) -{ - CARD32 gcv; - - if (buf->priv.x.mask.pixmap.xid == mask.pixmap.xid) - return; - - if (buf->priv.x.gcm.xid) - { - XCBFreeGC(buf->priv.x.conn, buf->priv.x.gcm); - buf->priv.x.gcm.xid = 0; - } - - buf->priv.x.mask.pixmap = mask.pixmap; - if (buf->priv.x.mask.pixmap.xid) { - buf->priv.x.gcm = XCBGCONTEXTNew(buf->priv.x.conn); - XCBCreateGC(buf->priv.x.conn, buf->priv.x.gcm, buf->priv.x.mask, 0, &gcv); - } -} - -void -evas_software_x11_outbuf_software_xcb_debug_set(Outbuf *buf, - int debug) -{ - buf->priv.debug = debug; -} - -void -evas_software_x11_outbuf_software_xcb_debug_show(Outbuf *buf, - XCBDRAWABLE draw, - int x, - int y, - int w, - int h) -{ - int i; - XCBSCREEN *screen; - - { - XCBGetGeometryRep *geom; - XCBDRAWABLE root; - XCBSCREENIter i; - int cur; - - geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, draw), 0); - root.window = geom->root; - free (geom); - geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, root), 0); - - i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(buf->priv.x.conn)); - for (cur = 0; cur < i.rem; XCBSCREENNext(&i), ++cur) - if (i.data->root.xid == geom->root.xid) - { - screen = i.data; - break; - } - free (geom); - } - for (i = 0; i < 10; i++) - { - XCBImage *image; - XCBRECTANGLE rect = { x, y, w, h}; - CARD32 mask; - CARD32 value[2]; - - mask = GCForeground | GCGraphicsExposures; - value[0] = screen->black_pixel; - value[1] = 0; /* no graphics exposures */ - XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); - XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); - XCBSync(buf->priv.x.conn, 0); - image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, 0xffffffff, ZPixmap); - if (image) - XCBImageDestroy(image); - XCBSync(buf->priv.x.conn, 0); - mask = GCForeground | GCGraphicsExposures; - value[0] = screen->white_pixel; - value[1] = 0; /* no graphics exposures */ - XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); - XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); - XCBSync(buf->priv.x.conn, 0); - image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, 0xffffffff, ZPixmap); - if (image) - XCBImageDestroy(image); - XCBSync(buf->priv.x.conn, 0); - } -} diff --git a/legacy/evas/src/lib/engines/software_xcb/evas_xcb_buffer.c b/legacy/evas/src/lib/engines/software_xcb/evas_xcb_buffer.c index 2e250837b2..0c10e22f98 100644 --- a/legacy/evas/src/lib/engines/software_xcb/evas_xcb_buffer.c +++ b/legacy/evas/src/lib/engines/software_xcb/evas_xcb_buffer.c @@ -1,37 +1,45 @@ #include "evas_common.h" #include "evas_engine.h" -#include -#include -#include -#include - -struct _Xcb_Output_Buffer -{ - XCBConnection *connection; - XCBImage *image; - XCBShmSegmentInfo *shm_info; - void *data; -}; - static int _xcb_err = 0; void -evas_software_x11_x_software_xcb_write_mask_line(Xcb_Output_Buffer *xcbob, - DATA32 *src, - int w, - int y) +evas_software_xcb_x_write_mask_line(Xcb_Output_Buffer *xcbob, + DATA32 *src, + int w, + int y) { - int x; + int x; + DATA32 *src_ptr; + DATA8 *dst_ptr; + int bpl = 0; - for (x = 0; x < w; x++) - { - XCBImagePutPixel(xcbob->image, x, y, A_VAL(&(src[x])) >> 7); - } + src_ptr = src; + dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl); + dst_ptr = dst_ptr + (bpl * y); + for (x = 0; x < w; x += 8) + { + *dst_ptr = + ((A_VAL(&(src_ptr[0])) >> 7) << 0) | + ((A_VAL(&(src_ptr[1])) >> 7) << 1) | + ((A_VAL(&(src_ptr[2])) >> 7) << 2) | + ((A_VAL(&(src_ptr[3])) >> 7) << 3) | + ((A_VAL(&(src_ptr[4])) >> 7) << 4) | + ((A_VAL(&(src_ptr[5])) >> 7) << 5) | + ((A_VAL(&(src_ptr[6])) >> 7) << 6) | + ((A_VAL(&(src_ptr[7])) >> 7) << 7); + src_ptr += 8; + dst_ptr++; + } + for (; x < w; x ++) + { + XCBImagePutPixel(xcbob->image, x, y, A_VAL(src_ptr) >> 7); + src_ptr++; + } } int -evas_software_x11_x_software_xcb_can_do_shm(XCBConnection *c) +evas_software_xcb_x_can_do_shm(XCBConnection *c) { XCBGetGeometryRep *geom; XCBDRAWABLE drawable; @@ -49,15 +57,14 @@ evas_software_x11_x_software_xcb_can_do_shm(XCBConnection *c) { Xcb_Output_Buffer *xcbob; - xcbob = evas_software_x11_x_software_xcb_output_buffer_new(c, - depth, - 16, - 16, - 2, - NULL); - if (!xcbob) - return 0; - evas_software_x11_x_software_xcb_output_buffer_free(xcbob); + xcbob = evas_software_xcb_x_output_buffer_new(c, + depth, + 16, + 16, + 2, + NULL); + if (!xcbob) return 0; + evas_software_xcb_x_output_buffer_free(xcbob, 1); return 1; } return 0; @@ -68,21 +75,19 @@ evas_software_x11_x_software_xcb_can_do_shm(XCBConnection *c) */ /* static void */ -/* x_software_x11_output_tmp_x11_err(XCBConnection *c, XErrorEvent * ev) */ +/* x_output_tmp_xcb_err(XCBConnection *c, XErrorEvent * ev) */ /* { */ /* _xcb_err = 1; */ /* return; */ -/* d = NULL; */ -/* ev = NULL; */ /* } */ Xcb_Output_Buffer * -evas_software_x11_x_software_xcb_output_buffer_new(XCBConnection *c, - int depth, - int w, - int h, - int try_shm, - void *data) +evas_software_xcb_x_output_buffer_new(XCBConnection *c, + int depth, + int w, + int h, + int try_shm, + void *data) { Xcb_Output_Buffer *xcbob; @@ -117,11 +122,12 @@ evas_software_x11_x_software_xcb_output_buffer_new(XCBConnection *c, */ /* XErrorHandler ph; */ +/* EventHandlers eh; */ XCBSync(c, 0); _xcb_err = 0; /* ph = XSetErrorHandler((XErrorHandler) */ -/* x_software_x11_output_tmp_x_err); */ +/* x_output_tmp_x_err); */ XCBShmAttach(c, xcbob->shm_info->shmseg, xcbob->shm_info->shmid, 0); @@ -168,11 +174,12 @@ evas_software_x11_x_software_xcb_output_buffer_new(XCBConnection *c, } void -evas_software_x11_x_software_xcb_output_buffer_free(Xcb_Output_Buffer *xcbob) +evas_software_xcb_x_output_buffer_free(Xcb_Output_Buffer *xcbob, + int sync) { if (xcbob->shm_info) { - XCBSync(xcbob->connection, 0); + if (sync) XCBSync(xcbob->connection, 0); XCBShmDetach(xcbob->connection, xcbob->shm_info->shmseg); XCBImageSHMDestroy(xcbob->image); shmdt(xcbob->shm_info->shmaddr); @@ -188,11 +195,12 @@ evas_software_x11_x_software_xcb_output_buffer_free(Xcb_Output_Buffer *xcbob) } void -evas_software_x11_x_software_xcb_output_buffer_paste(Xcb_Output_Buffer *xcbob, - XCBDRAWABLE d, - XCBGCONTEXT gc, - int x, - int y) +evas_software_xcb_x_output_buffer_paste(Xcb_Output_Buffer *xcbob, + XCBDRAWABLE d, + XCBGCONTEXT gc, + int x, + int y, + int sync) { if (xcbob->shm_info) { @@ -202,30 +210,34 @@ evas_software_x11_x_software_xcb_output_buffer_paste(Xcb_Output_Buffer *xcbob, x, y, xcbob->image->width, xcbob->image->height, 0); - XCBSync(xcbob->connection, 0); + if (sync) XCBSync(xcbob->connection, 0); } else - { - XCBImagePut(xcbob->connection, d, gc, xcbob->image, 0, 0, x, y, xcbob->image->width, xcbob->image->height); - } + XCBImagePut(xcbob->connection, + d, + gc, + xcbob->image, + 0, 0, + x, y, + xcbob->image->width, xcbob->image->height); } DATA8 * -evas_software_x11_x_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, - int *bytes_per_line_ret) +evas_software_xcb_x_output_buffer_data(Xcb_Output_Buffer *xcbob, + int *bytes_per_line_ret) { if (bytes_per_line_ret) *bytes_per_line_ret = xcbob->image->bytes_per_line; return xcbob->image->data; } int -evas_software_x11_x_software_xcb_output_buffer_depth(Xcb_Output_Buffer *xcbob) +evas_software_xcb_x_output_buffer_depth(Xcb_Output_Buffer *xcbob) { return xcbob->image->bits_per_pixel; } int -evas_software_x11_x_software_xcb_output_buffer_byte_order(Xcb_Output_Buffer *xcbob) +evas_software_xcb_x_output_buffer_byte_order(Xcb_Output_Buffer *xcbob) { return xcbob->image->image_byte_order; } diff --git a/legacy/evas/src/lib/engines/software_xcb/evas_xcb_color.c b/legacy/evas/src/lib/engines/software_xcb/evas_xcb_color.c index 40ad314d19..ddd6d8b908 100644 --- a/legacy/evas/src/lib/engines/software_xcb/evas_xcb_color.c +++ b/legacy/evas/src/lib/engines/software_xcb/evas_xcb_color.c @@ -14,32 +14,37 @@ struct _Convert_Pal_Priv typedef DATA8 * (*Xcb_Func_Alloc_Colors) (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static Xcb_Func_Alloc_Colors x_software_xcb_color_alloc[PAL_MODE_LAST + 1]; -static int x_software_xcb_color_count[PAL_MODE_LAST + 1]; +static Xcb_Func_Alloc_Colors x_color_alloc[PAL_MODE_LAST + 1]; +static int x_color_count[PAL_MODE_LAST + 1]; static Evas_List *palettes = NULL; -static DATA8 * x_software_xcb_color_alloc_rgb(int nr, int ng, int nb, XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_gray(int ng, XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb(int nr, int ng, int nb, XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_gray(int ng, XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_rgb_332 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_rgb_666 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_rgb_232 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_rgb_222 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_rgb_221 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_rgb_121 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_rgb_111 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_gray_256 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_gray_64 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_gray_16 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_gray_4 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); -static DATA8 * x_software_xcb_color_alloc_mono (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb_332 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb_666 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb_232 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb_222 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb_221 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb_121 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_rgb_111 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_gray_256 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_gray_64 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_gray_16 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_gray_4 (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); +static DATA8 * x_color_alloc_mono (XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v); static DATA8 * -x_software_xcb_color_alloc_rgb(int nr, int ng, int nb, XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb(int nr, + int ng, + int nb, + XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - int r, g, b, i; + int r, g, b, i; DATA8 *color_lut; - int sig_mask = 0; + int sig_mask = 0; for (i = 0; i < v->bits_per_rgb_value; i++) sig_mask |= (0x1 << i); sig_mask <<= (16 - v->bits_per_rgb_value); @@ -100,7 +105,10 @@ x_software_xcb_color_alloc_rgb(int nr, int ng, int nb, XCBConnection *conn, XCBC } static DATA8 * -x_software_xcb_color_alloc_gray(int ng, XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_gray(int ng, + XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { int g, i; DATA8 *color_lut; @@ -157,132 +165,156 @@ x_software_xcb_color_alloc_gray(int ng, XCBConnection *conn, XCBCOLORMAP cmap, X } static DATA8 * -x_software_xcb_color_alloc_rgb_332(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb_332(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_rgb(8, 8, 4, conn, cmap, v); + return x_color_alloc_rgb(8, 8, 4, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_rgb_666(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb_666(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_rgb(6, 6, 6, conn, cmap, v); + return x_color_alloc_rgb(6, 6, 6, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_rgb_232(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb_232(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_rgb(4, 8, 4, conn, cmap, v); + return x_color_alloc_rgb(4, 8, 4, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_rgb_222(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb_222(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_rgb(4, 4, 4, conn, cmap, v); + return x_color_alloc_rgb(4, 4, 4, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_rgb_221(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb_221(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_rgb(4, 4, 2, conn, cmap, v); + return x_color_alloc_rgb(4, 4, 2, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_rgb_121(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb_121(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_rgb(2, 4, 2, conn, cmap, v); + return x_color_alloc_rgb(2, 4, 2, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_rgb_111(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_rgb_111(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_rgb(2, 2, 2, conn, cmap, v); + return x_color_alloc_rgb(2, 2, 2, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_gray_256(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_gray_256(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_gray(256, conn, cmap, v); + return x_color_alloc_gray(256, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_gray_64(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_gray_64(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_gray(64, conn, cmap, v); + return x_color_alloc_gray(64, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_gray_16(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_gray_16(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_gray(32, conn, cmap, v); + return x_color_alloc_gray(32, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_gray_4(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_gray_4(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_gray(16, conn, cmap, v); + return x_color_alloc_gray(16, conn, cmap, v); } static DATA8 * -x_software_xcb_color_alloc_mono(XCBConnection *conn, XCBCOLORMAP cmap, XCBVISUALTYPE *v) +x_color_alloc_mono(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *v) { - return x_software_xcb_color_alloc_gray(2, conn, cmap, v); + return x_color_alloc_gray(2, conn, cmap, v); } void -x_software_xcb_color_init(void) +evas_software_xcb_x_color_init(void) { static int initialised = 0; if (initialised) return; - x_software_xcb_color_alloc[PAL_MODE_NONE] = NULL; - x_software_xcb_color_count[PAL_MODE_NONE] = 0; + x_color_alloc[PAL_MODE_NONE] = NULL; + x_color_count[PAL_MODE_NONE] = 0; - x_software_xcb_color_alloc[PAL_MODE_MONO] = x_software_xcb_color_alloc_mono; - x_software_xcb_color_count[PAL_MODE_MONO] = 2; + x_color_alloc[PAL_MODE_MONO] = x_color_alloc_mono; + x_color_count[PAL_MODE_MONO] = 2; - x_software_xcb_color_alloc[PAL_MODE_GRAY4] = x_software_xcb_color_alloc_gray_4; - x_software_xcb_color_count[PAL_MODE_GRAY4] = 4; + x_color_alloc[PAL_MODE_GRAY4] = x_color_alloc_gray_4; + x_color_count[PAL_MODE_GRAY4] = 4; - x_software_xcb_color_alloc[PAL_MODE_GRAY16] = x_software_xcb_color_alloc_gray_16; - x_software_xcb_color_count[PAL_MODE_GRAY16] = 16; + x_color_alloc[PAL_MODE_GRAY16] = x_color_alloc_gray_16; + x_color_count[PAL_MODE_GRAY16] = 16; - x_software_xcb_color_alloc[PAL_MODE_GRAY64] = x_software_xcb_color_alloc_gray_64; - x_software_xcb_color_count[PAL_MODE_GRAY64] = 64; + x_color_alloc[PAL_MODE_GRAY64] = x_color_alloc_gray_64; + x_color_count[PAL_MODE_GRAY64] = 64; - x_software_xcb_color_alloc[PAL_MODE_GRAY256] = x_software_xcb_color_alloc_gray_256; - x_software_xcb_color_count[PAL_MODE_GRAY256] = 256; + x_color_alloc[PAL_MODE_GRAY256] = x_color_alloc_gray_256; + x_color_count[PAL_MODE_GRAY256] = 256; - x_software_xcb_color_alloc[PAL_MODE_RGB111] = x_software_xcb_color_alloc_rgb_111; - x_software_xcb_color_count[PAL_MODE_RGB111] = 2 * 2 * 2; + x_color_alloc[PAL_MODE_RGB111] = x_color_alloc_rgb_111; + x_color_count[PAL_MODE_RGB111] = 2 * 2 * 2; - x_software_xcb_color_alloc[PAL_MODE_RGB121] = x_software_xcb_color_alloc_rgb_121; - x_software_xcb_color_count[PAL_MODE_RGB121] = 2 * 4 * 2; + x_color_alloc[PAL_MODE_RGB121] = x_color_alloc_rgb_121; + x_color_count[PAL_MODE_RGB121] = 2 * 4 * 2; - x_software_xcb_color_alloc[PAL_MODE_RGB221] = x_software_xcb_color_alloc_rgb_221; - x_software_xcb_color_count[PAL_MODE_RGB221] = 4 * 4 * 2; + x_color_alloc[PAL_MODE_RGB221] = x_color_alloc_rgb_221; + x_color_count[PAL_MODE_RGB221] = 4 * 4 * 2; - x_software_xcb_color_alloc[PAL_MODE_RGB222] = x_software_xcb_color_alloc_rgb_222; - x_software_xcb_color_count[PAL_MODE_RGB222] = 4 * 4 * 4; + x_color_alloc[PAL_MODE_RGB222] = x_color_alloc_rgb_222; + x_color_count[PAL_MODE_RGB222] = 4 * 4 * 4; - x_software_xcb_color_alloc[PAL_MODE_RGB232] = x_software_xcb_color_alloc_rgb_232; - x_software_xcb_color_count[PAL_MODE_RGB232] = 4 * 8 * 4; + x_color_alloc[PAL_MODE_RGB232] = x_color_alloc_rgb_232; + x_color_count[PAL_MODE_RGB232] = 4 * 8 * 4; - x_software_xcb_color_alloc[PAL_MODE_RGB666] = x_software_xcb_color_alloc_rgb_666; - x_software_xcb_color_count[PAL_MODE_RGB666] = 6 * 6 * 6; + x_color_alloc[PAL_MODE_RGB666] = x_color_alloc_rgb_666; + x_color_count[PAL_MODE_RGB666] = 6 * 6 * 6; - x_software_xcb_color_alloc[PAL_MODE_RGB332] = x_software_xcb_color_alloc_rgb_332; - x_software_xcb_color_count[PAL_MODE_RGB332] = 8 * 8 * 4; + x_color_alloc[PAL_MODE_RGB332] = x_color_alloc_rgb_332; + x_color_count[PAL_MODE_RGB332] = 8 * 8 * 4; - x_software_xcb_color_alloc[PAL_MODE_LAST] = NULL; - x_software_xcb_color_count[PAL_MODE_LAST] = 0; + x_color_alloc[PAL_MODE_LAST] = NULL; + x_color_count[PAL_MODE_LAST] = 0; initialised = 1; } Convert_Pal * -evas_software_x11_x_software_xcb_color_allocate(XCBConnection *conn, - XCBCOLORMAP cmap, - XCBVISUALTYPE *vis, - Convert_Pal_Mode colors) +evas_software_xcb_x_color_allocate(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *vis, + Convert_Pal_Mode colors) { Convert_Pal_Priv *palpriv; Convert_Pal *pal; @@ -305,15 +337,15 @@ evas_software_x11_x_software_xcb_color_allocate(XCBConnection *conn, if (!pal) return NULL; for (c = colors; c > PAL_MODE_NONE; c--) { - if (x_software_xcb_color_alloc[c]) + if (x_color_alloc[c]) { - pal->lookup = (x_software_xcb_color_alloc[c])(conn, cmap, vis); + pal->lookup = (x_color_alloc[c])(conn, cmap, vis); if (pal->lookup) break; } } pal->references = 1; pal->colors = c; - pal->count = x_software_xcb_color_count[c]; + pal->count = x_color_count[c]; palpriv = calloc(1, sizeof(Convert_Pal_Priv)); pal->data = palpriv; if (!palpriv) @@ -336,13 +368,13 @@ evas_software_x11_x_software_xcb_color_allocate(XCBConnection *conn, } void -evas_software_x11_x_software_xcb_color_deallocate(XCBConnection *conn, - XCBCOLORMAP cmap, - XCBVISUALTYPE *vis, - Convert_Pal *pal) +evas_software_xcb_x_color_deallocate(XCBConnection *conn, + XCBCOLORMAP cmap, + XCBVISUALTYPE *vis, + Convert_Pal *pal) { unsigned long pixels[256]; - int j; + int j; pal->references--; if (pal->references > 0) return; diff --git a/legacy/evas/src/lib/engines/software_xcb/evas_xcb_main.c b/legacy/evas/src/lib/engines/software_xcb/evas_xcb_main.c index 3ecbd16388..9cdf9d6333 100644 --- a/legacy/evas/src/lib/engines/software_xcb/evas_xcb_main.c +++ b/legacy/evas/src/lib/engines/software_xcb/evas_xcb_main.c @@ -4,6 +4,6 @@ #include void -evas_software_x11_x_software_xcb_init(void) +evas_software_xcb_x_init(void) { }