forked from enlightenment/efl
add in lots of ptr checks to sw-x11 outbut code... this may only
happen if we ran out of mem and mallocs failed... but we can avoid a crash. SVN revision: 58797
This commit is contained in:
parent
3b167a62f5
commit
b1285ae71a
|
@ -40,7 +40,6 @@ _find_xcbob(xcb_connection_t *conn, int depth, int w, int h, int shm, void *data
|
|||
int lbytes;
|
||||
int bpp;
|
||||
|
||||
// return evas_software_xcb_x_output_buffer_new(d, v, depth, w, h, shm, data);
|
||||
if (!shm)
|
||||
return evas_software_xcb_x_output_buffer_new(conn, depth, w, h, shm, data);
|
||||
if (depth > 1)
|
||||
|
@ -92,7 +91,6 @@ _find_xcbob(xcb_connection_t *conn, int depth, int w, int h, int shm, void *data
|
|||
static void
|
||||
_unfind_xcbob(Xcb_Output_Buffer *xcbob, int sync)
|
||||
{
|
||||
// evas_software_xcb_x_output_buffer_free(xcbob, sync); return;
|
||||
if (xcbob->shm_info)
|
||||
{
|
||||
shmpool = eina_list_prepend(shmpool, xcbob);
|
||||
|
@ -398,8 +396,14 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
Eina_Rectangle *rect;
|
||||
|
||||
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
|
||||
obr = calloc(1, sizeof(Outbuf_Region));
|
||||
if (!obr) return NULL;
|
||||
rect = eina_rectangle_new(x, y, w, h);
|
||||
if (!rect) return NULL;
|
||||
if (!rect)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf->priv.onebuf_regions = eina_list_append(buf->priv.onebuf_regions, rect);
|
||||
if (buf->priv.onebuf)
|
||||
|
@ -416,7 +420,6 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
}
|
||||
return buf->priv.onebuf;
|
||||
}
|
||||
obr = calloc(1, sizeof(Outbuf_Region));
|
||||
obr->x = 0;
|
||||
obr->y = 0;
|
||||
obr->w = buf->w;
|
||||
|
@ -439,10 +442,21 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
buf->w, buf->h,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xcbob)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
|
||||
buf->w, buf->h,
|
||||
(DATA32 *)evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl),
|
||||
alpha, EVAS_COLORSPACE_ARGB8888);
|
||||
if (!im)
|
||||
{
|
||||
evas_software_xcb_x_output_buffer_free(obr->xcbob, 0);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->extended_info = obr;
|
||||
if (buf->priv.x11.xcb.mask)
|
||||
obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
|
||||
|
@ -454,6 +468,11 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
else
|
||||
{
|
||||
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
|
||||
if (!im)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->cache_entry.flags.alpha |= alpha ? 1 : 0;
|
||||
evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
|
||||
im->extended_info = obr;
|
||||
|
@ -464,6 +483,12 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
buf->w, buf->h,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xcbob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xcb.mask)
|
||||
obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
|
||||
1,
|
||||
|
@ -478,6 +503,12 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
buf->h, buf->w,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xcbob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xcb.mask)
|
||||
obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
|
||||
1,
|
||||
|
@ -488,9 +519,11 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
}
|
||||
/* FIXME: We should be able to remove this memset, but somewhere in the process
|
||||
we copy too much to the destination surface and some area are not cleaned before copy. */
|
||||
if (alpha)
|
||||
if ((alpha) && (im->image.data))
|
||||
{
|
||||
/* FIXME: faster memset! */
|
||||
memset(im->image.data, 0, w * h * sizeof(DATA32));
|
||||
}
|
||||
|
||||
buf->priv.onebuf = im;
|
||||
return im;
|
||||
|
@ -498,6 +531,7 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
|
||||
|
||||
obr = calloc(1, sizeof(Outbuf_Region));
|
||||
if (!obr) return NULL;
|
||||
obr->x = x;
|
||||
obr->y = y;
|
||||
obr->w = w;
|
||||
|
@ -526,10 +560,21 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
|
||||
if (!obr->xcbob)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
|
||||
w, h,
|
||||
(DATA32 *) evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl),
|
||||
alpha, EVAS_COLORSPACE_ARGB8888);
|
||||
if (!im)
|
||||
{
|
||||
_unfind_xob(obr->xob, 0);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->extended_info = obr;
|
||||
if (buf->priv.x11.xcb.mask)
|
||||
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
|
||||
|
@ -537,16 +582,15 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
/* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
|
||||
/* 1, */
|
||||
/* w, */
|
||||
/* h, */
|
||||
/* use_shm, */
|
||||
/* NULL); */
|
||||
}
|
||||
else
|
||||
{
|
||||
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
|
||||
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
||||
if (!im)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->cache_entry.flags.alpha |= alpha ? 1 : 0;
|
||||
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
|
||||
im->extended_info = obr;
|
||||
|
@ -557,6 +601,12 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xcbob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xcb.mask)
|
||||
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
|
||||
1,
|
||||
|
@ -564,12 +614,6 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
use_shm,
|
||||
NULL);
|
||||
}
|
||||
/* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
|
||||
/* buf->priv.x11.xcb.depth, */
|
||||
/* w, */
|
||||
/* h, */
|
||||
/* use_shm, */
|
||||
/* NULL); */
|
||||
else if ((buf->rot == 90) || (buf->rot == 270))
|
||||
{
|
||||
obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn,
|
||||
|
@ -577,6 +621,12 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
h, w,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xcbob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xcb.mask)
|
||||
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
|
||||
1,
|
||||
|
@ -584,31 +634,15 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
|
|||
use_shm,
|
||||
NULL);
|
||||
}
|
||||
/* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
|
||||
/* buf->priv.x11.xcb.depth, */
|
||||
/* h, */
|
||||
/* w, */
|
||||
/* use_shm, */
|
||||
/* NULL); */
|
||||
/*
|
||||
if (buf->priv.x11.xcb.mask)
|
||||
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
|
||||
1, w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
*/
|
||||
/* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
|
||||
/* 1, */
|
||||
/* w, */
|
||||
/* h, */
|
||||
/* use_shm, */
|
||||
/* NULL); */
|
||||
}
|
||||
/* FIXME: We should be able to remove this memset, but somewhere in the process
|
||||
we copy too much to the destination surface and some area are not cleaned before copy. */
|
||||
if ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha))
|
||||
if (((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha)) &&
|
||||
(im->image.data))
|
||||
{
|
||||
/* FIXME: faster memset! */
|
||||
memset(im->image.data, 0, w * h * sizeof(DATA32));
|
||||
}
|
||||
|
||||
buf->priv.pending_writes = eina_list_append(buf->priv.pending_writes, im);
|
||||
return im;
|
||||
|
@ -654,6 +688,7 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
|
|||
buf->priv.x11.xcb.gc,
|
||||
0, 0, pixman_region_n_rects(&tmpr),
|
||||
(const xcb_rectangle_t *)pixman_region_rectangles(&tmpr, NULL));
|
||||
if (obr->xcbob)
|
||||
evas_software_xcb_x_output_buffer_paste(obr->xcbob, buf->priv.x11.xcb.win,
|
||||
buf->priv.x11.xcb.gc,
|
||||
0, 0, 0);
|
||||
|
@ -685,6 +720,7 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
|
|||
obr->y,
|
||||
obr->w,
|
||||
obr->h);
|
||||
if (obr->xcbob)
|
||||
evas_software_xcb_x_output_buffer_paste(obr->xcbob,
|
||||
buf->priv.x11.xcb.win,
|
||||
buf->priv.x11.xcb.gc,
|
||||
|
@ -706,8 +742,6 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
|
|||
evas_cache_image_drop(&im->cache_entry);
|
||||
if (obr->xcbob) _unfind_xcbob(obr->xcbob, 0);
|
||||
if (obr->mxcbob) _unfind_xcbob(obr->mxcbob, 0);
|
||||
/* if (obr->xcbob) evas_software_xcb_x_output_buffer_free(obr->xcbob, 0); */
|
||||
/* if (obr->mxcbob) evas_software_xcb_x_output_buffer_free(obr->mxcbob, 0); */
|
||||
free(obr);
|
||||
}
|
||||
buf->priv.prev_pending_writes = buf->priv.pending_writes;
|
||||
|
@ -743,10 +777,6 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
|
|||
evas_cache_image_drop(&im->cache_entry);
|
||||
if (obr->xcbob) _unfind_xcbob(obr->xcbob, 0);
|
||||
if (obr->mxcbob) _unfind_xcbob(obr->mxcbob, 0);
|
||||
/*
|
||||
if (obr->xcbob) evas_software_x11_x_output_buffer_free(obr->xcbob, 0);
|
||||
if (obr->mxcbob) evas_software_x11_x_output_buffer_free(obr->mxcbob, 0);
|
||||
*/
|
||||
free(obr);
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
}
|
||||
|
@ -842,8 +872,11 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf,
|
|||
}
|
||||
if (!conv_func) return;
|
||||
|
||||
if (!obr->xcbob) return;
|
||||
data = evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl);
|
||||
if (!data) return;
|
||||
src_data = update->image.data;
|
||||
if (!src_data) return;
|
||||
if (buf->rot == 0)
|
||||
{
|
||||
obr->x = x;
|
||||
|
@ -901,6 +934,7 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf,
|
|||
if (buf->priv.debug)
|
||||
evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
|
||||
obr->x, obr->y, obr->w, obr->h);
|
||||
if (obr->xcbob)
|
||||
evas_software_xcb_x_output_buffer_paste(obr->xcbob, buf->priv.x11.xcb.win,
|
||||
buf->priv.x11.xcb.gc,
|
||||
obr->x, obr->y, 0);
|
||||
|
@ -1063,16 +1097,17 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
|
|||
|
||||
i = xcb_setup_roots_iterator((xcb_setup_t *)xcb_get_setup(buf->priv.x11.xcb.conn));
|
||||
for (; i.rem; xcb_screen_next(&i))
|
||||
{
|
||||
if (i.data->root == geom->root)
|
||||
{
|
||||
screen = i.data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free (geom);
|
||||
}
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
/* xcb_image_t *image; */
|
||||
xcb_rectangle_t rect = { x, y, w, h};
|
||||
uint32_t mask;
|
||||
uint32_t value[2];
|
||||
|
@ -1084,9 +1119,6 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
|
|||
xcb_poly_fill_rectangle (buf->priv.x11.xcb.conn, draw, buf->priv.x11.xcb.gc, 1, &rect);
|
||||
/* we sync */
|
||||
free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
|
||||
// image = xcb_image_get(buf->priv.x11.xcb.conn, draw, x, y, w, h, XCB_ALL_PLANES, XCB_IMAGE_FORMAT_Z_PIXMAP);
|
||||
// if (image)
|
||||
// xcb_image_destroy(image);
|
||||
/* we sync */
|
||||
free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
|
||||
mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
|
||||
|
@ -1096,9 +1128,6 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
|
|||
xcb_poly_fill_rectangle (buf->priv.x11.xcb.conn, draw, buf->priv.x11.xcb.gc, 1, &rect);
|
||||
/* we sync */
|
||||
free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
|
||||
// image = xcb_image_get(buf->priv.x11.xcb.conn, draw, x, y, w, h, XCB_ALL_PLANES, XCB_IMAGE_FORMAT_Z_PIXMAP);
|
||||
// if (image)
|
||||
// xcb_image_destroy(image);
|
||||
/* we sync */
|
||||
free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
|
||||
}
|
||||
|
|
|
@ -324,11 +324,6 @@ evas_software_xlib_x_output_buffer_new(Display *d, Visual *v, int depth, int w,
|
|||
}
|
||||
if (!_x_err)
|
||||
{
|
||||
// printf("SHM++ ID=%i -> %i bytes [%i creates]\n",
|
||||
// xob->shm_info->shmid,
|
||||
// xob->xim->bytes_per_line * xob->xim->height,
|
||||
// creates);
|
||||
// creates++;
|
||||
xob->bpl = xob->xim->bytes_per_line;
|
||||
xob->psize = xob->bpl * xob->h;
|
||||
return xob;
|
||||
|
@ -376,10 +371,6 @@ evas_software_xlib_x_output_buffer_free(X_Output_Buffer *xob, int sync)
|
|||
{
|
||||
if (xob->shm_info)
|
||||
{
|
||||
// printf("SHM-- ID=%i -> %i bytes, [sync=%i]\n",
|
||||
// xob->shm_info->shmid,
|
||||
// xob->xim->bytes_per_line * xob->xim->height,
|
||||
// sync);
|
||||
if (sync) XSync(xob->display, False);
|
||||
XShmDetach(xob->display, xob->shm_info);
|
||||
XDestroyImage(xob->xim);
|
||||
|
@ -400,14 +391,12 @@ evas_software_xlib_x_output_buffer_paste(X_Output_Buffer *xob, Drawable d, GC gc
|
|||
{
|
||||
if (xob->shm_info)
|
||||
{
|
||||
// printf("shm\n");
|
||||
XShmPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
|
||||
xob->w, xob->h, False);
|
||||
if (sync) XSync(xob->display, False);
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("NO! shm\n");
|
||||
XPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
|
||||
xob->w, xob->h);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ _find_xob(Display *d, Visual *v, int depth, int w, int h, int shm, void *data)
|
|||
int fitness = 0x7fffffff;
|
||||
int sz, lbytes, bpp;
|
||||
|
||||
// return evas_software_xlib_x_output_buffer_new(d, v, depth, w, h, shm, data);
|
||||
if (!shm)
|
||||
return evas_software_xlib_x_output_buffer_new(d, v, depth, w, h, shm, data);
|
||||
if (depth > 1)
|
||||
|
@ -105,7 +104,6 @@ _find_xob(Display *d, Visual *v, int depth, int w, int h, int shm, void *data)
|
|||
static void
|
||||
_unfind_xob(X_Output_Buffer *xob, int sync)
|
||||
{
|
||||
// evas_software_xlib_x_output_buffer_free(xob, sync); return;
|
||||
if (xob->shm_info)
|
||||
{
|
||||
SHMPOOL_LOCK();
|
||||
|
@ -383,8 +381,14 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
Eina_Rectangle *rect;
|
||||
|
||||
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
|
||||
obr = calloc(1, sizeof(Outbuf_Region));
|
||||
if (!obr) return NULL;
|
||||
rect = eina_rectangle_new(x, y, w, h);
|
||||
if (!rect) return NULL;
|
||||
if (!rect)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf->priv.onebuf_regions = eina_list_append(buf->priv.onebuf_regions, rect);
|
||||
if (buf->priv.onebuf)
|
||||
|
@ -400,7 +404,6 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
}
|
||||
return buf->priv.onebuf;
|
||||
}
|
||||
obr = calloc(1, sizeof(Outbuf_Region));
|
||||
obr->x = 0;
|
||||
obr->y = 0;
|
||||
obr->w = buf->w;
|
||||
|
@ -424,10 +427,21 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
buf->w, buf->h,
|
||||
use_shm,
|
||||
NULL);
|
||||
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
|
||||
if (!obr->xob)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
|
||||
buf->w, buf->h,
|
||||
(DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
|
||||
alpha, EVAS_COLORSPACE_ARGB8888);
|
||||
if (!im)
|
||||
{
|
||||
evas_software_xlib_x_output_buffer_free(obr->xob, 0);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->extended_info = obr;
|
||||
if (buf->priv.x11.xlib.mask)
|
||||
obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
|
||||
|
@ -439,7 +453,12 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
}
|
||||
else
|
||||
{
|
||||
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
|
||||
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
||||
if (!im)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->cache_entry.flags.alpha |= alpha ? 1 : 0;
|
||||
evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
|
||||
im->extended_info = obr;
|
||||
|
@ -451,6 +470,12 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
buf->w, buf->h,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xlib.mask)
|
||||
obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
|
@ -466,6 +491,12 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
buf->h, buf->w,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xlib.mask)
|
||||
obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
|
@ -476,15 +507,18 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
}
|
||||
/* FIXME: We should be able to remove this memset, but somewhere in the process
|
||||
we copy too much to the destination surface and some area are not cleaned before copy. */
|
||||
if (alpha)
|
||||
if ((alpha) && (im->image.data))
|
||||
{
|
||||
/* FIXME: faster memset! */
|
||||
memset(im->image.data, 0, w * h * sizeof(DATA32));
|
||||
}
|
||||
|
||||
buf->priv.onebuf = im;
|
||||
return im;
|
||||
}
|
||||
|
||||
obr = calloc(1, sizeof(Outbuf_Region));
|
||||
if (!obr) return NULL;
|
||||
obr->x = x;
|
||||
obr->y = y;
|
||||
obr->w = w;
|
||||
|
@ -514,16 +548,21 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
/* obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp, */
|
||||
/* buf->priv.x11.xlib.vis, */
|
||||
/* buf->priv.x11.xlib.depth, */
|
||||
/* w, h, */
|
||||
/* use_shm, */
|
||||
/* NULL); */
|
||||
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
|
||||
if (!obr->xob)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
|
||||
w, h,
|
||||
(DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
|
||||
alpha, EVAS_COLORSPACE_ARGB8888);
|
||||
if (!im)
|
||||
{
|
||||
_unfind_xob(obr->xob, 0);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->extended_info = obr;
|
||||
if (buf->priv.x11.xlib.mask)
|
||||
obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
|
||||
|
@ -531,17 +570,15 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
1, w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
/*
|
||||
obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
1, w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
|
||||
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
||||
if (!im)
|
||||
{
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
im->cache_entry.flags.alpha |= alpha ? 1 : 0;
|
||||
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
|
||||
im->extended_info = obr;
|
||||
|
@ -553,6 +590,12 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xlib.mask)
|
||||
obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
|
@ -560,14 +603,6 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
use_shm,
|
||||
NULL);
|
||||
}
|
||||
/*
|
||||
obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
buf->priv.x11.xlib.depth,
|
||||
w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
*/
|
||||
else if ((buf->rot == 90) || (buf->rot == 270))
|
||||
{
|
||||
obr->xob = _find_xob(buf->priv.x11.xlib.disp,
|
||||
|
@ -576,6 +611,12 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
h, w,
|
||||
use_shm,
|
||||
NULL);
|
||||
if (!obr->xob)
|
||||
{
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
free(obr);
|
||||
return NULL;
|
||||
}
|
||||
if (buf->priv.x11.xlib.mask)
|
||||
obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
|
@ -583,35 +624,15 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
|
|||
use_shm,
|
||||
NULL);
|
||||
}
|
||||
/*
|
||||
obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
buf->priv.x11.xlib.depth,
|
||||
h, w,
|
||||
use_shm,
|
||||
NULL);
|
||||
*/
|
||||
/*
|
||||
if (buf->priv.x11.xlib.mask)
|
||||
obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
1, w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
*/
|
||||
/*
|
||||
obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
|
||||
buf->priv.x11.xlib.vis,
|
||||
1, w, h,
|
||||
use_shm,
|
||||
NULL);
|
||||
*/
|
||||
}
|
||||
/* FIXME: We should be able to remove this memset, but somewhere in the process
|
||||
we copy too much to the destination surface and some area are not cleaned before copy. */
|
||||
if ((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha))
|
||||
if (((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha)) &&
|
||||
(im->image.data))
|
||||
{
|
||||
/* FIXME: faster memset! */
|
||||
memset(im->image.data, 0, w * h * sizeof(DATA32));
|
||||
}
|
||||
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
if (!evas_common_frameq_enabled())
|
||||
|
@ -658,6 +679,7 @@ evas_software_xlib_outbuf_flush(Outbuf *buf)
|
|||
eina_rectangle_free(rect);
|
||||
}
|
||||
XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc, tmpr);
|
||||
if (obr->xob)
|
||||
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
|
||||
buf->priv.x11.xlib.gc,
|
||||
0, 0, 0);
|
||||
|
@ -682,6 +704,7 @@ evas_software_xlib_outbuf_flush(Outbuf *buf)
|
|||
if (buf->priv.debug)
|
||||
evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
|
||||
obr->x, obr->y, obr->w, obr->h);
|
||||
if (obr->xob)
|
||||
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
|
||||
buf->priv.x11.xlib.gc,
|
||||
obr->x, obr->y, 0);
|
||||
|
@ -704,10 +727,6 @@ evas_software_xlib_outbuf_flush(Outbuf *buf)
|
|||
evas_cache_image_drop(&im->cache_entry);
|
||||
if (obr->xob) _unfind_xob(obr->xob, 0);
|
||||
if (obr->mxob) _unfind_xob(obr->mxob, 0);
|
||||
/*
|
||||
if (obr->xob) evas_software_xlib_x_output_buffer_free(obr->xob, 0);
|
||||
if (obr->mxob) evas_software_xlib_x_output_buffer_free(obr->mxob, 0);
|
||||
*/
|
||||
free(obr);
|
||||
}
|
||||
buf->priv.prev_pending_writes = buf->priv.pending_writes;
|
||||
|
@ -748,10 +767,6 @@ evas_software_xlib_outbuf_flush(Outbuf *buf)
|
|||
evas_cache_image_drop(&im->cache_entry);
|
||||
if (obr->xob) _unfind_xob(obr->xob, 0);
|
||||
if (obr->mxob) _unfind_xob(obr->mxob, 0);
|
||||
/*
|
||||
if (obr->xob) evas_software_xlib_x_output_buffer_free(obr->xob, 0);
|
||||
if (obr->mxob) evas_software_xlib_x_output_buffer_free(obr->mxob, 0);
|
||||
*/
|
||||
free(obr);
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
}
|
||||
|
@ -846,8 +861,11 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
|
|||
}
|
||||
if (!conv_func) return;
|
||||
|
||||
if (!obr->xob) return;
|
||||
data = evas_software_xlib_x_output_buffer_data(obr->xob, &bpl);
|
||||
if (!data) return;
|
||||
src_data = update->image.data;
|
||||
if (!src_data) return;
|
||||
if (buf->rot == 0)
|
||||
{
|
||||
obr->x = x;
|
||||
|
@ -905,6 +923,7 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
|
|||
if (buf->priv.debug)
|
||||
evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
|
||||
obr->x, obr->y, obr->w, obr->h);
|
||||
if (obr->xob)
|
||||
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
|
||||
buf->priv.x11.xlib.gc,
|
||||
obr->x, obr->y, 0);
|
||||
|
@ -1058,25 +1077,15 @@ evas_software_xlib_outbuf_debug_show(Outbuf * buf, Drawable draw, int x, int y,
|
|||
}
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
// XImage *xim;
|
||||
|
||||
XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
|
||||
BlackPixel(buf->priv.x11.xlib.disp, screen_num));
|
||||
XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
|
||||
XSync(buf->priv.x11.xlib.disp, False);
|
||||
// xim =
|
||||
// XGetImage(buf->priv.x11.xlib.disp, draw, x, y, w, h, 0xffffffff, ZPixmap);
|
||||
// if (xim)
|
||||
// XDestroyImage(xim);
|
||||
XSync(buf->priv.x11.xlib.disp, False);
|
||||
XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
|
||||
WhitePixel(buf->priv.x11.xlib.disp, screen_num));
|
||||
XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
|
||||
XSync(buf->priv.x11.xlib.disp, False);
|
||||
// xim =
|
||||
// XGetImage(buf->priv.x11.xlib.disp, draw, x, y, w, h, 0xffffffff, ZPixmap);
|
||||
// if (xim)
|
||||
// XDestroyImage(xim);
|
||||
XSync(buf->priv.x11.xlib.disp, False);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue