Outbuf *ob;
Tilebuf_Rect *rects;
Eina_Inlist *cur_rect;
+ Eina_Inarray previous_rects;
int end : 1;
};
/* prototypes we will use here */
-static void *_output_setup(int w, int h, void *dest_buffer, int dest_buffer_row_bytes, int depth_type, int use_color_key, int alpha_threshold, int color_key_r, int color_key_g, int color_key_b, void *(*new_update_region) (int x, int y, int w, int h, int *row_bytes), void (*free_update_region) (int x, int y, int w, int h, void *data));
+static void *_output_setup(int w, int h, void *dest_buffer, int dest_buffer_row_bytes, int depth_type, int use_color_key, int alpha_threshold, int color_key_r, int color_key_g, int color_key_b, void *(*new_update_region) (int x, int y, int w, int h, int *row_bytes), void (*free_update_region) (int x, int y, int w, int h, void *data), void *(*switch_buffer) (void *data, void *dest_buffer), void *switch_data);
static void *eng_info(Evas *e __UNUSED__);
static void eng_info_free(Evas *e __UNUSED__, void *info);
int color_key_g,
int color_key_b,
void *(*new_update_region) (int x, int y, int w, int h, int *row_bytes),
- void (*free_update_region) (int x, int y, int w, int h, void *data)
+ void (*free_update_region) (int x, int y, int w, int h, void *data),
+ void *(*switch_buffer) (void *data, void *dest_buffer),
+ void *switch_data
)
{
Render_Engine *re;
evas_common_tilebuf_init();
evas_buffer_outbuf_buf_init();
-
+
{
Outbuf_Depth dep;
DATA32 color_key = 0;
color_key,
alpha_threshold,
new_update_region,
- free_update_region);
+ free_update_region,
+ switch_buffer,
+ switch_data);
}
re->tb = evas_common_tilebuf_new(w, h);
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
+ eina_inarray_setup(&re->previous_rects, sizeof (Eina_Rectangle), 8);
return re;
}
info->info.color_key_g,
info->info.color_key_b,
info->info.func.new_update_region,
- info->info.func.free_update_region);
+ info->info.func.free_update_region,
+ info->info.func.switch_buffer,
+ info->info.switch_data);
if (e->engine.data.output)
eng_output_free(e->engine.data.output);
e->engine.data.output = re;
char use_color_key;
void * (*new_update_region) (int x, int y, int w, int h, int *row_bytes);
void (*free_update_region) (int x, int y, int w, int h, void *data);
+ void * (*switch_buffer) (void *switch_data, void *dest);
+ void *switch_data;
depth = re->ob->depth;
dest = re->ob->dest;
use_color_key = re->ob->use_color_key;
new_update_region = re->ob->func.new_update_region;
free_update_region = re->ob->func.free_update_region;
+ switch_buffer = re->ob->func.switch_buffer;
+ switch_data = re->ob->switch_data;
evas_buffer_outbuf_buf_free(re->ob);
re->ob = evas_buffer_outbuf_buf_setup_fb(w,
h,
color_key,
alpha_level,
new_update_region,
- free_update_region);
+ free_update_region,
+ switch_buffer,
+ switch_data);
}
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
if (!re->rects)
{
re->rects = evas_common_tilebuf_get_render_rects(re->tb);
+
+ /* handle double buffering */
+ if (re->ob->func.switch_buffer)
+ {
+ Eina_Rectangle *pushing;
+
+ if (re->ob->first_frame && !re->previous_rects.len)
+ {
+ evas_common_tilebuf_add_redraw(re->tb, 0, 0, re->ob->w, re->ob->h);
+ re->ob->first_frame = 0;
+ }
+
+ /* push previous frame */
+ EINA_INARRAY_FOREACH(&re->previous_rects, pushing)
+ evas_common_tilebuf_add_redraw(re->tb, pushing->x, pushing->y, pushing->w, pushing->h);
+ eina_inarray_flush(&re->previous_rects);
+
+ /* save current list of damage */
+ EINA_INLIST_FOREACH(re->rects, rect)
+ {
+ Eina_Rectangle local;
+
+ EINA_RECTANGLE_SET(&local, rect->x, rect->y, rect->w, rect->h);
+ eina_inarray_append(&re->previous_rects, &local);
+ }
+
+ /* and regenerate the damage list by tacking into account the damage over two frames */
+ evas_common_tilebuf_free_render_rects(re->rects);
+ re->rects = evas_common_tilebuf_get_render_rects(re->tb);
+ }
+
re->cur_rect = EINA_INLIST_GET(re->rects);
}
if (!re->cur_rect) return NULL;
re = (Render_Engine *)data;
#ifdef BUILD_PIPE_RENDER
evas_common_pipe_map_begin(surface);
-#endif
+#endif
evas_buffer_outbuf_buf_push_updated_region(re->ob, surface, x, y, w, h);
evas_buffer_outbuf_buf_free_region_for_update(re->ob, surface);
evas_common_cpu_end_opt();
Render_Engine *re;
re = (Render_Engine *)data;
+ evas_buffer_outbuf_buf_switch_buffer(re->ob);
}
static void
void *dest;
unsigned int dest_row_bytes;
+ void *switch_data;
int alpha_level;
DATA32 color_key;
char use_color_key : 1;
+ char first_frame : 1;
struct {
void * (*new_update_region) (int x, int y, int w, int h, int *row_bytes);
void (*free_update_region) (int x, int y, int w, int h, void *data);
+ void * (*switch_buffer) (void *data, void *dest_buffer);
} func;
struct {
Outbuf *evas_buffer_outbuf_buf_setup_fb (int w, int h, Outbuf_Depth depth, void *dest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level,
void * (*new_update_region) (int x, int y, int w, int h, int *row_bytes),
- void (*free_update_region) (int x, int y, int w, int h, void *data));
+ void (*free_update_region) (int x, int y, int w, int h, void *data),
+ void * (*switch_buffer)(void *switch_data, void *dest),
+ void *switch_data);
RGBA_Image *evas_buffer_outbuf_buf_new_region_for_update (Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
void evas_buffer_outbuf_buf_free_region_for_update (Outbuf *buf, RGBA_Image *update);
void evas_buffer_outbuf_buf_push_updated_region (Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h);
+void evas_buffer_outbuf_buf_switch_buffer (Outbuf *buf);
#endif
Outbuf *
evas_buffer_outbuf_buf_setup_fb(int w, int h, Outbuf_Depth depth, void *dest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level,
void * (*new_update_region) (int x, int y, int w, int h, int *row_bytes),
- void (*free_update_region) (int x, int y, int w, int h, void *data)
+ void (*free_update_region) (int x, int y, int w, int h, void *data),
+ void * (*switch_buffer) (void *data, void *dest_buffer),
+ void *switch_data
)
{
Outbuf *buf;
buf->alpha_level = alpha_level;
buf->color_key = color_key;
buf->use_color_key = use_color_key;
+ buf->first_frame = 1;
buf->func.new_update_region = new_update_region;
buf->func.free_update_region = free_update_region;
+ buf->func.switch_buffer = switch_buffer;
+ buf->switch_data = switch_data;
bpp = sizeof(DATA32);
if ((buf->depth == OUTBUF_DEPTH_RGB_24BPP_888_888) ||
}
void
+evas_buffer_outbuf_buf_switch_buffer(Outbuf *buf)
+{
+ if (buf->func.switch_buffer)
+ {
+ buf->dest = buf->func.switch_buffer(buf->switch_data, buf->dest);
+ if (buf->priv.back_buf)
+ {
+ evas_cache_image_drop(&buf->priv.back_buf->cache_entry);
+ buf->priv.back_buf = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
+ buf->w, buf->h,
+ buf->dest,
+ buf->depth == OUTBUF_DEPTH_ARGB_32BPP_8888_8888 ? 1 : 0,
+ EVAS_COLORSPACE_ARGB8888);
+ }
+ }
+}
+
+void
evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h)
{
/* copy update image to out buf & convert */