From e413884dac87dedfb7efbbf3e24da2e2b5cf3e0f Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 25 Jul 2011 10:30:20 +0000 Subject: [PATCH] fix latent onebuf code (was never used before) SVN revision: 61684 --- legacy/evas/src/lib/canvas/evas_render.c | 3 +- .../engines/software_x11/evas_engine.c | 4 +- .../engines/software_x11/evas_xcb_outbuf.c | 56 +++++++-- .../engines/software_x11/evas_xlib_outbuf.c | 116 +++++++++++------- 4 files changed, 121 insertions(+), 58 deletions(-) diff --git a/legacy/evas/src/lib/canvas/evas_render.c b/legacy/evas/src/lib/canvas/evas_render.c index 2d8c0a779f..ecab7421c2 100644 --- a/legacy/evas/src/lib/canvas/evas_render.c +++ b/legacy/evas/src/lib/canvas/evas_render.c @@ -1187,7 +1187,6 @@ evas_render_updates_internal(Evas *e, alpha = e->engine.func->canvas_alpha_get(e->engine.data.output, e->engine.data.context); - while ((surface = e->engine.func->output_redraws_next_update_get (e->engine.data.output, @@ -1263,7 +1262,7 @@ evas_render_updates_internal(Evas *e, { e->engine.func->context_clip_set(e->engine.data.output, e->engine.data.context, - ux, uy, uw, uh); + ux + off_x, uy + off_y, uw, uh); e->engine.func->context_color_set(e->engine.data.output, e->engine.data.context, 0, 0, 0, 0); diff --git a/legacy/evas/src/modules/engines/software_x11/evas_engine.c b/legacy/evas/src/modules/engines/software_x11/evas_engine.c index 93f3fbf95a..3cabf1ec31 100644 --- a/legacy/evas/src/modules/engines/software_x11/evas_engine.c +++ b/legacy/evas/src/modules/engines/software_x11/evas_engine.c @@ -215,8 +215,8 @@ _output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, * as well as shaped stuff is broken and probable non-32bpp is broken as * convert funcs dont do the right thing * - re->ob->onebuf = 1; */ +// re->ob->onebuf = 1; evas_software_xlib_outbuf_debug_set(re->ob, debug); re->tb = evas_common_tilebuf_new(w, h); @@ -271,8 +271,8 @@ _output_xcb_setup(int w, int h, int rot, xcb_connection_t *conn, * as well as shaped stuff is broken and probable non-32bpp is broken as * convert funcs dont do the right thing * - re->ob->onebuf = 1; */ +// re->ob->onebuf = 1; evas_software_xcb_outbuf_debug_set(re->ob, debug); diff --git a/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c b/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c index 72da52ebbd..87324b6ed4 100644 --- a/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c +++ b/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c @@ -376,7 +376,7 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, if ((alpha) && (im->image.data)) { /* FIXME: Faster memset */ - memset(im->image.data, 0, (w * h * sizeof(DATA32))); +// memset(im->image.data, 0, (w * h * sizeof(DATA32))); } buf->priv.onebuf = im; return im; @@ -471,7 +471,7 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, (im->image.data)) { /* FIXME: Faster memset */ - memset(im->image.data, 0, (w * h * sizeof(DATA32))); +// memset(im->image.data, 0, (w * h * sizeof(DATA32))); } #ifdef EVAS_FRAME_QUEUING @@ -504,18 +504,44 @@ evas_software_xcb_outbuf_flush(Outbuf *buf) pixman_region_init(&tmpr); while (buf->priv.onebuf_regions) { - Eina_Rectangle *rect; + Eina_Rectangle *rect, xr = { 0, 0, 0, 0 }; + if (buf->rot == 0) + { + xr.x = rect->x; + xr.y = rect->y; + xr.w = rect->w; + xr.h = rect->h; + } + else if (buf->rot == 90) + { + xr.x = rect->y; + xr.y = buf->w - rect->x - rect->w; + xr.w = rect->h; + xr.h = rect->w; + } + else if (buf->rot == 180) + { + xr.x = buf->w - rect->x - rect->w; + xr.y = buf->h - rect->y - rect->h; + xr.w = rect->w; + xr.h = rect->h; + } + else if (buf->rot == 270) + { + xr.x = buf->h - rect->y - rect->h; + xr.y = rect->x; + xr.w = rect->h; + xr.h = rect->w; + } rect = buf->priv.onebuf_regions->data; buf->priv.onebuf_regions = eina_list_remove_list(buf->priv.onebuf_regions, buf->priv.onebuf_regions); - pixman_region_union_rect(&tmpr, &tmpr, rect->x, rect->y, - rect->w, rect->h); + pixman_region_union_rect(&tmpr, &tmpr, r.x, r.y, r.w, r.h); if (buf->priv.debug) evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win, - rect->x, rect->y, rect->w, - rect->h); + r.x, r.y, r.w, r.h); eina_rectangle_free(rect); } xcb_set_clip_rectangles(buf->priv.x11.xcb.conn, @@ -658,7 +684,7 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in Gfx_Func_Convert func_conv = NULL; Outbuf_Region *obr = NULL; DATA32 *src_data = NULL; - void *data = NULL; + unsigned char *data = NULL; int bpl = 0, yy = 0; int bw = 0, bh = 0; int bpp = 0; @@ -734,13 +760,21 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in obr->w = h; obr->h = w; } - if (data != src_data) + if (buf->onebuf) + { + src_data += x + (y * update->cache_entry.w); + data += (bpl * obr->y) + + (obr->x * (evas_software_xcb_output_buffer_depth(obr->xob) / 8)); + } + if (data != (unsigned char *)src_data) { if (buf->priv.pal) - func_conv(src_data, data, 0, (bpl / (bpp / 8)) - obr->w, + func_conv(src_data, data, update->cache_entry.w - w, + (bpl / (bpp / 8)) - obr->w, obr->w, obr->h, x, y, buf->priv.pal->lookup); else - func_conv(src_data, data, 0, (bpl / (bpp / 8)) - obr->w, + func_conv(src_data, data, update->cache_entry.w - w, + (bpl / (bpp / 8)) - obr->w, obr->w, obr->h, x, y, NULL); } #if 1 diff --git a/legacy/evas/src/modules/engines/software_x11/evas_xlib_outbuf.c b/legacy/evas/src/modules/engines/software_x11/evas_xlib_outbuf.c index 67700accce..1b1d3d985f 100644 --- a/legacy/evas/src/modules/engines/software_x11/evas_xlib_outbuf.c +++ b/legacy/evas/src/modules/engines/software_x11/evas_xlib_outbuf.c @@ -312,38 +312,38 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth, if (buf->priv.pal) { if (buf->rot == 0 || buf->rot == 180) - conv_func = evas_common_convert_func_get(0, buf->w, buf->h, - evas_software_xlib_x_output_buffer_depth - (xob), buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); + conv_func = evas_common_convert_func_get(0, buf->w, buf->h, + evas_software_xlib_x_output_buffer_depth + (xob), buf->priv.mask.r, + buf->priv.mask.g, + buf->priv.mask.b, + buf->priv.pal->colors, + buf->rot); else if (buf->rot == 90 || buf->rot == 270) - conv_func = evas_common_convert_func_get(0, buf->h, buf->w, - evas_software_xlib_x_output_buffer_depth - (xob), buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, - buf->rot); + conv_func = evas_common_convert_func_get(0, buf->h, buf->w, + evas_software_xlib_x_output_buffer_depth + (xob), buf->priv.mask.r, + buf->priv.mask.g, + buf->priv.mask.b, + buf->priv.pal->colors, + buf->rot); } else { if (buf->rot == 0 || buf->rot == 180) - conv_func = evas_common_convert_func_get(0, buf->w, buf->h, - evas_software_xlib_x_output_buffer_depth - (xob), buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, PAL_MODE_NONE, - buf->rot); + conv_func = evas_common_convert_func_get(0, buf->w, buf->h, + evas_software_xlib_x_output_buffer_depth + (xob), buf->priv.mask.r, + buf->priv.mask.g, + buf->priv.mask.b, PAL_MODE_NONE, + buf->rot); else if (buf->rot == 90 || buf->rot == 270) - conv_func = evas_common_convert_func_get(0, buf->h, buf->w, - evas_software_xlib_x_output_buffer_depth - (xob), buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, PAL_MODE_NONE, - buf->rot); + conv_func = evas_common_convert_func_get(0, buf->h, buf->w, + evas_software_xlib_x_output_buffer_depth + (xob), buf->priv.mask.r, + buf->priv.mask.g, + buf->priv.mask.b, PAL_MODE_NONE, + buf->rot); } evas_software_xlib_x_output_buffer_free(xob, 1); if (!conv_func) @@ -383,7 +383,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w 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); + rect = eina_rectangle_new(x, y, w, h); if (!rect) { free(obr); @@ -510,7 +510,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w if ((alpha) && (im->image.data)) { /* FIXME: faster memset! */ - memset(im->image.data, 0, w * h * sizeof(DATA32)); +// memset(im->image.data, 0, w * h * sizeof(DATA32)); } buf->priv.onebuf = im; @@ -631,7 +631,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w (im->image.data)) { /* FIXME: faster memset! */ - memset(im->image.data, 0, w * h * sizeof(DATA32)); +// memset(im->image.data, 0, w * h * sizeof(DATA32)); } #ifdef EVAS_FRAME_QUEUING @@ -668,14 +668,38 @@ evas_software_xlib_outbuf_flush(Outbuf *buf) rect = buf->priv.onebuf_regions->data; buf->priv.onebuf_regions = eina_list_remove_list(buf->priv.onebuf_regions, buf->priv.onebuf_regions); - xr.x = rect->x; - xr.y = rect->y; - xr.width = rect->w; - xr.height = rect->h; + if (buf->rot == 0) + { + xr.x = rect->x; + xr.y = rect->y; + xr.width = rect->w; + xr.height = rect->h; + } + else if (buf->rot == 90) + { + xr.x = rect->y; + xr.y = buf->w - rect->x - rect->w; + xr.width = rect->h; + xr.height = rect->w; + } + else if (buf->rot == 180) + { + xr.x = buf->w - rect->x - rect->w; + xr.y = buf->h - rect->y - rect->h; + xr.width = rect->w; + xr.height = rect->h; + } + else if (buf->rot == 270) + { + xr.x = buf->h - rect->y - rect->h; + xr.y = rect->x; + xr.width = rect->h; + xr.height = rect->w; + } XUnionRectWithRegion(&xr, tmpr, tmpr); if (buf->priv.debug) - evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win, - rect->x, rect->y, rect->w, rect->h); + evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win, + xr.x, xr.y, xr.width, xr.height); eina_rectangle_free(rect); } XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc, tmpr); @@ -687,9 +711,9 @@ evas_software_xlib_outbuf_flush(Outbuf *buf) { XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm, tmpr); evas_software_xlib_x_output_buffer_paste(obr->mxob, - buf->priv.x11.xlib.mask, - buf->priv.x11.xlib.gcm, - 0, 0, 0); + buf->priv.x11.xlib.mask, + buf->priv.x11.xlib.gcm, + 0, 0, 0); } XDestroyRegion(tmpr); buf->priv.synced = 0; @@ -825,7 +849,7 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i Gfx_Func_Convert conv_func = NULL; Outbuf_Region *obr; DATA32 *src_data; - void *data; + unsigned char *data; int bpl = 0, yy; obr = update->extended_info; @@ -896,11 +920,17 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i obr->w = h; obr->h = w; } + if (buf->onebuf) + { + src_data += x + (y * update->cache_entry.w); + data += (bpl * obr->y) + + (obr->x * (evas_software_xlib_x_output_buffer_depth(obr->xob) / 8)); + } if (buf->priv.pal) { - if (data != src_data) + if (data != (unsigned char *)src_data) conv_func(src_data, data, - 0, + update->cache_entry.w - w, bpl / ((evas_software_xlib_x_output_buffer_depth(obr->xob) / 8)) - obr->w, obr->w, obr->h, x, y, @@ -908,9 +938,9 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i } else { - if (data != src_data) + if (data != (unsigned char *)src_data) conv_func(src_data, data, - 0, + update->cache_entry.w - w, bpl / ((evas_software_xlib_x_output_buffer_depth(obr->xob) / 8)) - obr->w, obr->w, obr->h, x, y, NULL);