add the modifications of raster, fix some potential bug, clean up. It is still a bit slower than xlib

SVN revision: 14787
This commit is contained in:
doursse 2005-05-15 09:30:26 +00:00 committed by doursse
parent 7cc5c95949
commit 3d64123f2c
6 changed files with 914 additions and 1259 deletions

View File

@ -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);
}

View File

@ -2,9 +2,14 @@
#define EVAS_ENGINE_H
#include <X11/XCB/xcb.h>
#include <X11/XCB/shm.h>
#include <X11/XCB/xcb_image.h>
#include <sys/ipc.h>
#include <sys/shm.h>
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 */

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +1,45 @@
#include "evas_common.h"
#include "evas_engine.h"
#include <X11/XCB/shm.h>
#include <X11/XCB/xcb_image.h>
#include <sys/ipc.h>
#include <sys/shm.h>
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;
}

View File

@ -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;

View File

@ -4,6 +4,6 @@
#include <X11/XCB/xcb.h>
void
evas_software_x11_x_software_xcb_init(void)
evas_software_xcb_x_init(void)
{
}