Evas: No need to 'find format for depth' everytime, just use the

buffer depth. Fix typo in error message. Add a missing
cache_image_drop call. When doing mask_set, use the proper variable
for the _create_gc function.



SVN revision: 62603
This commit is contained in:
Christopher Michael 2011-08-19 22:53:04 +00:00
parent 52a9f334bd
commit 897011100f
1 changed files with 13 additions and 29 deletions

View File

@ -91,13 +91,11 @@ evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_co
Outbuf *buf = NULL;
Gfx_Func_Convert func_conv= NULL;
const xcb_setup_t *setup;
xcb_format_t *fmt;
if (!(buf = calloc(1, sizeof(Outbuf))))
return NULL;
setup = xcb_get_setup(conn);
fmt = _find_format_by_depth(setup, xdepth);
buf->w = w;
buf->h = h;
@ -203,7 +201,7 @@ evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_co
if (buf->priv.pal)
{
func_conv =
evas_common_convert_func_get(0, w, h, fmt->bits_per_pixel,
evas_common_convert_func_get(0, w, h, xdepth,
buf->priv.mask.r,
buf->priv.mask.g,
buf->priv.mask.b,
@ -212,7 +210,7 @@ evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_co
else
{
func_conv =
evas_common_convert_func_get(0, w, h, fmt->bits_per_pixel,
evas_common_convert_func_get(0, w, h, xdepth,
buf->priv.mask.r,
buf->priv.mask.g,
buf->priv.mask.b,
@ -225,7 +223,7 @@ evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_co
" At depth %i:"
" RGB format mask: %08x, %08x, %08x"
" Palette mode: %i"
" Not supported by and compiled in converters!"
" Not supported by any compiled in converters!"
" }", buf->priv.x11.xcb.depth, buf->priv.mask.r,
buf->priv.mask.g, buf->priv.mask.b,
buf->priv.pal ? (int)buf->priv.pal->colors : -1);
@ -613,7 +611,6 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
/* FIXME: Async Push Disabled */
_xcbob_sync(buf->priv.x11.xcb.conn);
while (buf->priv.pending_writes)
{
im = eina_list_data_get(buf->priv.pending_writes);
@ -625,7 +622,7 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE);
if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE);
free(obr);
// evas_cache_image_drop(&im->cache_entry);
evas_cache_image_drop(&im->cache_entry);
}
#endif
}
@ -643,12 +640,12 @@ evas_software_xcb_outbuf_idle_flush(Outbuf *buf)
im = buf->priv.onebuf;
buf->priv.onebuf = NULL;
obr = im->extended_info;
evas_cache_image_drop(&im->cache_entry);
if (obr->xcbob)
evas_software_xcb_output_buffer_free(obr->xcbob, EINA_FALSE);
if (obr->mask)
evas_software_xcb_output_buffer_free(obr->mask, EINA_FALSE);
free(obr);
evas_cache_image_drop(&im->cache_entry);
}
else
{
@ -688,23 +685,10 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in
unsigned char *data = NULL;
int bpl = 0, yy = 0;
int bw = 0, bh = 0;
int bpp = 0;
obr = update->extended_info;
if (!obr->xcbob) return;
if (obr->xcbob->xim)
bpp = obr->xcbob->xim->bpp;
else
{
const xcb_setup_t *setup;
xcb_format_t *fmt;
setup = xcb_get_setup(buf->priv.x11.xcb.conn);
fmt = _find_format_by_depth(setup, buf->priv.x11.xcb.depth);
bpp = fmt->bits_per_pixel;
}
if ((buf->rot == 0) || (buf->rot == 180))
{
bw = w;
@ -718,18 +702,19 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in
if (buf->priv.pal)
{
func_conv =
evas_common_convert_func_get(0, bw, bh, bpp, buf->priv.mask.r,
evas_common_convert_func_get(0, bw, bh, buf->depth, buf->priv.mask.r,
buf->priv.mask.g, buf->priv.mask.b,
buf->priv.pal->colors, buf->rot);
}
else
{
func_conv =
evas_common_convert_func_get(0, bw, bh, bpp, buf->priv.mask.r,
evas_common_convert_func_get(0, bw, bh, buf->depth, buf->priv.mask.r,
buf->priv.mask.g, buf->priv.mask.b,
PAL_MODE_NONE, buf->rot);
}
if (!func_conv) return;
if (!(data = evas_software_xcb_output_buffer_data(obr->xcbob, &bpl)))
return;
if (!(src_data = update->image.data)) return;
@ -764,18 +749,17 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in
if (buf->onebuf)
{
src_data += x + (y * update->cache_entry.w);
data += (bpl * obr->y) +
(obr->x * (evas_software_xcb_output_buffer_depth(obr->xcbob) / 8));
data += (bpl * obr->y) + (obr->x * (buf->depth / 8));
}
if (data != (unsigned char *)src_data)
{
if (buf->priv.pal)
func_conv(src_data, data, update->cache_entry.w - w,
(bpl / (bpp / 8)) - obr->w,
(bpl / (buf->depth / 8)) - obr->w,
obr->w, obr->h, x, y, buf->priv.pal->lookup);
else
func_conv(src_data, data, update->cache_entry.w - w,
(bpl / (bpp / 8)) - obr->w,
(bpl / (buf->depth / 8)) - obr->w,
obr->w, obr->h, x, y, NULL);
}
#if 1
@ -827,7 +811,7 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in
#else
/* Async Push */
if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
evas_software_xcb_output_buffer_paste(obr->xcbob,
evas_software_xcb_output_buffer_paste(obr->mask,
buf->priv.x11.xcb.mask,
buf->priv.x11.xcb.gcm,
obr->x, obr->y, 0);
@ -897,7 +881,7 @@ evas_software_xcb_outbuf_mask_set(Outbuf *buf, xcb_drawable_t mask)
{
buf->priv.x11.xcb.gcm = xcb_generate_id(buf->priv.x11.xcb.conn);
xcb_create_gc(buf->priv.x11.xcb.conn,
buf->priv.x11.xcb.gcm, buf->priv.x11.xcb.win, 0, NULL);
buf->priv.x11.xcb.gcm, buf->priv.x11.xcb.mask, 0, NULL);
}
}