forked from enlightenment/efl
fix xrender xcb engine, add old stuff committed to the Xlib engines and not to the XCB ones, replace deprecated XCBSync call by a call of GetInputFocus, fix some round trips but a complete review of the engines must be done to fix them all, first part of a cleanup, first part of XCB error management
SVN revision: 25657
This commit is contained in:
parent
d24318ed7f
commit
e96c6828d0
|
@ -184,10 +184,8 @@ ENGINE_SOFTWARE_XCB_PRG="";
|
|||
PKG_CHECK_MODULES(
|
||||
XCB,
|
||||
xcb xcb-shm xcb-image xcb-icccm,
|
||||
[AC_CHECK_HEADER(
|
||||
X11/X.h,
|
||||
[have_evas_software_xcb="yes"],
|
||||
[have_evas_software_xcb="no"])],
|
||||
[have_evas_software_xcb="yes"],
|
||||
[have_evas_software_xcb="no"],
|
||||
[ have_evas_software_xcb="no" ])
|
||||
|
||||
## manually disable xcb engine by default - not auto detected.
|
||||
|
@ -207,8 +205,6 @@ AC_ARG_ENABLE(software-xcb, AC_HELP_STRING([--enable-software-xcb],[enable the S
|
|||
]
|
||||
)
|
||||
if test "x$have_evas_software_xcb" = "xyes"; then
|
||||
AC_PATH_XTRA
|
||||
|
||||
PKG_CHECK_MODULES(
|
||||
XCB,
|
||||
xcb xcb-shm xcb-aux xcb-image xcb-icccm,
|
||||
|
@ -564,10 +560,8 @@ ENGINE_XRENDER_XCB_PRG="";
|
|||
PKG_CHECK_MODULES(
|
||||
XCBRENDER,
|
||||
xcb xcb-shm xcb-render xcb-image xcb-icccm,
|
||||
[AC_CHECK_HEADER(
|
||||
X11/X.h,
|
||||
[have_evas_xrender_xcb="yes"],
|
||||
[have_evas_xrender_xcb="no"])],
|
||||
[have_evas_xrender_xcb="yes"],
|
||||
[have_evas_xrender_xcb="no"],
|
||||
[ have_evas_xrender_xcb="no" ])
|
||||
|
||||
## manually disable xcb engine by default - not auto detected.
|
||||
|
@ -587,8 +581,6 @@ AC_ARG_ENABLE(xrender-xcb, [ --enable-xrender-xcb enable the Xrender
|
|||
]
|
||||
)
|
||||
if test "x$have_evas_xrender_xcb" = "xyes"; then
|
||||
AC_PATH_XTRA
|
||||
|
||||
PKG_CHECK_MODULES(
|
||||
XCBRENDER,
|
||||
xcb xcb-shm xcb-render xcb-image xcb-icccm,
|
||||
|
|
|
@ -98,6 +98,7 @@ main(int argc, char **argv)
|
|||
int pause_me = 0;
|
||||
XCBConnection *conn;
|
||||
const XCBQueryExtensionRep *rep_shm;
|
||||
XCBGetInputFocusRep *reply;
|
||||
XCBSCREEN *screen;
|
||||
XCBDRAWABLE win;
|
||||
XCBGenericEvent *e;
|
||||
|
@ -151,7 +152,11 @@ main(int argc, char **argv)
|
|||
FreeSizeHints(szhints);
|
||||
#endif
|
||||
XCBMapWindow (conn, win.window);
|
||||
XCBSync(conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(conn,
|
||||
XCBGetInputFocusUnchecked(conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
|
||||
/* test evas_free.... :) */
|
||||
evas_init();
|
||||
|
|
|
@ -109,13 +109,14 @@ class_set (XCBConnection *c, XCBWINDOW win, const char *name, const char *class)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int exposed = 0;
|
||||
XCBSCREEN *screen;
|
||||
XCBGenericEvent *e;
|
||||
SizeHints *szhints;
|
||||
CARD32 mask = 0;
|
||||
CARD32 value[6];
|
||||
int screen_nbr;
|
||||
int exposed = 0;
|
||||
XCBSCREEN *screen;
|
||||
XCBGetInputFocusRep *reply;
|
||||
XCBGenericEvent *e;
|
||||
SizeHints *szhints;
|
||||
CARD32 mask = 0;
|
||||
CARD32 value[6];
|
||||
int screen_nbr;
|
||||
|
||||
c = XCBConnect (NULL, &screen_nbr);
|
||||
if (!c)
|
||||
|
@ -159,7 +160,11 @@ main(int argc, char **argv)
|
|||
FreeSizeHints(szhints);
|
||||
|
||||
XCBMapWindow (c, win.window);
|
||||
XCBSync(c, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(c,
|
||||
XCBGetInputFocusUnchecked(c),
|
||||
NULL);
|
||||
free(reply);
|
||||
sleep(1);
|
||||
|
||||
evas_init();
|
||||
|
|
|
@ -97,8 +97,10 @@ evas_software_xcb_outbuf_setup_x(int w,
|
|||
if (evas_software_xcb_x_output_buffer_bit_order(xcbob) == XCBImageOrderMSBFirst)
|
||||
buf->priv.x.bit_swap = 1;
|
||||
#endif
|
||||
if ((vis->_class == XCBVisualClassTrueColor) ||
|
||||
(vis->_class == XCBVisualClassDirectColor))
|
||||
if (((vis->_class == XCBVisualClassTrueColor) ||
|
||||
(vis->_class == XCBVisualClassDirectColor)) &&
|
||||
(x_depth > 8))
|
||||
|
||||
{
|
||||
buf->priv.mask.r = (DATA32) vis->red_mask;
|
||||
buf->priv.mask.g = (DATA32) vis->green_mask;
|
||||
|
@ -113,7 +115,8 @@ evas_software_xcb_outbuf_setup_x(int w,
|
|||
else if ((vis->_class == XCBVisualClassStaticGray) ||
|
||||
(vis->_class == XCBVisualClassGrayScale) ||
|
||||
(vis->_class == XCBVisualClassStaticColor) ||
|
||||
(vis->_class == XCBVisualClassPseudoColor))
|
||||
(vis->_class == XCBVisualClassPseudoColor) ||
|
||||
(x_depth > 8))
|
||||
{
|
||||
Convert_Pal_Mode pm = PAL_MODE_RGB332;
|
||||
|
||||
|
@ -366,7 +369,8 @@ evas_software_xcb_outbuf_free_region_for_update(Outbuf *buf,
|
|||
void
|
||||
evas_software_xcb_outbuf_flush(Outbuf *buf)
|
||||
{
|
||||
Evas_List *l;
|
||||
Evas_List *l;
|
||||
XCBGetInputFocusRep *reply;
|
||||
|
||||
for (l = buf->priv.pending_writes; l; l = l->next)
|
||||
{
|
||||
|
@ -395,7 +399,9 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
|
|||
obr->x,
|
||||
obr->y, 0);
|
||||
}
|
||||
XCBSync(buf->priv.x.conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL);
|
||||
free(reply);
|
||||
while (buf->priv.pending_writes)
|
||||
{
|
||||
RGBA_Image *im;
|
||||
|
@ -632,18 +638,18 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
|
|||
int w,
|
||||
int h)
|
||||
{
|
||||
int i;
|
||||
XCBSCREEN *screen = NULL;
|
||||
|
||||
int i;
|
||||
XCBSCREEN *screen = NULL;
|
||||
XCBGetInputFocusRep *reply;
|
||||
{
|
||||
XCBGetGeometryRep *geom;
|
||||
XCBDRAWABLE root;
|
||||
XCBSCREENIter i;
|
||||
|
||||
geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, draw), 0);
|
||||
geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometryUnchecked(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);
|
||||
geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometryUnchecked(buf->priv.x.conn, root), 0);
|
||||
|
||||
i = XCBSetupRootsIter((XCBSetup *)XCBGetSetup(buf->priv.x.conn));
|
||||
for (; i.rem; XCBSCREENNext(&i))
|
||||
|
@ -666,21 +672,29 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
|
|||
value[1] = XCBExposuresNotAllowed; /* no graphics exposures allowed */
|
||||
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);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL);
|
||||
free(reply);
|
||||
image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, XCBAllPlanes, XCBImageFormatZPixmap);
|
||||
if (image)
|
||||
XCBImageDestroy(image);
|
||||
XCBSync(buf->priv.x.conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL);
|
||||
free(reply);
|
||||
mask = XCBGCForeground | XCBGCGraphicsExposures;
|
||||
value[0] = screen->white_pixel;
|
||||
value[1] = XCBExposuresNotAllowed; /* no graphics exposures allowed */
|
||||
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);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL);
|
||||
free(reply);
|
||||
image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, XCBAllPlanes, XCBImageFormatZPixmap);
|
||||
if (image)
|
||||
XCBImageDestroy(image);
|
||||
XCBSync(buf->priv.x.conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL);
|
||||
free(reply);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,10 +785,10 @@ evas_software_xcb_outbuf_perf_new_x(XCBConnection *conn,
|
|||
XCBSCREENIter i;
|
||||
int cur;
|
||||
|
||||
geom = XCBGetGeometryReply (conn, XCBGetGeometry (conn, draw), NULL);
|
||||
geom = XCBGetGeometryReply (conn, XCBGetGeometryUnchecked(conn, draw), NULL);
|
||||
root.window = geom->root;
|
||||
free (geom);
|
||||
geom = XCBGetGeometryReply (conn, XCBGetGeometry (conn, root), 0);
|
||||
geom = XCBGetGeometryReply (conn, XCBGetGeometryUnchecked(conn, root), 0);
|
||||
perf->x.w = (int)geom->width;
|
||||
perf->x.h = (int)geom->height;
|
||||
|
||||
|
@ -902,30 +916,38 @@ void
|
|||
evas_software_xcb_outbuf_perf_store_x(Outbuf_Perf *perf)
|
||||
{
|
||||
/* write performance results to x root property */
|
||||
XCBInternAtomRep *rep;
|
||||
XCBATOM type, format;
|
||||
char *type_str;
|
||||
char *str;
|
||||
XCBInternAtomCookie cookie_atom;
|
||||
XCBGetInputFocusCookie cookie_focus;
|
||||
XCBInternAtomRep *reply_atom;
|
||||
XCBGetInputFocusRep *reply_focus;
|
||||
XCBATOM type, format;
|
||||
char *type_str;
|
||||
char *str;
|
||||
|
||||
type_str = "__EVAS_PERF_ENGINE_SOFTWARE";
|
||||
rep = XCBInternAtomReply(perf->x.conn,
|
||||
XCBInternAtom(perf->x.conn,
|
||||
0,
|
||||
strlen (type_str),
|
||||
type_str),
|
||||
NULL);
|
||||
if (!rep) return;
|
||||
cookie_atom = XCBInternAtomUnchecked(perf->x.conn,
|
||||
0,
|
||||
strlen (type_str),
|
||||
type_str);
|
||||
cookie_focus = XCBGetInputFocusUnchecked(perf->x.conn);
|
||||
|
||||
type = rep->atom;
|
||||
reply_atom = XCBInternAtomReply(perf->x.conn,
|
||||
cookie_atom,
|
||||
NULL);
|
||||
if (!reply_atom) return;
|
||||
|
||||
type = reply_atom->atom;
|
||||
format = STRING;
|
||||
|
||||
str = evas_software_xcb_outbuf_perf_serialize_x(perf);
|
||||
XCBChangeProperty(perf->x.conn, XCBPropModeReplace, perf->x.root.window,
|
||||
type, format, 8,
|
||||
strlen(str), str);
|
||||
XCBSync(perf->x.conn, 0);
|
||||
/* we sync */
|
||||
reply_focus = XCBGetInputFocusReply(perf->x.conn, cookie_focus, NULL);
|
||||
free(reply_focus);
|
||||
free(str);
|
||||
free (rep);
|
||||
free (reply_atom);
|
||||
}
|
||||
|
||||
Outbuf_Perf *
|
||||
|
@ -947,10 +969,10 @@ evas_software_xcb_outbuf_perf_restore_x(XCBConnection *conn,
|
|||
|
||||
type_str = "__EVAS_PERF_ENGINE_SOFTWARE";
|
||||
type_rep = XCBInternAtomReply(conn,
|
||||
XCBInternAtom(conn,
|
||||
0,
|
||||
strlen (type_str),
|
||||
type_str),
|
||||
XCBInternAtomUnchecked(conn,
|
||||
0,
|
||||
strlen (type_str),
|
||||
type_str),
|
||||
NULL);
|
||||
if (!type_rep)
|
||||
return perf;
|
||||
|
@ -959,9 +981,9 @@ evas_software_xcb_outbuf_perf_restore_x(XCBConnection *conn,
|
|||
format = STRING;
|
||||
free(type_rep);
|
||||
|
||||
cookie = XCBGetProperty(conn, 0, perf->x.root.window,
|
||||
type, format,
|
||||
0, 16384);
|
||||
cookie = XCBGetPropertyUnchecked(conn, 0, perf->x.root.window,
|
||||
type, format,
|
||||
0, 16384);
|
||||
prop_rep = XCBGetPropertyReply(conn, cookie, NULL);
|
||||
|
||||
if ((prop_rep) &&
|
||||
|
@ -1003,13 +1025,14 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
|
|||
XCBCOLORMAP cmap,
|
||||
int x_depth)
|
||||
{
|
||||
Outbuf_Perf *perf;
|
||||
XCBDRAWABLE win;
|
||||
CARD32 mask;
|
||||
CARD32 value[7];
|
||||
CARD32 value2[1];
|
||||
int w, h;
|
||||
int do_shm = 0;
|
||||
Outbuf_Perf *perf;
|
||||
XCBGetInputFocusRep *reply;
|
||||
XCBDRAWABLE win;
|
||||
CARD32 mask;
|
||||
CARD32 value[7];
|
||||
CARD32 value2[1];
|
||||
int w, h;
|
||||
int do_shm = 0;
|
||||
|
||||
perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth);
|
||||
|
||||
|
@ -1034,7 +1057,11 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
|
|||
XCBWindowClassInputOutput,
|
||||
vis->visual_id,
|
||||
mask, value);
|
||||
XCBSync(conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(conn,
|
||||
XCBGetInputFocusUnchecked(conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
mask = XCBConfigWindowStackMode;
|
||||
value[0] = XCBStackModeAbove;
|
||||
XCBConfigureWindow (conn, win.window, mask, value2);
|
||||
|
@ -1088,7 +1115,11 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
|
|||
evas_software_xcb_x_output_buffer_free(xcbob, 1);
|
||||
}
|
||||
}
|
||||
XCBSync(conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(conn,
|
||||
XCBGetInputFocusUnchecked(conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
t1 = _evas_get_time() - t0;
|
||||
t0 = _evas_get_time();
|
||||
for (l = 0; l < loops; l++)
|
||||
|
@ -1110,7 +1141,11 @@ evas_software_xcb_outbuf_perf_x(XCBConnection *conn,
|
|||
evas_software_xcb_x_output_buffer_free(xcbob, 1);
|
||||
}
|
||||
}
|
||||
XCBSync(conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(conn,
|
||||
XCBGetInputFocusUnchecked(conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
t2 = _evas_get_time() - t0;
|
||||
if ((!chosen) && (!error))
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ evas_software_xcb_x_can_do_shm(XCBConnection *c)
|
|||
int depth;
|
||||
|
||||
drawable.window = XCBSetupRootsIter (XCBGetSetup(c)).data->root;
|
||||
geom = XCBGetGeometryReply (c, XCBGetGeometry(c, drawable), 0);
|
||||
geom = XCBGetGeometryReply (c, XCBGetGeometryUnchecked(c, drawable), 0);
|
||||
if(!geom)
|
||||
return 0;
|
||||
|
||||
|
@ -200,7 +200,14 @@ evas_software_xcb_x_output_buffer_free(Xcb_Output_Buffer *xcbob,
|
|||
{
|
||||
if (xcbob->shm_info)
|
||||
{
|
||||
if (sync) XCBSync(xcbob->connection, 0);
|
||||
if (sync)
|
||||
{
|
||||
XCBGetInputFocusRep *reply;
|
||||
|
||||
reply = XCBGetInputFocusReply(xcbob->connection,
|
||||
XCBGetInputFocusUnchecked(xcbob->connection),
|
||||
NULL);
|
||||
}
|
||||
XCBShmDetach(xcbob->connection, xcbob->shm_info->shmseg);
|
||||
XCBImageSHMDestroy(xcbob->image);
|
||||
shmdt(xcbob->shm_info->shmaddr);
|
||||
|
@ -231,7 +238,14 @@ evas_software_xcb_x_output_buffer_paste(Xcb_Output_Buffer *xcbob,
|
|||
x, y,
|
||||
xcbob->image->width, xcbob->image->height,
|
||||
0);
|
||||
if (sync) XCBSync(xcbob->connection, 0);
|
||||
if (sync)
|
||||
{
|
||||
XCBGetInputFocusRep *reply;
|
||||
|
||||
reply = XCBGetInputFocusReply(xcbob->connection,
|
||||
XCBGetInputFocusUnchecked(xcbob->connection),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
XCBImagePut(xcbob->connection,
|
||||
|
|
|
@ -45,51 +45,78 @@ x_color_alloc_rgb(int nr,
|
|||
int r, g, b, i;
|
||||
DATA8 *color_lut;
|
||||
int sig_mask = 0;
|
||||
int delt = 0;
|
||||
|
||||
for (i = 0; i < v->bits_per_rgb_value; i++) sig_mask |= (0x1 << i);
|
||||
sig_mask <<= (16 - v->bits_per_rgb_value);
|
||||
i = 0;
|
||||
color_lut = malloc((nr) * (ng) * (nb));
|
||||
if (!color_lut) return NULL;
|
||||
/* FIXME: remove the round-trip */
|
||||
delt = 0x0101 * 3;
|
||||
/* FIXME: remove the round-trip ? */
|
||||
for (r = 0; r < (nr); r++)
|
||||
{
|
||||
for (g = 0; g < (ng); g++)
|
||||
{
|
||||
for (b = 0; b < (nb); b++)
|
||||
{
|
||||
XCBCOLORITEM xcl;
|
||||
XCBCOLORITEM xcl_in;
|
||||
int val;
|
||||
XCBCOLORITEM xcl;
|
||||
XCBCOLORITEM xcl_in;
|
||||
XCBAllocColorRep *rep;
|
||||
int val;
|
||||
int dr, dg, db;
|
||||
|
||||
val = (int)((((double)r) / ((nr) - 1)) * 65535);
|
||||
val = (int)((((double)r) / ((nr) - 1)) * 255);
|
||||
val = (val << 8) | val;
|
||||
xcl.red = (CARD16)(val);
|
||||
val = (int)((((double)g) / ((ng) - 1)) * 65535);
|
||||
val = (int)((((double)g) / ((ng) - 1)) * 255);
|
||||
val = (val << 8) | val;
|
||||
xcl.green = (CARD16)(val);
|
||||
val = (int)((((double)b) / ((nb) - 1)) * 65535);
|
||||
val = (int)((((double)b) / ((nb) - 1)) * 255);
|
||||
val = (val << 8) | val;
|
||||
xcl.blue = (CARD16)(val);
|
||||
xcl_in = xcl;
|
||||
rep = XCBAllocColorReply(conn,
|
||||
XCBAllocColor(conn, cmap,
|
||||
xcl.red, xcl.green, xcl.blue),
|
||||
XCBAllocColorUnchecked(conn,
|
||||
cmap,
|
||||
xcl.red,
|
||||
xcl.green,
|
||||
xcl.blue),
|
||||
0);
|
||||
dr = (int)xcl_in.red - (int)xcl.red;
|
||||
if (dr < 0) dr = -dr;
|
||||
dg = (int)xcl_in.green - (int)xcl.green;
|
||||
if (dg < 0) dg = -dg;
|
||||
db = (int)xcl_in.blue - (int)xcl.blue;
|
||||
if (db < 0) db = -db;
|
||||
/*
|
||||
printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n",
|
||||
ret,
|
||||
xcl_in.red, xcl_in.green, xcl_in.blue,
|
||||
xcl.red, xcl.green, xcl.blue,
|
||||
(dr + dg +db), delt);
|
||||
*/
|
||||
|
||||
/* TODO: XAllocColor tries to approach the color */
|
||||
/* in case the allocation fails */
|
||||
/* XCB does not that (i think). It should be done */
|
||||
/* So if rep == NULL, the other following tests */
|
||||
/* should be always satisfied */
|
||||
if ((!rep) ||
|
||||
((dr + dg + db) > delt)
|
||||
/*
|
||||
((xcl_in.red & sig_mask) != (xcl.red & 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))
|
||||
*/
|
||||
)
|
||||
{
|
||||
CARD32 pixels[256];
|
||||
int j;
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
for(j = 0; j < i; j++)
|
||||
for (j = 0; j < i; j++)
|
||||
pixels[j] = (CARD32)color_lut[j];
|
||||
XCBFreeColors(conn, cmap, 0, i, pixels);
|
||||
}
|
||||
|
@ -120,6 +147,7 @@ x_color_alloc_gray(int ng,
|
|||
i = 0;
|
||||
color_lut = malloc(ng);
|
||||
if (!color_lut) return NULL;
|
||||
/* FIXME: remove the round-trip ? */
|
||||
for (g = 0; g < (ng); g++)
|
||||
{
|
||||
XCBCOLORITEM xcl;
|
||||
|
@ -127,14 +155,18 @@ x_color_alloc_gray(int ng,
|
|||
int val;
|
||||
XCBAllocColorRep *rep;
|
||||
|
||||
val = (int)((((double)g) / ((ng) - 1)) * 65535);
|
||||
val = (int)((((double)g) / ((ng) - 1)) * 255);
|
||||
val = (val << 8) | val;
|
||||
xcl.red = (CARD16)(val);
|
||||
xcl.green = (CARD16)(val);
|
||||
xcl.blue = (CARD16)(val);
|
||||
xcl_in = xcl;
|
||||
rep = XCBAllocColorReply(conn,
|
||||
XCBAllocColor(conn, cmap,
|
||||
xcl.red, xcl.green, xcl.blue),
|
||||
XCBAllocColorUnchecked(conn,
|
||||
cmap,
|
||||
xcl.red,
|
||||
xcl.green,
|
||||
xcl.blue),
|
||||
0);
|
||||
/* FIXME: XAllocColor tries to approach the color */
|
||||
/* in case the allocation fails */
|
||||
|
@ -151,7 +183,7 @@ x_color_alloc_gray(int ng,
|
|||
|
||||
if (i > 0)
|
||||
{
|
||||
for(j = 0; j < i; j++)
|
||||
for (j = 0; j < i; j++)
|
||||
pixels[j] = (CARD32) color_lut[j];
|
||||
XCBFreeColors(conn, cmap, 0, i, pixels);
|
||||
}
|
||||
|
@ -322,6 +354,7 @@ evas_software_xcb_x_color_allocate(XCBConnection *conn,
|
|||
Convert_Pal_Mode c;
|
||||
Evas_List *l;
|
||||
|
||||
/* printf("ALLOC cmap=%i vis=%p\n", cmap, vis);*/
|
||||
for (l = palettes; l; l = l->next)
|
||||
{
|
||||
pal = l->data;
|
||||
|
@ -340,6 +373,7 @@ evas_software_xcb_x_color_allocate(XCBConnection *conn,
|
|||
{
|
||||
if (x_color_alloc[c])
|
||||
{
|
||||
/* printf("TRY PAL %i\n", c);*/
|
||||
pal->lookup = (x_color_alloc[c])(conn, cmap, vis);
|
||||
if (pal->lookup) break;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ static void *eng_gradient_geometry_init(void *data, void *gradient, int spread);
|
|||
static int eng_gradient_alpha_get(void *data, void *gradient, int spread, int op);
|
||||
static void eng_gradient_map(void *data, void *context, void *gradient, int spread);
|
||||
static void eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int x, int y, int w, int h, double angle, int spread);
|
||||
static void *eng_image_load(void *data, char *file, char *key, int *error, Evas_Image_Load_Opts *lo);
|
||||
static void *eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo);
|
||||
static void *eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data);
|
||||
static void *eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data);
|
||||
static void eng_image_free(void *data, void *image);
|
||||
|
@ -82,12 +82,12 @@ static int eng_image_alpha_get(void *data, void *image);
|
|||
static void *eng_image_border_set(void *data, void *image, int l, int r, int t, int b);
|
||||
static void eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b);
|
||||
static void eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth);
|
||||
static char *eng_image_comment_get(void *data, void *image, char *key);
|
||||
static const char *eng_image_comment_get(void *data, void *image, char *key);
|
||||
static char *eng_image_format_get(void *data, void *image);
|
||||
static void eng_image_cache_flush(void *data);
|
||||
static void eng_image_cache_set(void *data, int bytes);
|
||||
static int eng_image_cache_get(void *data);
|
||||
static void eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, char *text);
|
||||
static void eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, const char *text);
|
||||
|
||||
/* internal engine routines */
|
||||
|
||||
|
@ -334,7 +334,8 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
|
|||
static void
|
||||
eng_output_flush(void *data)
|
||||
{
|
||||
Render_Engine *re;
|
||||
Render_Engine *re;
|
||||
XCBGetInputFocusRep *reply;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
while (re->updates)
|
||||
|
@ -367,7 +368,11 @@ eng_output_flush(void *data)
|
|||
_xr_render_surface_free(reu->surface);
|
||||
free(reu);
|
||||
}
|
||||
XCBSync(re->conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(re->conn,
|
||||
XCBGetInputFocusUnchecked(re->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
_xr_image_info_pool_flush(re->xcbinf, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -486,7 +491,7 @@ eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int
|
|||
}
|
||||
|
||||
static void *
|
||||
eng_image_load(void *data, char *file, char *key, int *error, Evas_Image_Load_Opts *lo)
|
||||
eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
|
||||
{
|
||||
Render_Engine *re;
|
||||
XR_Image *im;
|
||||
|
@ -698,7 +703,7 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
|
|||
smooth);
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
eng_image_comment_get(void *data, void *image, char *key)
|
||||
{
|
||||
if (!image) return NULL;
|
||||
|
@ -737,7 +742,7 @@ eng_image_cache_get(void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, char *text)
|
||||
eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, const char *text)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
|
|
|
@ -93,24 +93,25 @@ typedef struct _XR_Image XR_Image;
|
|||
|
||||
struct _XR_Image
|
||||
{
|
||||
XCBimage_Info *xcbinf;
|
||||
char *file;
|
||||
char *key;
|
||||
char *fkey;
|
||||
RGBA_Image *im;
|
||||
void *data;
|
||||
int w, h;
|
||||
XCBrender_Surface *surface;
|
||||
int references;
|
||||
char *format;
|
||||
char *comment;
|
||||
Tilebuf *updates;
|
||||
unsigned char alpha : 1;
|
||||
unsigned char dirty : 1;
|
||||
unsigned char free_data : 1;
|
||||
XCBimage_Info *xcbinf;
|
||||
const char *file;
|
||||
const char *key;
|
||||
char *fkey;
|
||||
RGBA_Image *im;
|
||||
void *data;
|
||||
int w, h;
|
||||
XCBrender_Surface *surface;
|
||||
int references;
|
||||
char *format;
|
||||
const char *comment;
|
||||
Tilebuf *updates;
|
||||
RGBA_Image_Loadopts load_opts;
|
||||
unsigned char alpha : 1;
|
||||
unsigned char dirty : 1;
|
||||
unsigned char free_data : 1;
|
||||
};
|
||||
|
||||
XR_Image *_xre_image_load(XCBimage_Info *xcbinf, char *file, char *key, Evas_Image_Load_Opts *lo);
|
||||
XR_Image *_xre_image_load(XCBimage_Info *xcbinf, const char *file, const char *key, Evas_Image_Load_Opts *lo);
|
||||
XR_Image *_xre_image_new_from_data(XCBimage_Info *xcbinf, int w, int h, void *data);
|
||||
XR_Image *_xre_image_new_from_copied_data(XCBimage_Info *xcbinf, int w, int h, void *data);
|
||||
XR_Image *_xre_image_new(XCBimage_Info *xcbinf, int w, int h);
|
||||
|
|
|
@ -164,9 +164,11 @@ void
|
|||
_xre_gradient_draw(XCBrender_Surface *rs, RGBA_Draw_Context *dc, XR_Gradient *gr, int x, int y, int w, int h, double angle, int spread)
|
||||
{
|
||||
RGBA_Image *im;
|
||||
int mul_use;
|
||||
|
||||
if ((w <= 0) || (h <= 0)) return;
|
||||
|
||||
if (!rs || !dc || !gr) return;
|
||||
|
||||
if ((angle != gr->angle) || (spread != gr->spread) || (gr->changed))
|
||||
{
|
||||
if (gr->surface)
|
||||
|
@ -201,7 +203,10 @@ _xre_gradient_draw(XCBrender_Surface *rs, RGBA_Draw_Context *dc, XR_Gradient *gr
|
|||
evas_common_image_free(im);
|
||||
}
|
||||
}
|
||||
mul_use = dc->mul.use;
|
||||
dc->mul.use = 0;
|
||||
if (gr->surface)
|
||||
_xr_render_surface_composite(gr->surface, rs, dc, 0, 0, gr->surface->w, gr->surface->h, x, y, w, h, 1);
|
||||
dc->mul.use = mul_use;
|
||||
gr->changed = 0;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ __xre_image_find(char *fkey)
|
|||
}
|
||||
|
||||
XR_Image *
|
||||
_xre_image_load(XCBimage_Info *xcbinf, char *file, char *key, Evas_Image_Load_Opts *lo)
|
||||
_xre_image_load(XCBimage_Info *xcbinf, const char *file, const char *key, Evas_Image_Load_Opts *lo)
|
||||
{
|
||||
XR_Image *im;
|
||||
char buf[4096];
|
||||
|
@ -75,16 +75,16 @@ _xre_image_load(XCBimage_Info *xcbinf, char *file, char *key, Evas_Image_Load_Op
|
|||
if (!lo)
|
||||
{
|
||||
if (key)
|
||||
snprintf(buf, sizeof(buf), "/@%p@%lx@/%s//://%s", xinf->disp, xinf->root, file, key);
|
||||
snprintf(buf, sizeof(buf), "/@%p@%x@/%s//://%s", xcbinf->conn, xcbinf->root.window.xid, file, key);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "/@%p@%lx@/%s", xinf->disp, xinf->root, file);
|
||||
snprintf(buf, sizeof(buf), "/@%p@%x@/%s", xcbinf->conn, xcbinf->root.window.xid, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (key)
|
||||
snprintf(buf, sizeof(buf), "//@/%i/%1.5f/%ix%i//@%p@%lx@/%s//://%s", lo->scale_down_by, lo->dpi, lo->w, lo->h, xinf->disp, xinf->root, file, key);
|
||||
snprintf(buf, sizeof(buf), "//@/%i/%1.5f/%ix%i//@%p@%x@/%s//://%s", lo->scale_down_by, lo->dpi, lo->w, lo->h, xcbinf->conn, xcbinf->root.window.xid, file, key);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "//@/%i/%1.5f/%ix%i//@%p@%lx@/%s", lo->scale_down_by, lo->dpi, lo->w, lo->h, xinf->disp, xinf->root, file);
|
||||
snprintf(buf, sizeof(buf), "//@/%i/%1.5f/%ix%i//@%p@%x@/%s", lo->scale_down_by, lo->dpi, lo->w, lo->h, xcbinf->conn, xcbinf->root.window.xid, file);
|
||||
}
|
||||
im = __xre_image_find(buf);
|
||||
if (im)
|
||||
|
|
|
@ -40,7 +40,7 @@ XCBRenderFindPICTFORMINFO (XCBConnection *conn, CARD32 mask, const XCBRenderPICT
|
|||
XCBRenderQueryPictFormatsRep *rep;
|
||||
XCBRenderPICTFORMINFOIter iter_forminfo;
|
||||
|
||||
cookie = XCBRenderQueryPictFormats (conn);
|
||||
cookie = XCBRenderQueryPictFormatsUnchecked (conn);
|
||||
rep = XCBRenderQueryPictFormatsReply (conn, cookie, NULL);
|
||||
iter_forminfo = XCBRenderQueryPictFormatsFormatsIter (rep);
|
||||
for (; iter_forminfo.rem; XCBRenderPICTFORMINFONext (&iter_forminfo)) {
|
||||
|
@ -283,7 +283,7 @@ _xr_image_info_get(XCBConnection *conn, XCBDRAWABLE draw, XCBVISUALID vis)
|
|||
xcbinf->references = 1;
|
||||
xcbinf->conn = conn;
|
||||
xcbinf->draw = draw;
|
||||
cookie = XCBGetGeometry(xcbinf->conn, xcbinf->draw);
|
||||
cookie = XCBGetGeometryUnchecked(xcbinf->conn, xcbinf->draw);
|
||||
rep = XCBGetGeometryReply(xcbinf->conn, cookie, NULL);
|
||||
xcbinf->root.window = rep->root;
|
||||
free(rep);
|
||||
|
@ -340,19 +340,28 @@ _xr_image_info_get(XCBConnection *conn, XCBDRAWABLE draw, XCBVISUALID vis)
|
|||
if (shm_info.shmid >= 0) {
|
||||
shm_info.shmaddr = xcbim->data = shmat(shm_info.shmid, 0, 0);
|
||||
if ((shm_info.shmaddr != NULL) && (shm_info.shmaddr != (void *) -1)) {
|
||||
/*
|
||||
* FIXME: no error mechanism
|
||||
*/
|
||||
/* XErrorHandler ph; */
|
||||
XCBGetInputFocusRep *reply;
|
||||
/*
|
||||
* FIXME: no error mechanism
|
||||
*/
|
||||
/* XErrorHandler ph; */
|
||||
|
||||
XCBSync(xcbinf->conn, 0);
|
||||
_xcb_err = 0;
|
||||
/* ph = XSetErrorHandler((XErrorHandler)_tmp_xcb_err); */
|
||||
XCBShmAttach(xcbinf->conn, shm_info.shmseg, shm_info.shmid, 0);
|
||||
XCBSync(xcbinf->conn, 0);
|
||||
/* XSetErrorHandler((XErrorHandler)ph); */
|
||||
if (!_xcb_err) xcbinf->can_do_shm = 1;
|
||||
shmdt(shm_info.shmaddr);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(xcbinf->conn,
|
||||
XCBGetInputFocusUnchecked(xcbinf->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
_xcb_err = 0;
|
||||
/* ph = XSetErrorHandler((XErrorHandler)_tmp_xcb_err); */
|
||||
XCBShmAttach(xcbinf->conn, shm_info.shmseg, shm_info.shmid, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(xcbinf->conn,
|
||||
XCBGetInputFocusUnchecked(xcbinf->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
/* XSetErrorHandler((XErrorHandler)ph); */
|
||||
if (!_xcb_err) xcbinf->can_do_shm = 1;
|
||||
shmdt(shm_info.shmaddr);
|
||||
}
|
||||
shmctl(shm_info.shmid, IPC_RMID, 0);
|
||||
}
|
||||
|
@ -366,7 +375,16 @@ _xr_image_info_get(XCBConnection *conn, XCBDRAWABLE draw, XCBVISUALID vis)
|
|||
void
|
||||
_xr_image_info_free(XCBimage_Info *xcbinf)
|
||||
{
|
||||
if (xcbinf->pool) XCBSync(xcbinf->conn, 0);
|
||||
if (!xcbinf) return;
|
||||
if (xcbinf->pool)
|
||||
{
|
||||
XCBGetInputFocusRep *reply;
|
||||
|
||||
reply = XCBGetInputFocusReply(xcbinf->conn,
|
||||
XCBGetInputFocusUnchecked(xcbinf->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
}
|
||||
_xr_image_info_pool_flush(xcbinf, 0, 0);
|
||||
xcbinf->references--;
|
||||
if (xcbinf->references != 0) return;
|
||||
|
@ -433,16 +451,25 @@ _xr_image_new(XCBimage_Info *xcbinf, int w, int h, int depth)
|
|||
xcbim->shm_info->shmaddr = xcbim->xcbim->data = shmat(xcbim->shm_info->shmid, 0, 0);
|
||||
if ((xcbim->shm_info->shmaddr) && (xcbim->shm_info->shmaddr != (void *) -1))
|
||||
{
|
||||
/*
|
||||
* FIXME: no error mechanism
|
||||
*/
|
||||
/* XErrorHandler ph; */
|
||||
XCBGetInputFocusRep *reply;
|
||||
/*
|
||||
* FIXME: no error mechanism
|
||||
*/
|
||||
/* XErrorHandler ph; */
|
||||
|
||||
XCBSync(xcbim->xcbinf->conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(xcbim->xcbinf->conn,
|
||||
XCBGetInputFocusUnchecked(xcbim->xcbinf->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
_xcb_err = 0;
|
||||
/* ph = XSetErrorHandler((XErrorHandler)_tmp_xcb_err); */
|
||||
XCBShmAttach(xcbim->xcbinf->conn, xcbim->shm_info->shmseg, xcbim->shm_info->shmid, 0);
|
||||
XCBSync(xcbim->xcbinf->conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(xcbim->xcbinf->conn,
|
||||
XCBGetInputFocusUnchecked(xcbim->xcbinf->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
/* XSetErrorHandler((XErrorHandler)ph); */
|
||||
if (!_xcb_err) goto xcbim_ok;
|
||||
shmdt(xcbim->shm_info->shmaddr);
|
||||
|
@ -485,7 +512,15 @@ _xr_image_free(XCBimage_Image *xcbim)
|
|||
{
|
||||
if (xcbim->shm_info)
|
||||
{
|
||||
if (!xcbim->available) XCBSync(xcbim->xcbinf->conn, 0);
|
||||
if (!xcbim->available)
|
||||
{
|
||||
XCBGetInputFocusRep *reply;
|
||||
|
||||
reply = XCBGetInputFocusReply(xcbim->xcbinf->conn,
|
||||
XCBGetInputFocusUnchecked(xcbim->xcbinf->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
}
|
||||
XCBShmDetach(xcbim->xcbinf->conn, xcbim->shm_info->shmseg);
|
||||
XCBImageSHMDestroy(xcbim->xcbim);
|
||||
shmdt(xcbim->shm_info->shmaddr);
|
||||
|
@ -506,7 +541,8 @@ _xr_image_free(XCBimage_Image *xcbim)
|
|||
void
|
||||
_xr_image_put(XCBimage_Image *xcbim, XCBDRAWABLE draw, int x, int y, int w, int h)
|
||||
{
|
||||
XCBGCONTEXT gc;
|
||||
XCBGetInputFocusRep *reply;
|
||||
XCBGCONTEXT gc;
|
||||
|
||||
gc = XCBGCONTEXTNew(xcbim->xcbinf->conn);
|
||||
XCBCreateGC(xcbim->xcbinf->conn, gc, draw, 0, NULL);
|
||||
|
@ -521,7 +557,11 @@ _xr_image_put(XCBimage_Image *xcbim, XCBDRAWABLE draw, int x, int y, int w, int
|
|||
0,
|
||||
xcbim->shm_info->shmseg,
|
||||
xcbim->xcbim->data - xcbim->shm_info->shmaddr);
|
||||
XCBSync(xcbim->xcbinf->conn, 0);
|
||||
/* we sync */
|
||||
reply = XCBGetInputFocusReply(xcbim->xcbinf->conn,
|
||||
XCBGetInputFocusUnchecked(xcbim->xcbinf->conn),
|
||||
NULL);
|
||||
free(reply);
|
||||
}
|
||||
else
|
||||
XCBImagePut(xcbim->xcbinf->conn, draw, gc, xcbim->xcbim, 0, 0, x, y, w, h);
|
||||
|
|
|
@ -63,6 +63,8 @@ _xr_render_surface_new(XCBimage_Info *xcbinf, int w, int h, XCBRenderPICTFORMINF
|
|||
CARD32 mask;
|
||||
CARD32 values[3];
|
||||
|
||||
if ((!xcbinf) || (!fmt) || (w < 1) || (h < 1)) return NULL;
|
||||
|
||||
rs = calloc(1, sizeof(XCBrender_Surface));
|
||||
if (!rs) return NULL;
|
||||
rs->xcbinf = xcbinf;
|
||||
|
@ -74,6 +76,11 @@ _xr_render_surface_new(XCBimage_Info *xcbinf, int w, int h, XCBRenderPICTFORMINF
|
|||
rs->allocated = 1;
|
||||
rs->draw.pixmap = XCBPIXMAPNew(xcbinf->conn);
|
||||
XCBCreatePixmap(xcbinf->conn, fmt->depth, rs->draw.pixmap, xcbinf->root, w, h);
|
||||
if (rs->draw.pixmap.xid == 0)
|
||||
{
|
||||
free(rs);
|
||||
return NULL;
|
||||
}
|
||||
rs->xcbinf->references++;
|
||||
mask = XCBRenderCPRepeat | XCBRenderCPDither | XCBRenderCPComponentAlpha;
|
||||
values[0] = 0;
|
||||
|
@ -81,6 +88,13 @@ _xr_render_surface_new(XCBimage_Info *xcbinf, int w, int h, XCBRenderPICTFORMINF
|
|||
values[2] = 0;
|
||||
rs->pic = XCBRenderPICTURENew(xcbinf->conn);
|
||||
XCBRenderCreatePicture(xcbinf->conn, rs->pic, rs->draw, fmt->id, mask, values);
|
||||
if (rs->pic.xid == 0)
|
||||
{
|
||||
XCBFreePixmap(rs->xcbinf->conn, rs->draw.pixmap);
|
||||
rs->xcbinf->references--;
|
||||
free(rs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return rs;
|
||||
}
|
||||
|
@ -93,9 +107,11 @@ _xr_render_surface_adopt(XCBimage_Info *xcbinf, XCBDRAWABLE draw, int w, int h,
|
|||
CARD32 mask;
|
||||
CARD32 values[3];
|
||||
|
||||
if ((!xcbinf) || (draw.pixmap.xid == 0) || (w < 1) || (h < 1)) return NULL;
|
||||
fmt = XCBRenderFindVisualFormat(xcbinf->conn, xcbinf->vis);
|
||||
if (!fmt) return NULL;
|
||||
rs = calloc(1, sizeof(XCBrender_Surface));
|
||||
if (!rs) return NULL;
|
||||
rs->xcbinf = xcbinf;
|
||||
rs->w = w;
|
||||
rs->h = h;
|
||||
|
@ -125,6 +141,12 @@ _xr_render_surface_adopt(XCBimage_Info *xcbinf, XCBDRAWABLE draw, int w, int h,
|
|||
values[2] = 0;
|
||||
rs->pic = XCBRenderPICTURENew(xcbinf->conn);
|
||||
XCBRenderCreatePicture(xcbinf->conn, rs->pic, rs->draw, fmt->id, mask, values);
|
||||
if (rs->pic.xid == 0)
|
||||
{
|
||||
rs->xcbinf->references--;
|
||||
free(rs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return rs;
|
||||
}
|
||||
|
@ -133,10 +155,12 @@ XCBrender_Surface *
|
|||
_xr_render_surface_format_adopt(XCBimage_Info *xcbinf, XCBDRAWABLE draw, int w, int h, XCBRenderPICTFORMINFO *fmt, int alpha)
|
||||
{
|
||||
XCBrender_Surface *rs;
|
||||
CARD32 mask;
|
||||
CARD32 values[3];
|
||||
CARD32 mask;
|
||||
CARD32 values[3];
|
||||
|
||||
if ((!xcbinf) || (!fmt) || (draw.pixmap.xid == 0) || (w < 1) || (h < 1)) return NULL;
|
||||
rs = calloc(1, sizeof(XCBrender_Surface));
|
||||
if (!rs) return NULL;
|
||||
rs->xcbinf = xcbinf;
|
||||
rs->w = w;
|
||||
rs->h = h;
|
||||
|
@ -153,6 +177,12 @@ _xr_render_surface_format_adopt(XCBimage_Info *xcbinf, XCBDRAWABLE draw, int w,
|
|||
values[2] = 0;
|
||||
rs->pic = XCBRenderPICTURENew(xcbinf->conn);
|
||||
XCBRenderCreatePicture(xcbinf->conn, rs->pic, rs->draw, fmt->id, mask, values);
|
||||
if (rs->pic.xid == 0)
|
||||
{
|
||||
rs->xcbinf->references--;
|
||||
free(rs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return rs;
|
||||
}
|
||||
|
@ -160,10 +190,16 @@ _xr_render_surface_format_adopt(XCBimage_Info *xcbinf, XCBDRAWABLE draw, int w,
|
|||
void
|
||||
_xr_render_surface_free(XCBrender_Surface *rs)
|
||||
{
|
||||
if (rs->allocated) XCBFreePixmap(rs->xcbinf->conn, rs->draw.pixmap);
|
||||
XCBRenderFreePicture(rs->xcbinf->conn, rs->pic);
|
||||
_xr_image_info_free(rs->xcbinf);
|
||||
rs->xcbinf = NULL;
|
||||
if (!rs) return;
|
||||
if (rs->xcbinf)
|
||||
{
|
||||
if ((rs->allocated) && (rs->draw.pixmap.xid != 0))
|
||||
XCBFreePixmap(rs->xcbinf->conn, rs->draw.pixmap);
|
||||
if (rs->pic.xid != 0)
|
||||
XCBRenderFreePicture(rs->xcbinf->conn, rs->pic);
|
||||
_xr_image_info_free(rs->xcbinf);
|
||||
rs->xcbinf = NULL;
|
||||
}
|
||||
free(rs);
|
||||
}
|
||||
|
||||
|
@ -185,7 +221,7 @@ _xr_render_surface_solid_rectangle_set(XCBrender_Surface *rs, int r, int g, int
|
|||
XCBRECTANGLE rect;
|
||||
int aa;
|
||||
|
||||
aa = a +1;
|
||||
aa = a + 1;
|
||||
r = (r * aa) >> 8;
|
||||
g = (g * aa) >> 8;
|
||||
b = (b * aa) >> 8;
|
||||
|
@ -257,20 +293,18 @@ _xr_render_surface_argb_pixels_fill(XCBrender_Surface *rs, int sw, int sh, void
|
|||
sple = sp + w;
|
||||
while (sp < sple)
|
||||
{
|
||||
switch (a = A_VAL(sp))
|
||||
switch (a = (*sp & 0xff000000))
|
||||
{
|
||||
case 0:
|
||||
*p = 0;
|
||||
break;
|
||||
case 255:
|
||||
case 0xff000000:
|
||||
*p = *sp;
|
||||
break;
|
||||
default:
|
||||
aa = a + 1;
|
||||
r = ((R_VAL(sp)) * aa) >> 8;
|
||||
g = ((G_VAL(sp)) * aa) >> 8;
|
||||
b = ((B_VAL(sp)) * aa) >> 8;
|
||||
*p = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
default:
|
||||
aa = (a >> 24) + 1;
|
||||
*p = a + (((((*sp) >> 8) & 0xff) * aa) & 0xff00) +
|
||||
(((((*sp) & 0x00ff00ff) * aa) >> 8) & 0x00ff00ff);
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
|
@ -324,7 +358,7 @@ _xr_render_surface_rgb_pixels_fill(XCBrender_Surface *rs, int sw, int sh, void *
|
|||
sple = sp + w;
|
||||
while (sp < sple)
|
||||
{
|
||||
*p = 0xff000000 | ((R_VAL(sp)) << 16) | ((G_VAL(sp)) << 8) | (B_VAL(sp));
|
||||
*p = 0xff000000 | *sp;
|
||||
p++;
|
||||
sp++;
|
||||
}
|
||||
|
@ -392,7 +426,6 @@ _xr_render_surface_composite(XCBrender_Surface *srs, XCBrender_Surface *drs, RGB
|
|||
CARD32 value_mask;
|
||||
CARD32 value_list[1];
|
||||
int r, g, b, a;
|
||||
int sf;
|
||||
int op;
|
||||
|
||||
if ((sw <= 0) || (sh <= 0) || (w <= 0) || (h <= 0)) return;
|
||||
|
@ -436,23 +469,27 @@ _xr_render_surface_composite(XCBrender_Surface *srs, XCBrender_Surface *drs, RGB
|
|||
}
|
||||
else
|
||||
{
|
||||
xf.matrix11 = 1;
|
||||
xf.matrix11 = 1 << 16;
|
||||
xf.matrix12 = 0;
|
||||
xf.matrix13 = 0;
|
||||
|
||||
xf.matrix21 = 0;
|
||||
xf.matrix22 = 1;
|
||||
xf.matrix22 = 1 << 16;
|
||||
xf.matrix23 = 0;
|
||||
|
||||
xf.matrix31 = 0;
|
||||
xf.matrix32 = 0;
|
||||
xf.matrix33 = 1;
|
||||
xf.matrix33 = 1 << 16;
|
||||
if ((srs->alpha) || (a != 0xff))
|
||||
trs = _xr_render_surface_new(srs->xcbinf, sw + 1, sh + 1,
|
||||
srs->xcbinf->fmt32, 1);
|
||||
/* trs = _xr_render_surface_new(srs->xcbinf, sw, sh,
|
||||
srs->xcbinf->fmt32, 1); */
|
||||
else
|
||||
trs = _xr_render_surface_new(srs->xcbinf, sw + 1, sh + 1,
|
||||
srs->fmt, srs->alpha);
|
||||
/* trs = _xr_render_surface_new(srs->xcbinf, sw, sh,
|
||||
srs->fmt, srs->alpha); */
|
||||
XCBRenderSetPictureTransform(srs->xcbinf->conn, srs->pic, xf);
|
||||
XCBRenderComposite(srs->xcbinf->conn, XCBRenderPictOpSrc, srs->pic, mask, trs->pic,
|
||||
sx, sy, 0, 0, 0, 0, sw, sh);
|
||||
|
@ -468,7 +505,7 @@ _xr_render_surface_composite(XCBrender_Surface *srs, XCBrender_Surface *drs, RGB
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
sf = MAX(sw, sh);
|
||||
#define BMAX 26
|
||||
if (sf <= 8 ) sf = 1 << (BMAX - 3);
|
||||
|
@ -484,18 +521,22 @@ _xr_render_surface_composite(XCBrender_Surface *srs, XCBrender_Surface *drs, RGB
|
|||
else if (sf <= 8192 ) sf = 1 << (BMAX - 13);
|
||||
else if (sf <= 16384) sf = 1 << (BMAX - 14);
|
||||
else sf = 1 << (BMAX - 15);
|
||||
*/
|
||||
|
||||
xf.matrix11 = (sf * sw) / w;
|
||||
/* xf.matrix11 = (sf * sw) / w; */
|
||||
xf.matrix11 = (sw << 16) / w;
|
||||
xf.matrix12 = 0;
|
||||
xf.matrix13 = 0;
|
||||
|
||||
xf.matrix21 = 0;
|
||||
xf.matrix22 = (sf * sh) / h;
|
||||
/* xf.matrix22 = (sf * sh) / h; */
|
||||
xf.matrix22 = (sh << 16) / h;
|
||||
xf.matrix23 = 0;
|
||||
|
||||
xf.matrix31 = 0;
|
||||
xf.matrix32 = 0;
|
||||
xf.matrix33 = sf;
|
||||
/* xf.matrix33 = sf; */
|
||||
xf.matrix33 = 1 << 16;
|
||||
|
||||
_xr_render_surface_clips_set(drs, dc, x, y, w, h);
|
||||
if (trs)
|
||||
|
@ -519,6 +560,8 @@ _xr_render_surface_composite(XCBrender_Surface *srs, XCBrender_Surface *drs, RGB
|
|||
XCBRenderSetPictureTransform(srs->xcbinf->conn, srs->pic, xf);
|
||||
|
||||
XCBRenderComposite(srs->xcbinf->conn, op, srs->pic, mask, drs->pic,
|
||||
/* (sx * w) / sw,
|
||||
(sy * h) / sh, */
|
||||
((sx * w) + (sw / 2)) / sw,
|
||||
((sy * h) + (sh / 2)) / sh,
|
||||
0, 0, x, y, w, h);
|
||||
|
@ -532,19 +575,25 @@ _xr_render_surface_copy(XCBrender_Surface *srs, XCBrender_Surface *drs, int sx,
|
|||
XCBRenderPICTURE mask = { 0 };
|
||||
CARD32 value_mask;
|
||||
CARD32 value_list[1];
|
||||
int ident;
|
||||
|
||||
if ((w <= 0) || (h <= 0) || (!srs) || (!drs)) return;
|
||||
xf.matrix11 = 1;
|
||||
if ((w < 1) || (h < 1) || (!srs) || (!drs)) return;
|
||||
ident = 1 << 16;
|
||||
/* FIXME: why do we need to change the identity matrix if the src surface
|
||||
* is 1 bit deep?
|
||||
*/
|
||||
if (srs->depth == 1) ident = 1;
|
||||
xf.matrix11 = ident;
|
||||
xf.matrix12 = 0;
|
||||
xf.matrix13 = 0;
|
||||
|
||||
xf.matrix21 = 0;
|
||||
xf.matrix22 = 1;
|
||||
xf.matrix22 = ident;
|
||||
xf.matrix23 = 0;
|
||||
|
||||
xf.matrix31 = 0;
|
||||
xf.matrix32 = 0;
|
||||
xf.matrix33 = 1;
|
||||
xf.matrix33 = ident;
|
||||
|
||||
XCBRenderSetPictureTransform(srs->xcbinf->conn, srs->pic, xf);
|
||||
value_mask = XCBRenderCPClipMask;
|
||||
|
@ -566,13 +615,13 @@ _xr_render_surface_rectangle_draw(XCBrender_Surface *rs, RGBA_Draw_Context *dc,
|
|||
CARD32 value_list[1];
|
||||
int r, g, b, a, aa, op;
|
||||
|
||||
if ((w <= 0) || (h <= 0)) return;
|
||||
if ((w < 1) || (h < 1) || (!rs) || (!dc)) return;
|
||||
a = (dc->col.col >> 24) & 0xff;
|
||||
if (a == 0) return;
|
||||
r = (dc->col.col >> 16) & 0xff;
|
||||
g = (dc->col.col >> 8 ) & 0xff;
|
||||
b = (dc->col.col ) & 0xff;
|
||||
aa = a +1;
|
||||
aa = a + 1;
|
||||
r = (r * aa) >> 8;
|
||||
g = (g * aa) >> 8;
|
||||
b = (b * aa) >> 8;
|
||||
|
@ -601,6 +650,7 @@ _xr_render_surface_line_draw(XCBrender_Surface *rs, RGBA_Draw_Context *dc, int x
|
|||
/* CARD32 value_list[1]; */
|
||||
/* int op; */
|
||||
|
||||
/* if ((!rs) || (!dc)) return; */
|
||||
/* op = XCBRenderPictOpSrc; */
|
||||
/* value_mask = XCBRenderCPClipMask; */
|
||||
/* value_list[0] = 0; */
|
||||
|
@ -660,13 +710,13 @@ _xre_poly_draw(XCBrender_Surface *rs, RGBA_Draw_Context *dc, RGBA_Polygon_Point
|
|||
/* CARD32 value_list[1]; */
|
||||
/* int op; */
|
||||
|
||||
/* op = XCBRenderPictOpSrc; */
|
||||
/* if ((!rs) || (!dc)) return; */
|
||||
/* num = 0; */
|
||||
/* for (pt = points; pt; pt = (RGBA_Polygon_Point *)(((Evas_Object_List *)pt)->next)) num++; */
|
||||
/* if (num < 3) return; */
|
||||
/* a = (dc->col.col >> 24) & 0xff; */
|
||||
/* if (a == 0) return; */
|
||||
/* if (a < 0xff) op = XCBRenderPictOpOver; */
|
||||
/* op = XCBRenderPictOpOver; */
|
||||
/* r = (dc->col.col >> 16) & 0xff; */
|
||||
/* g = (dc->col.col >> 8 ) & 0xff; */
|
||||
/* b = (dc->col.col ) & 0xff; */
|
||||
|
|
Loading…
Reference in New Issue