masks should be correctly rotated in the xcb engine, now

remove a few unused parameters and unused variables


SVN revision: 41975
This commit is contained in:
Vincent Torri 2009-08-25 16:21:09 +00:00
parent 86dab3bef7
commit ea9c39e2f7
5 changed files with 293 additions and 35 deletions

View File

@ -628,7 +628,7 @@ eng_output_idle_flush(void *data)
} }
static Eina_Bool static Eina_Bool
eng_canvas_alpha_get(void *data, void *context) eng_canvas_alpha_get(void *data, void *context __UNUSED__)
{ {
Render_Engine *re; Render_Engine *re;
@ -667,7 +667,7 @@ module_open(Evas_Module *em)
} }
static void static void
module_close(Evas_Module *em) module_close(Evas_Module *em __UNUSED__)
{ {
} }

View File

@ -62,6 +62,182 @@ evas_software_xcb_x_write_mask_line(Outbuf *buf,
} }
} }
void
evas_software_xcb_x_write_mask_line_rev(Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src,
int w,
int y)
{
int x;
DATA32 *src_ptr;
DATA8 *dst_ptr;
int bpl = 0;
src_ptr = src + w - 1;
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
dst_ptr = dst_ptr + (bpl * y);
w -= 7;
if (buf->priv.x11.xcb.bit_swap)
{
for (x = 0; x < w; x += 8)
{
*dst_ptr =
((A_VAL(&(src_ptr[ 0])) >> 7) << 7) |
((A_VAL(&(src_ptr[-1])) >> 7) << 6) |
((A_VAL(&(src_ptr[-2])) >> 7) << 5) |
((A_VAL(&(src_ptr[-3])) >> 7) << 4) |
((A_VAL(&(src_ptr[-4])) >> 7) << 3) |
((A_VAL(&(src_ptr[-5])) >> 7) << 2) |
((A_VAL(&(src_ptr[-6])) >> 7) << 1) |
((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++;
}
}
w += 7;
for (; x < w; x ++)
{
xcb_image_put_pixel(xcbob->image, x, y, A_VAL(src_ptr) >> 7);
src_ptr--;
}
}
void
evas_software_xcb_x_write_mask_line_vert(Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src,
int h,
int ym,
int w)
{
int y;
DATA32 *src_ptr;
DATA8 *dst_ptr;
int bpl = 0;
src_ptr = src;
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
dst_ptr = dst_ptr + (bpl * ym);
h -= 7;
if (buf->priv.x11.xcb.bit_swap)
{
for (y = 0; y < h; y += 8)
{
*dst_ptr =
((A_VAL(&(src_ptr[0 * w])) >> 7) << 7) |
((A_VAL(&(src_ptr[1 * w])) >> 7) << 6) |
((A_VAL(&(src_ptr[2 * w])) >> 7) << 5) |
((A_VAL(&(src_ptr[3 * w])) >> 7) << 4) |
((A_VAL(&(src_ptr[4 * w])) >> 7) << 3) |
((A_VAL(&(src_ptr[5 * w])) >> 7) << 2) |
((A_VAL(&(src_ptr[6 * w])) >> 7) << 1) |
((A_VAL(&(src_ptr[7 * w])) >> 7) << 0);
src_ptr += 8 * w;
dst_ptr++;
}
}
else
{
for (y = 0; y < h; y += 8)
{
*dst_ptr =
((A_VAL(&(src_ptr[0 * w])) >> 7) << 0) |
((A_VAL(&(src_ptr[1 * w])) >> 7) << 1) |
((A_VAL(&(src_ptr[2 * w])) >> 7) << 2) |
((A_VAL(&(src_ptr[3 * w])) >> 7) << 3) |
((A_VAL(&(src_ptr[4 * w])) >> 7) << 4) |
((A_VAL(&(src_ptr[5 * w])) >> 7) << 5) |
((A_VAL(&(src_ptr[6 * w])) >> 7) << 6) |
((A_VAL(&(src_ptr[7 * w])) >> 7) << 7);
src_ptr += 8 * w;
dst_ptr++;
}
}
h += 7;
for (; y < h; y ++)
{
xcb_image_put_pixel(xcbob->image, y, ym, A_VAL(src_ptr) >> 7);
src_ptr += w;
}
}
void
evas_software_xcb_x_write_mask_line_vert_rev(Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src,
int h,
int ym,
int w)
{
int y;
DATA32 *src_ptr;
DATA8 *dst_ptr;
int bpl = 0;
src_ptr = src + ((h - 1) * w);
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
dst_ptr = dst_ptr + (bpl * ym);
h -= 7;
if (buf->priv.x11.xcb.bit_swap)
{
for (y = 0; y < h; y += 8)
{
*dst_ptr =
((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 7) |
((A_VAL(&(src_ptr[-1 * w])) >> 7) << 6) |
((A_VAL(&(src_ptr[-2 * w])) >> 7) << 5) |
((A_VAL(&(src_ptr[-3 * w])) >> 7) << 4) |
((A_VAL(&(src_ptr[-4 * w])) >> 7) << 3) |
((A_VAL(&(src_ptr[-5 * w])) >> 7) << 2) |
((A_VAL(&(src_ptr[-6 * w])) >> 7) << 1) |
((A_VAL(&(src_ptr[-7 * w])) >> 7) << 0);
src_ptr -= 8 * w;
dst_ptr++;
}
}
else
{
for (y = 0; y < h; y += 8)
{
*dst_ptr =
((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 0) |
((A_VAL(&(src_ptr[-1 * w])) >> 7) << 1) |
((A_VAL(&(src_ptr[-2 * w])) >> 7) << 2) |
((A_VAL(&(src_ptr[-3 * w])) >> 7) << 3) |
((A_VAL(&(src_ptr[-4 * w])) >> 7) << 4) |
((A_VAL(&(src_ptr[-5 * w])) >> 7) << 5) |
((A_VAL(&(src_ptr[-6 * w])) >> 7) << 6) |
((A_VAL(&(src_ptr[-7 * w])) >> 7) << 7);
src_ptr -= 8 * w;
dst_ptr++;
}
}
h += 7;
for (; y < h; y ++)
{
xcb_image_put_pixel(xcbob->image, y, ym, A_VAL(src_ptr) >> 7);
src_ptr -= w;
}
}
int int
evas_software_xcb_x_can_do_shm(xcb_connection_t *c, evas_software_xcb_x_can_do_shm(xcb_connection_t *c,
xcb_screen_t *screen) xcb_screen_t *screen)

View File

@ -24,6 +24,23 @@ void evas_software_xcb_x_write_mask_line (Outbuf
DATA32 *src, DATA32 *src,
int w, int w,
int y); int y);
void evas_software_xcb_x_write_mask_line_rev (Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src,
int w,
int y);
void evas_software_xcb_x_write_mask_line_vert (Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src,
int h,
int ym,
int w);
void evas_software_xcb_x_write_mask_line_vert_rev(Outbuf *buf,
Xcb_Output_Buffer *xcbob,
DATA32 *src,
int h,
int ym,
int w);
int evas_software_xcb_x_can_do_shm (xcb_connection_t *c, int evas_software_xcb_x_can_do_shm (xcb_connection_t *c,
xcb_screen_t *screen); xcb_screen_t *screen);
Xcb_Output_Buffer *evas_software_xcb_x_output_buffer_new (xcb_connection_t *c, Xcb_Output_Buffer *evas_software_xcb_x_output_buffer_new (xcb_connection_t *c,

View File

@ -32,7 +32,7 @@ static Xcb_Output_Buffer *
_find_xcbob(xcb_connection_t *conn, int depth, int w, int h, int shm, void *data) _find_xcbob(xcb_connection_t *conn, int depth, int w, int h, int shm, void *data)
{ {
Eina_List *l; Eina_List *l;
Eina_List *xl; Eina_List *xl = NULL;
Xcb_Output_Buffer *xcbob = NULL; Xcb_Output_Buffer *xcbob = NULL;
Xcb_Output_Buffer *xcbob2; Xcb_Output_Buffer *xcbob2;
int fitness = 0x7fffffff; int fitness = 0x7fffffff;
@ -458,23 +458,36 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h); evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
im->extended_info = obr; im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180)) if ((buf->rot == 0) || (buf->rot == 180))
obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, {
buf->priv.x11.xcb.depth, obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
buf->w, buf->h, buf->priv.x11.xcb.depth,
use_shm, buf->w, buf->h,
NULL); use_shm,
NULL);
if (buf->priv.x11.xcb.mask)
obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
buf->priv.x11.xcb.depth,
buf->w, buf->h,
use_shm,
NULL);
}
else if ((buf->rot == 90) || (buf->rot == 270)) else if ((buf->rot == 90) || (buf->rot == 270))
obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, {
buf->priv.x11.xcb.depth, obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
buf->h, buf->w, buf->priv.x11.xcb.depth,
use_shm, buf->h, buf->w,
NULL); use_shm,
if (buf->priv.x11.xcb.mask) NULL);
obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, if (buf->priv.x11.xcb.mask)
1, buf->w, buf->h, obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
use_shm, buf->priv.x11.xcb.depth,
NULL); buf->h, buf->w,
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 (alpha) if (alpha)
/* FIXME: faster memset! */ /* FIXME: faster memset! */
memset(im->image.data, 0, w * h * sizeof(DATA32)); memset(im->image.data, 0, w * h * sizeof(DATA32));
@ -520,7 +533,8 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
im->extended_info = obr; im->extended_info = obr;
if (buf->priv.x11.xcb.mask) if (buf->priv.x11.xcb.mask)
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn, obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
1, w, h, buf->priv.x11.xcb.depth,
w, h,
use_shm, use_shm,
NULL); NULL);
/* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */ /* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
@ -537,11 +551,19 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
evas_cache_image_surface_alloc(&im->cache_entry, w, h); evas_cache_image_surface_alloc(&im->cache_entry, w, h);
im->extended_info = obr; im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180)) if ((buf->rot == 0) || (buf->rot == 180))
obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn, {
buf->priv.x11.xcb.depth, obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn,
w, h, buf->priv.x11.xcb.depth,
use_shm, w, h,
NULL); use_shm,
NULL);
if (buf->priv.x11.xcb.mask)
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
buf->priv.x11.xcb.depth,
w, h,
use_shm,
NULL);
}
/* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */ /* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
/* buf->priv.x11.xcb.depth, */ /* buf->priv.x11.xcb.depth, */
/* w, */ /* w, */
@ -549,22 +571,32 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
/* use_shm, */ /* use_shm, */
/* NULL); */ /* NULL); */
else if ((buf->rot == 90) || (buf->rot == 270)) else if ((buf->rot == 90) || (buf->rot == 270))
obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn, {
buf->priv.x11.xcb.depth, obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn,
h, w, buf->priv.x11.xcb.depth,
use_shm, h, w,
NULL); use_shm,
NULL);
if (buf->priv.x11.xcb.mask)
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
buf->priv.x11.xcb.depth,
h, w,
use_shm,
NULL);
}
/* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */ /* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
/* buf->priv.x11.xcb.depth, */ /* buf->priv.x11.xcb.depth, */
/* h, */ /* h, */
/* w, */ /* w, */
/* use_shm, */ /* use_shm, */
/* NULL); */ /* NULL); */
/*
if (buf->priv.x11.xcb.mask) if (buf->priv.x11.xcb.mask)
obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn, obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
1, w, h, 1, w, h,
use_shm, use_shm,
NULL); NULL);
*/
/* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */ /* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
/* 1, */ /* 1, */
/* w, */ /* w, */
@ -572,6 +604,8 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
/* use_shm, */ /* use_shm, */
/* NULL); */ /* 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.xcb.mask) || (buf->priv.destination_alpha))
/* FIXME: faster memset! */ /* FIXME: faster memset! */
memset(im->image.data, 0, w * h * sizeof(DATA32)); memset(im->image.data, 0, w * h * sizeof(DATA32));
@ -874,11 +908,42 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf,
#endif #endif
if (obr->mxcbob) if (obr->mxcbob)
{ {
for (yy = 0; yy < obr->h; yy++) if (buf->rot == 0)
evas_software_xcb_x_write_mask_line(buf, obr->mxcbob, {
src_data + (yy * obr->w), for (yy = 0; yy < obr->h; yy++)
obr->w, evas_software_xcb_x_write_mask_line(buf, obr->mxcbob,
yy); src_data + (yy * obr->w),
obr->w,
yy);
}
else if (buf->rot == 90)
{
for (yy = 0; yy < obr->h; yy++)
evas_software_xcb_x_write_mask_line_vert(buf, obr->mxcbob,
src_data + yy,
h, // h
obr->h - yy - 1, // ym
w); // w
}
else if (buf->rot == 180)
{
for (yy = 0; yy < obr->h; yy++)
{
evas_software_xcb_x_write_mask_line_rev(buf, obr->mxcbob,
src_data + (yy * obr->w),
obr->w,
obr->h - yy - 1);
}
}
else if (buf->rot == 270)
{
for (yy = 0; yy < obr->h; yy++)
evas_software_xcb_x_write_mask_line_vert_rev(buf, obr->mxcbob,
src_data + yy,
h, // h
yy, // ym
w); // w
}
#if 1 #if 1
#else #else
/* XX async push */ /* XX async push */

View File

@ -761,7 +761,7 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
Outbuf_Region *obr; Outbuf_Region *obr;
DATA32 *src_data; DATA32 *src_data;
void *data; void *data;
int bpl = 0, xx, yy; int bpl = 0, yy;
obr = update->extended_info; obr = update->extended_info;
if (buf->priv.pal) if (buf->priv.pal)