don't use X.h constants, but XCB ones. fix the last leak. fix potential bugs. The last version of xcb is needed

SVN revision: 22445
This commit is contained in:
doursse 2006-05-02 22:00:51 +00:00 committed by doursse
parent c80dfaaf01
commit 9825d3dbd3
6 changed files with 137 additions and 95 deletions

View File

@ -18,16 +18,16 @@ struct _Evas_Engine_Info_Software_Xcb
XCBDRAWABLE mask; XCBDRAWABLE mask;
XCBVISUALTYPE *visual; XCBVISUALTYPE *visual;
XCBCOLORMAP colormap; XCBCOLORMAP colormap;
int depth; int depth;
int rotation; int rotation;
int alloc_grayscale : 1; int alloc_grayscale : 1;
int debug : 1; int debug : 1;
int shape_dither : 1; int shape_dither : 1;
int destination_alpha : 1; int destination_alpha : 1;
int track_mask_changes : 1; int track_mask_changes : 1;
int alloc_colors_max; int alloc_colors_max;
} info; } info;
/* engine specific function calls to query stuff about the destination */ /* engine specific function calls to query stuff about the destination */
/* engine (what visual & colormap & depth to use, performance info etc. */ /* engine (what visual & colormap & depth to use, performance info etc. */

View File

