fix softwared x11 xlib engine to generate masks when rotated too

SVN revision: 40523
This commit is contained in:
Carsten Haitzler 2009-05-06 12:35:38 +00:00
parent b37f6643cf
commit 63e4b4e564
3 changed files with 263 additions and 35 deletions

View File

@ -58,6 +58,172 @@ evas_software_xlib_x_write_mask_line(Outbuf *buf, X_Output_Buffer *xob, DATA32 *
}
}
void
evas_software_xlib_x_write_mask_line_rev(Outbuf *buf, X_Output_Buffer *xob, 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_xlib_x_output_buffer_data(xob, &bpl);
dst_ptr = dst_ptr + (bpl * y);
w -= 7;
if (buf->priv.x11.xlib.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 ++)
{
XPutPixel(xob->xim, x, y, A_VAL(src_ptr) >> 7);
src_ptr--;
}
}
void
evas_software_xlib_x_write_mask_line_vert(Outbuf *buf, X_Output_Buffer *xob,
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_xlib_x_output_buffer_data(xob, &bpl);
dst_ptr = dst_ptr + (bpl * ym);
h -= 7;
if (buf->priv.x11.xlib.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 ++)
{
XPutPixel(xob->xim, y, ym, A_VAL(src_ptr) >> 7);
src_ptr += w;
}
}
void
evas_software_xlib_x_write_mask_line_vert_rev(Outbuf *buf, X_Output_Buffer *xob,
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_xlib_x_output_buffer_data(xob, &bpl);
dst_ptr = dst_ptr + (bpl * ym);
h -= 7;
if (buf->priv.x11.xlib.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 ++)
{
XPutPixel(xob->xim, y, ym, A_VAL(src_ptr) >> 7);
src_ptr -= w;
}
}
int
evas_software_xlib_x_can_do_shm(Display *d)
{

View File

@ -21,6 +21,9 @@ struct _X_Output_Buffer
};
void evas_software_xlib_x_write_mask_line (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y);
void evas_software_xlib_x_write_mask_line_rev (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y);
void evas_software_xlib_x_write_mask_line_vert (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int h, int ym, int w);
void evas_software_xlib_x_write_mask_line_vert_rev (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int h, int ym, int w);
int evas_software_xlib_x_can_do_shm (Display *d);

View File

@ -421,25 +421,35 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180))
obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
buf->priv.x11.xlib.depth,
buf->w, buf->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,
buf->w, buf->h,
use_shm,
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,
1, buf->w, buf->h,
use_shm,
NULL);
}
else if ((buf->rot == 90) || (buf->rot == 270))
obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
buf->priv.x11.xlib.depth,
buf->h, buf->w,
use_shm,
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,
1, buf->w, buf->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,
buf->h, buf->w,
use_shm,
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,
1, buf->h, buf->w,
use_shm,
NULL);
}
}
if (alpha)
/* FIXME: faster memset! */
@ -511,12 +521,20 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180))
obr->xob = _find_xob(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
buf->priv.x11.xlib.depth,
w, h,
use_shm,
NULL);
{
obr->xob = _find_xob(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
buf->priv.x11.xlib.depth,
w, h,
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->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
@ -526,12 +544,20 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
NULL);
*/
else if ((buf->rot == 90) || (buf->rot == 270))
obr->xob = _find_xob(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
buf->priv.x11.xlib.depth,
h, w,
use_shm,
NULL);
{
obr->xob = _find_xob(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, h, w,
use_shm,
NULL);
}
/*
obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
@ -540,12 +566,14 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int 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,
@ -741,7 +769,7 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
Outbuf_Region *obr;
DATA32 *src_data;
void *data;
int bpl = 0, yy;
int bpl = 0, xx, yy;
obr = update->extended_info;
if (buf->priv.pal)
@ -842,10 +870,41 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
#endif
if (obr->mxob)
{
for (yy = 0; yy < obr->h; yy++)
evas_software_xlib_x_write_mask_line(buf, obr->mxob,
src_data +
(yy * obr->w), obr->w, yy);
if (buf->rot == 0)
{
for (yy = 0; yy < obr->h; yy++)
evas_software_xlib_x_write_mask_line(buf, obr->mxob,
src_data +
(yy * obr->w), obr->w, yy);
}
else if (buf->rot == 90)
{
for (yy = 0; yy < obr->h; yy++)
evas_software_xlib_x_write_mask_line_vert(buf, obr->mxob,
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_xlib_x_write_mask_line_rev(buf, obr->mxob,
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_xlib_x_write_mask_line_vert_rev(buf, obr->mxob,
src_data + yy,
h, // h
yy, // ym
w); // w
}
#if 1
#else
/* XX async push */