@ -121,7 +121,7 @@ _output_setup(int w,
static XCBVISUALTYPE * static XCBVISUALTYPE *
_best_visual_get(XCBConnection *conn, int screen) _best_visual_get(XCBConnection *conn, int screen)
{ {
XCBSCREEN *scr; XCBSCREEN *scr;
if (!conn) return NULL; if (!conn) return NULL;
scr = XCBAuxGetScreen(conn, screen); scr = XCBAuxGetScreen(conn, screen);
@ -133,7 +133,7 @@ _best_visual_get(XCBConnection *conn, int screen)
static XCBCOLORMAP static XCBCOLORMAP
_best_colormap_get(XCBConnection *conn, int screen) _best_colormap_get(XCBConnection *conn, int screen)
{ {
XCBSCREEN *scr; XCBSCREEN *scr;
XCBCOLORMAP c; XCBCOLORMAP c;
c.xid = 0; c.xid = 0;
@ -271,7 +271,7 @@ eng_setup(Evas *e, void *in)
info->info.visual, info->info.visual,
info->info.colormap, info->info.colormap,
info->info.depth, info->info.depth,
evas_software_xcb_outbuf_perf_restore_x(info->info.conn, info->info.drawable, info->info.visual, info->info.colormap, info->info.depth), evas_software_xcb_outbuf_perf_restore_x(info->info.conn, info->info.drawable, info->info.visual, info->info.colormap, info->info.depth),
info->info.alloc_grayscale, info->info.alloc_grayscale,
info->info.alloc_colors_max, info->info.alloc_colors_max,
info->info.mask, info->info.mask,

View File

@ -4,8 +4,9 @@
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#define X_H /* make sure we aren't using symbols from X.h */
#include <X11/XCB/xcb.h> #include <X11/XCB/xcb.h>
#include <X11/XCB/shm.h>
#include <X11/XCB/xcb_aux.h> #include <X11/XCB/xcb_aux.h>
#include <X11/XCB/xcb_image.h> #include <X11/XCB/xcb_image.h>
@ -48,6 +49,7 @@ struct _Outbuf
XCBGCONTEXT gc; XCBGCONTEXT gc;
XCBGCONTEXT gcm; XCBGCONTEXT gcm;
int swap : 1; int swap : 1;
unsigned char bit_swap : 1;
} x; } x;
struct { struct {
DATA32 r, g, b; DATA32 r, g, b;
@ -113,7 +115,8 @@ struct _Xcb_Output_Buffer
void evas_software_xcb_x_init (void); void evas_software_xcb_x_init (void);
/* buffer */ /* buffer */
void evas_software_xcb_x_write_mask_line (Xcb_Output_Buffer *xcbob, void evas_software_xcb_x_write_mask_line (Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src, DATA32 *src,
int w, int w,
int y); int y);
@ -136,6 +139,7 @@ DATA8 *evas_software_xcb_x_output_buffer_data (Xcb_Output_Buffe
int *bytes_per_line_ret); int *bytes_per_line_ret);
int evas_software_xcb_x_output_buffer_depth (Xcb_Output_Buffer *xcbob); 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); int evas_software_xcb_x_output_buffer_byte_order(Xcb_Output_Buffer *xcbob);
int evas_software_xcb_x_output_buffer_bit_order (Xcb_Output_Buffer *xcbob);
/* color */ /* color */

View File

@ -87,13 +87,18 @@ evas_software_xcb_outbuf_setup_x(int w,
if (xcbob) if (xcbob)
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == LSBFirst) if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == XCBImageOrderLSBFirst)
buf->priv.x.swap = 1; buf->priv.x.swap = 1;
if (evas_software_xcb_x_output_buffer_bit_order(xcbob) == XCBImageOrderLSBFirst)
buf->priv.x.bit_swap = 1;
#else #else
if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == MSBFirst) if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == XCBImageOrderMSBFirst)
buf->priv.x.swap = 1; buf->priv.x.swap = 1;
if (evas_software_xcb_x_output_buffer_bit_order(xcbob) == XCBImageOrderMSBFirst)
buf->priv.x.bit_swap = 1;
#endif #endif
if ((vis->_class == TrueColor) || (vis->_class == DirectColor)) if ((vis->_class == XCBVisualClassTrueColor) ||
(vis->_class == XCBVisualClassDirectColor))
{ {
buf->priv.mask.r = (DATA32) vis->red_mask; buf->priv.mask.r = (DATA32) vis->red_mask;
buf->priv.mask.g = (DATA32) vis->green_mask; buf->priv.mask.g = (DATA32) vis->green_mask;
@ -105,13 +110,15 @@ evas_software_xcb_outbuf_setup_x(int w,
SWAP32(buf->priv.mask.b); SWAP32(buf->priv.mask.b);
} }
} }
else if ((vis->_class == PseudoColor) || else if ((vis->_class == XCBVisualClassStaticGray) ||
(vis->_class == StaticColor) || (vis->_class == XCBVisualClassGrayScale) ||
(vis->_class == GrayScale) || (vis->_class == StaticGray)) (vis->_class == XCBVisualClassStaticColor) ||
(vis->_class == XCBVisualClassPseudoColor))
{ {
Convert_Pal_Mode pm = PAL_MODE_RGB332; Convert_Pal_Mode pm = PAL_MODE_RGB332;
if ((vis->_class == GrayScale) || (vis->_class == StaticGray)) if ((vis->_class == XCBVisualClassGrayScale) ||
(vis->_class == XCBVisualClassStaticGray))
grayscale = 1; grayscale = 1;
if (grayscale) if (grayscale)
{ {
@ -492,8 +499,8 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf,
conv_func(src_data, data, conv_func(src_data, data,
0, 0,
bpl / bpl /
((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / ((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / 8)) - obr->w,
8)) - obr->w, obr->w, obr->h, x, y, obr->w, obr->h, x, y,
buf->priv.pal->lookup); buf->priv.pal->lookup);
} }
else else
@ -504,8 +511,8 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf,
conv_func(src_data, data, conv_func(src_data, data,
0, 0,
bpl / bpl /
((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / ((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / 8)) - obr->w,
8)) - obr->w, obr->w, obr->h, x, y, NULL); obr->w, obr->h, x, y, NULL);
/* FIXME: this is evil - but it makes ARGB targets look correct */ /* FIXME: this is evil - but it makes ARGB targets look correct */
if ((buf->priv.destination_alpha) && (!obr->mxcbob) && if ((buf->priv.destination_alpha) && (!obr->mxcbob) &&
(evas_software_xcb_x_output_buffer_depth(obr->xcbob) == 32)) (evas_software_xcb_x_output_buffer_depth(obr->xcbob) == 32))
@ -531,9 +538,10 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf,
if (obr->mxcbob) if (obr->mxcbob)
{ {
for (yy = 0; yy < obr->h; yy++) for (yy = 0; yy < obr->h; yy++)
evas_software_xcb_x_write_mask_line(obr->mxcbob, evas_software_xcb_x_write_mask_line(buf,
src_data + obr->mxcbob,
(yy * obr->w), obr->w, yy); src_data + (yy * obr->w),
obr->w, yy);
} }
} }
@ -637,7 +645,7 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
free (geom); free (geom);
geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, root), 0); geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, root), 0);
i = XCBConnSetupSuccessRepRootsIter((XCBConnSetupSuccessRep *)XCBGetSetup(buf->priv.x.conn)); i = XCBSetupRootsIter((XCBSetup *)XCBGetSetup(buf->priv.x.conn));
for (; i.rem; XCBSCREENNext(&i)) for (; i.rem; XCBSCREENNext(&i))
if (i.data->root.xid == geom->root.xid) if (i.data->root.xid == geom->root.xid)
{ {
@ -653,23 +661,23 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
CARD32 mask; CARD32 mask;
CARD32 value[2]; CARD32 value[2];
mask = GCForeground | GCGraphicsExposures; mask = XCBGCForeground | XCBGCGraphicsExposures;
value[0] = screen->black_pixel; value[0] = screen->black_pixel;
value[1] = 0; /* no graphics exposures */ value[1] = XCBExposuresNotAllowed; /* no graphics exposures allowed */
XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value);
XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect);
XCBSync(buf->priv.x.conn, 0); XCBSync(buf->priv.x.conn, 0);
image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, 0xffffffff, ZPixmap); image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, XCBAllPlanes, XCBImageFormatZPixmap);
if (image) if (image)
XCBImageDestroy(image); XCBImageDestroy(image);
XCBSync(buf->priv.x.conn, 0); XCBSync(buf->priv.x.conn, 0);
mask = GCForeground | GCGraphicsExposures; mask = XCBGCForeground | XCBGCGraphicsExposures;
value[0] = screen->white_pixel; value[0] = screen->white_pixel;
value[1] = 0; /* no graphics exposures */ value[1] = XCBExposuresNotAllowed; /* no graphics exposures allowed */
XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value);
XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect);
XCBSync(buf->priv.x.conn, 0); XCBSync(buf->priv.x.conn, 0);
image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, 0xffffffff, ZPixmap); image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, XCBAllPlanes, XCBImageFormatZPixmap);
if (image) if (image)
XCBImageDestroy(image); XCBImageDestroy(image);
XCBSync(buf->priv.x.conn, 0); XCBSync(buf->priv.x.conn, 0);
@ -755,7 +763,8 @@ evas_software_xcb_outbuf_perf_new_x(XCBConnection *conn,
perf->x.conn = conn; perf->x.conn = conn;
root.window = XCBConnSetupSuccessRepRootsIter ((XCBConnSetupSuccessRep *)XCBGetSetup (conn)).data->root; /* FIXME: should use the default screen */
root.window = XCBSetupRootsIter ((XCBSetup *)XCBGetSetup (conn)).data->root;
if (draw.window.xid) if (draw.window.xid)
{ {
XCBGetGeometryRep *geom; XCBGetGeometryRep *geom;
@ -770,7 +779,7 @@ evas_software_xcb_outbuf_perf_new_x(XCBConnection *conn,
perf->x.h = (int)geom->height; perf->x.h = (int)geom->height;
perf->x.screen_num = 0; perf->x.screen_num = 0;
i = XCBConnSetupSuccessRepRootsIter((XCBConnSetupSuccessRep *)XCBGetSetup(conn)); i = XCBSetupRootsIter((XCBSetup *)XCBGetSetup(conn));
for (cur = 0; i.rem; XCBSCREENNext(&i), ++cur) for (cur = 0; i.rem; XCBSCREENNext(&i), ++cur)
if (i.data->root.xid == geom->root.xid) if (i.data->root.xid == geom->root.xid)
{ {
@ -782,11 +791,11 @@ evas_software_xcb_outbuf_perf_new_x(XCBConnection *conn,
perf->x.root = root; perf->x.root = root;
perf->x.display = strdup (":0"); /* FIXME: strdup(DisplayString(disp)); in XCB ? */ perf->x.display = strdup (":0"); /* FIXME: strdup(DisplayString(disp)); in XCB ? */
perf->x.vendor = strdup(XCBConnSetupSuccessRepVendor((XCBConnSetupSuccessRep *)XCBGetSetup(conn))); perf->x.vendor = strdup(XCBSetupVendor((XCBSetup *)XCBGetSetup(conn)));
perf->x.version = (int)((XCBConnSetupSuccessRep *)XCBGetSetup(conn))->protocol_major_version; perf->x.version = (int)((XCBSetup *)XCBGetSetup(conn))->protocol_major_version;
perf->x.revision = (int)((XCBConnSetupSuccessRep *)XCBGetSetup(conn))->protocol_minor_version; perf->x.revision = (int)((XCBSetup *)XCBGetSetup(conn))->protocol_minor_version;
perf->x.release = (int)((XCBConnSetupSuccessRep *)XCBGetSetup(conn))->release_number; perf->x.release = (int)((XCBSetup *)XCBGetSetup(conn))->release_number;
perf->x.screen_count = XCBConnSetupSuccessRepRootsIter((XCBConnSetupSuccessRep *)XCBGetSetup(conn)).rem; perf->x.screen_count = XCBSetupRootsIter((XCBSetup *)XCBGetSetup(conn)).rem;
perf->x.depth = x_depth; perf->x.depth = x_depth;
perf->min_shm_image_pixel_count = 200 * 200; /* default hard-coded */ perf->min_shm_image_pixel_count = 200 * 200; /* default hard-coded */
@ -911,10 +920,10 @@ evas_software_xcb_outbuf_perf_store_x(Outbuf_Perf *perf)
format = STRING; format = STRING;
str = evas_software_xcb_outbuf_perf_serialize_x(perf); str = evas_software_xcb_outbuf_perf_serialize_x(perf);
XCBChangeProperty(perf->x.conn, PropModeReplace, perf->x.root.window, XCBChangeProperty(perf->x.conn, XCBPropModeReplace, perf->x.root.window,
type, format, 8, type, format, 8,
strlen(str), str); strlen(str), str);
/* XSync(perf->x.disp, False); */ XCBSync(perf->x.conn, 0);
free(str); free(str);
free (rep); free (rep);
} }
@ -943,8 +952,12 @@ evas_software_xcb_outbuf_perf_restore_x(XCBConnection *conn,
strlen (type_str), strlen (type_str),
type_str), type_str),
NULL); NULL);
if (!type_rep)
return perf;
type = type_rep->atom; type = type_rep->atom;
format = STRING; format = STRING;
free(type_rep);
cookie = XCBGetProperty(conn, 0, perf->x.root.window, cookie = XCBGetProperty(conn, 0, perf->x.root.window,
type, format, type, format,
@ -994,21 +1007,22 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
XCBDRAWABLE win; XCBDRAWABLE win;
CARD32 mask; CARD32 mask;
CARD32 value[7]; CARD32 value[7];
CARD32 value2[1];
int w, h; int w, h;
int do_shm = 0; int do_shm = 0;
perf = evas_software_xcb_outbuf_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 | mask = XCBCWBackPixmap | XCBCWBorderPixel |
CWBackPixmap | CWBorderPixel | XCBCWBitGravity | XCBCWBackingStore |
CWBitGravity | CWEventMask | CWOverrideRedirect; XCBCWOverrideRedirect | XCBCWEventMask | XCBCWColormap;
value[0] = Always; value[0] = XCBBackPixmapNone;
value[1] = cmap.xid; value[1] = 0;
value[2] = None; value[2] = XCBGravityBitForget;
value[3] = 0; value[3] = XCBBackingStoreAlways;
value[4] = ForgetGravity; value[4] = 1;
value[5] = 0; value[5] = XCBEventMaskNoEvent;
value[6] = 1; value[6] = cmap.xid;
w = perf->x.w; w = perf->x.w;
h = perf->x.h; h = perf->x.h;
win.window = XCBWINDOWNew (conn); win.window = XCBWINDOWNew (conn);
@ -1017,11 +1031,14 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
0, 0, 0, 0,
w, h, w, h,
0, 0,
InputOutput, XCBWindowClassInputOutput,
vis->visual_id, vis->visual_id,
mask, value); mask, value);
XCBSync(conn, 0); XCBSync(conn, 0);
XCBMapWindow (conn, win.window); mask = XCBConfigWindowStackMode;
value[0] = XCBStackModeAbove;
XCBConfigureWindow (conn, win.window, mask, value2);
/* XCBMapWindow (conn, win.window); */
do_shm = evas_software_xcb_x_can_do_shm(conn); do_shm = evas_software_xcb_x_can_do_shm(conn);
@ -1032,7 +1049,6 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
{ {
Xcb_Output_Buffer *xcbob; Xcb_Output_Buffer *xcbob;
XCBGCONTEXT gc; XCBGCONTEXT gc;
CARD32 gcv;
int i; int i;
int max; int max;
int error; int error;
@ -1044,7 +1060,7 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
if (w > h) if (w > h)
max = h; max = h;
gc = XCBGCONTEXTNew (conn); gc = XCBGCONTEXTNew (conn);
XCBCreateGC (conn, gc, win, 0, &gcv); XCBCreateGC (conn, gc, win, 0, NULL);
for (i = 16; i < max; i += 16) for (i = 16; i < max; i += 16)
{ {
int l; int l;

View File

@ -4,7 +4,8 @@
static int _xcb_err = 0; static int _xcb_err = 0;
void void
evas_software_xcb_x_write_mask_line(Xcb_Output_Buffer *xcbob, evas_software_xcb_x_write_mask_line(Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src, DATA32 *src,
int w, int w,
int y) int y)
@ -17,20 +18,40 @@ evas_software_xcb_x_write_mask_line(Xcb_Output_Buffer *xcbob,
src_ptr = src; src_ptr = src;
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl); dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
dst_ptr = dst_ptr + (bpl * y); dst_ptr = dst_ptr + (bpl * y);
for (x = 0; x < w; x += 8) if (buf->priv.x.bit_swap)
{ {
*dst_ptr = for (x = 0; x < w; x += 8)
((A_VAL(&(src_ptr[0])) >> 7) << 0) | {
((A_VAL(&(src_ptr[1])) >> 7) << 1) | *dst_ptr =
((A_VAL(&(src_ptr[2])) >> 7) << 2) | ((A_VAL(&(src_ptr[0])) >> 7) << 7) |
((A_VAL(&(src_ptr[3])) >> 7) << 3) | ((A_VAL(&(src_ptr[1])) >> 7) << 6) |
((A_VAL(&(src_ptr[4])) >> 7) << 4) | ((A_VAL(&(src_ptr[2])) >> 7) << 5) |
((A_VAL(&(src_ptr[5])) >> 7) << 5) | ((A_VAL(&(src_ptr[3])) >> 7) << 4) |
((A_VAL(&(src_ptr[6])) >> 7) << 6) | ((A_VAL(&(src_ptr[4])) >> 7) << 3) |
((A_VAL(&(src_ptr[7])) >> 7) << 7); ((A_VAL(&(src_ptr[5])) >> 7) << 2) |
src_ptr += 8; ((A_VAL(&(src_ptr[6])) >> 7) << 1) |
dst_ptr++; ((A_VAL(&(src_ptr[7])) >> 7) << 0);
} src_ptr += 8;
dst_ptr++;
}
}
else
{
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 ++) for (; x < w; x ++)
{ {
XCBImagePutPixel(xcbob->image, x, y, A_VAL(src_ptr) >> 7); XCBImagePutPixel(xcbob->image, x, y, A_VAL(src_ptr) >> 7);
@ -45,7 +66,7 @@ evas_software_xcb_x_can_do_shm(XCBConnection *c)
XCBDRAWABLE drawable; XCBDRAWABLE drawable;
int depth; int depth;
drawable.window = XCBConnSetupSuccessRepRootsIter (XCBGetSetup(c)).data->root; drawable.window = XCBSetupRootsIter (XCBGetSetup(c)).data->root;
geom = XCBGetGeometryReply (c, XCBGetGeometry(c, drawable), 0); geom = XCBGetGeometryReply (c, XCBGetGeometry(c, drawable), 0);
if(!geom) if(!geom)
return 0; return 0;
@ -100,16 +121,11 @@ evas_software_xcb_x_output_buffer_new(XCBConnection *c,
if (try_shm > 0) if (try_shm > 0)
{ {
const XCBQueryExtensionRep *rep;
rep = XCBGetExtensionData(c, &XCBShmId);
if (rep && rep->present)
{
xcbob->shm_info = malloc(sizeof(XCBShmSegmentInfo)); xcbob->shm_info = malloc(sizeof(XCBShmSegmentInfo));
if (xcbob->shm_info) if (xcbob->shm_info)
{ {
xcbob->shm_info->shmseg = XCBShmSEGNew(c); xcbob->shm_info->shmseg = XCBShmSEGNew(c);
xcbob->image = XCBImageSHMCreate(c, depth, ZPixmap, NULL, w, h); xcbob->image = XCBImageSHMCreate(c, depth, XCBImageFormatZPixmap, NULL, w, h);
if (xcbob->image) if (xcbob->image)
{ {
xcbob->shm_info->shmid = shmget(IPC_PRIVATE, xcbob->shm_info->shmid = shmget(IPC_PRIVATE,
@ -152,12 +168,11 @@ evas_software_xcb_x_output_buffer_new(XCBConnection *c,
if (xcbob->shm_info) free(xcbob->shm_info); if (xcbob->shm_info) free(xcbob->shm_info);
xcbob->shm_info = NULL; xcbob->shm_info = NULL;
} }
}
} }
if (try_shm > 1) return NULL; if (try_shm > 1) return NULL;
xcbob->image = XCBImageCreate(c, depth, ZPixmap, 0, data, w, h, 32, 0); xcbob->image = XCBImageCreate(c, depth, XCBImageFormatZPixmap, 0, data, w, h, 32, 0);
if (!xcbob->image) if (!xcbob->image)
{ {
free(xcbob); free(xcbob);
@ -247,3 +262,9 @@ evas_software_xcb_x_output_buffer_byte_order(Xcb_Output_Buffer *xcbob)
{ {
return xcbob->image->image_byte_order; return xcbob->image->image_byte_order;
} }
int
evas_software_xcb_x_output_buffer_bit_order(Xcb_Output_Buffer *xcbob)
{
return xcbob->image->bitmap_format_bit_order;
}

View File

@ -51,6 +51,7 @@ x_color_alloc_rgb(int nr,
i = 0; i = 0;
color_lut = malloc((nr) * (ng) * (nb)); color_lut = malloc((nr) * (ng) * (nb));
if (!color_lut) return NULL; if (!color_lut) return NULL;
/* FIXME: remove the round-trip */
for (r = 0; r < (nr); r++) for (r = 0; r < (nr); r++)
{ {
for (g = 0; g < (ng); g++) for (g = 0; g < (ng); g++)
@ -63,11 +64,11 @@ x_color_alloc_rgb(int nr,
XCBAllocColorRep *rep; XCBAllocColorRep *rep;
val = (int)((((double)r) / ((nr) - 1)) * 65535); val = (int)((((double)r) / ((nr) - 1)) * 65535);
xcl.red = (unsigned short)(val); xcl.red = (CARD16)(val);
val = (int)((((double)g) / ((ng) - 1)) * 65535); val = (int)((((double)g) / ((ng) - 1)) * 65535);
xcl.green = (unsigned short)(val); xcl.green = (CARD16)(val);
val = (int)((((double)b) / ((nb) - 1)) * 65535); val = (int)((((double)b) / ((nb) - 1)) * 65535);
xcl.blue = (unsigned short)(val); xcl.blue = (CARD16)(val);
xcl_in = xcl; xcl_in = xcl;
rep = XCBAllocColorReply(conn, rep = XCBAllocColorReply(conn,
XCBAllocColor(conn, cmap, XCBAllocColor(conn, cmap,
@ -83,13 +84,13 @@ x_color_alloc_rgb(int nr,
((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) || ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask))) ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask)))
{ {
unsigned long pixels[256]; CARD32 pixels[256];
int j; int j;
if (i > 0) if (i > 0)
{ {
for(j = 0; j < i; j++) for(j = 0; j < i; j++)
pixels[j] = (unsigned long)color_lut[j]; pixels[j] = (CARD32)color_lut[j];
XCBFreeColors(conn, cmap, 0, i, pixels); XCBFreeColors(conn, cmap, 0, i, pixels);
} }
free(color_lut); free(color_lut);
@ -127,9 +128,9 @@ x_color_alloc_gray(int ng,
XCBAllocColorRep *rep; XCBAllocColorRep *rep;
val = (int)((((double)g) / ((ng) - 1)) * 65535); val = (int)((((double)g) / ((ng) - 1)) * 65535);
xcl.red = (unsigned short)(val); xcl.red = (CARD16)(val);
xcl.green = (unsigned short)(val); xcl.green = (CARD16)(val);
xcl.blue = (unsigned short)(val); xcl.blue = (CARD16)(val);
xcl_in = xcl; xcl_in = xcl;
rep = XCBAllocColorReply(conn, rep = XCBAllocColorReply(conn,
XCBAllocColor(conn, cmap, XCBAllocColor(conn, cmap,
@ -145,19 +146,19 @@ x_color_alloc_gray(int ng,
((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) || ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask))) ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask)))
{ {
unsigned long pixels[256]; CARD32 pixels[256];
int j; int j;
if (i > 0) if (i > 0)
{ {
for(j = 0; j < i; j++) for(j = 0; j < i; j++)
pixels[j] = (unsigned long) color_lut[j]; pixels[j] = (CARD32) color_lut[j];
XCBFreeColors(conn, cmap, 0, i, pixels); XCBFreeColors(conn, cmap, 0, i, pixels);
} }
free(color_lut); free(color_lut);
return NULL; return NULL;
} }
color_lut[i] = xcl.pixel; color_lut[i] = rep->pixel;
i++; i++;
free(rep); free(rep);
} }
@ -373,15 +374,15 @@ evas_software_xcb_x_color_deallocate(XCBConnection *conn,
XCBVISUALTYPE *vis, XCBVISUALTYPE *vis,
Convert_Pal *pal) Convert_Pal *pal)
{ {
unsigned long pixels[256]; CARD32 pixels[256];
int j; int j;
pal->references--; pal->references--;
if (pal->references > 0) return; if (pal->references > 0) return;
if (pal->lookup) if (pal->lookup)
{ {
for(j = 0; j < pal->count; j++) for(j = 0; j < pal->count; j++)
pixels[j] = (unsigned long) pal->lookup[j]; pixels[j] = (CARD32) pal->lookup[j];
XCBFreeColors(conn, cmap, 0, pal->count, pixels); XCBFreeColors(conn, cmap, 0, pal->count, pixels);
free(pal->lookup); free(pal->lookup);
} }