forked from enlightenment/efl
allow for a callback rtoo to provid e adest buffer when needed
SVN revision: 6840
This commit is contained in:
parent
98d327b588
commit
b699523d67
|
@ -25,6 +25,10 @@ struct _Evas_Engine_Info_Buffer
|
||||||
int color_key_r;
|
int color_key_r;
|
||||||
int color_key_g;
|
int color_key_g;
|
||||||
int color_key_b;
|
int color_key_b;
|
||||||
|
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);
|
||||||
|
} func;
|
||||||
} info;
|
} info;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,7 +17,9 @@ static void *evas_engine_buffer_output_setup(int w,
|
||||||
int alpha_threshold,
|
int alpha_threshold,
|
||||||
int color_key_r,
|
int color_key_r,
|
||||||
int color_key_g,
|
int color_key_g,
|
||||||
int color_key_b
|
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 evas_engine_buffer_output_free(void *data);
|
static void evas_engine_buffer_output_free(void *data);
|
||||||
static void evas_engine_buffer_output_resize(void *data, int w, int h);
|
static void evas_engine_buffer_output_resize(void *data, int w, int h);
|
||||||
|
@ -207,7 +209,9 @@ evas_engine_buffer_setup(Evas *e, void *in)
|
||||||
info->info.alpha_threshold,
|
info->info.alpha_threshold,
|
||||||
info->info.color_key_r,
|
info->info.color_key_r,
|
||||||
info->info.color_key_g,
|
info->info.color_key_g,
|
||||||
info->info.color_key_b);
|
info->info.color_key_b,
|
||||||
|
info->info.func.new_update_region,
|
||||||
|
info->info.func.free_update_region);
|
||||||
e->engine.data.output = re;
|
e->engine.data.output = re;
|
||||||
if (!e->engine.data.output) return;
|
if (!e->engine.data.output) return;
|
||||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||||
|
@ -223,7 +227,9 @@ evas_engine_buffer_output_setup(int w,
|
||||||
int alpha_threshold,
|
int alpha_threshold,
|
||||||
int color_key_r,
|
int color_key_r,
|
||||||
int color_key_g,
|
int color_key_g,
|
||||||
int color_key_b
|
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)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Render_Engine *re;
|
Render_Engine *re;
|
||||||
|
@ -246,7 +252,6 @@ evas_engine_buffer_output_setup(int w,
|
||||||
|
|
||||||
evas_buffer_outbuf_buf_init();
|
evas_buffer_outbuf_buf_init();
|
||||||
|
|
||||||
/* get any stored performance metrics from device (xserver) */
|
|
||||||
{
|
{
|
||||||
Outbuf_Depth dep;
|
Outbuf_Depth dep;
|
||||||
DATA32 color_key;
|
DATA32 color_key;
|
||||||
|
@ -271,7 +276,9 @@ evas_engine_buffer_output_setup(int w,
|
||||||
dest_buffer_row_bytes,
|
dest_buffer_row_bytes,
|
||||||
use_color_key,
|
use_color_key,
|
||||||
color_key,
|
color_key,
|
||||||
alpha_threshold);
|
alpha_threshold,
|
||||||
|
new_update_region,
|
||||||
|
free_update_region);
|
||||||
}
|
}
|
||||||
re->tb = evas_common_tilebuf_new(w, h);
|
re->tb = evas_common_tilebuf_new(w, h);
|
||||||
/* in preliminary tests 16x16 gave highest framerates */
|
/* in preliminary tests 16x16 gave highest framerates */
|
||||||
|
@ -298,20 +305,23 @@ evas_engine_buffer_output_resize(void *data, int w, int h)
|
||||||
|
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
{
|
{
|
||||||
int depth;
|
int depth;
|
||||||
void *dest;
|
void *dest;
|
||||||
int dest_row_bytes;
|
int dest_row_bytes;
|
||||||
int alpha_level;
|
int alpha_level;
|
||||||
DATA32 color_key;
|
DATA32 color_key;
|
||||||
char use_color_key;
|
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);
|
||||||
|
|
||||||
depth = re->ob->depth;
|
depth = re->ob->depth;
|
||||||
dest = re->ob->dest;
|
dest = re->ob->dest;
|
||||||
dest_row_bytes = re->ob->dest_row_bytes;
|
dest_row_bytes = re->ob->dest_row_bytes;
|
||||||
alpha_level = re->ob->alpha_level;
|
alpha_level = re->ob->alpha_level;
|
||||||
color_key = re->ob->color_key;
|
color_key = re->ob->color_key;
|
||||||
use_color_key = re->ob->use_color_key;
|
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;
|
||||||
evas_buffer_outbuf_buf_free(re->ob);
|
evas_buffer_outbuf_buf_free(re->ob);
|
||||||
re->ob = evas_buffer_outbuf_buf_setup_fb(w,
|
re->ob = evas_buffer_outbuf_buf_setup_fb(w,
|
||||||
h,
|
h,
|
||||||
|
@ -320,7 +330,9 @@ evas_engine_buffer_output_resize(void *data, int w, int h)
|
||||||
dest_row_bytes,
|
dest_row_bytes,
|
||||||
use_color_key,
|
use_color_key,
|
||||||
color_key,
|
color_key,
|
||||||
alpha_level);
|
alpha_level,
|
||||||
|
new_update_region,
|
||||||
|
free_update_region);
|
||||||
}
|
}
|
||||||
evas_common_tilebuf_free(re->tb);
|
evas_common_tilebuf_free(re->tb);
|
||||||
re->tb = evas_common_tilebuf_new(w, h);
|
re->tb = evas_common_tilebuf_new(w, h);
|
||||||
|
|
|
@ -26,6 +26,11 @@ struct _Outbuf
|
||||||
int alpha_level;
|
int alpha_level;
|
||||||
DATA32 color_key;
|
DATA32 color_key;
|
||||||
char use_color_key : 1;
|
char use_color_key : 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);
|
||||||
|
} func;
|
||||||
};
|
};
|
||||||
|
|
||||||
/****/
|
/****/
|
||||||
|
@ -33,7 +38,10 @@ struct _Outbuf
|
||||||
void evas_buffer_outbuf_buf_init (void);
|
void evas_buffer_outbuf_buf_init (void);
|
||||||
void evas_buffer_outbuf_buf_free (Outbuf *buf);
|
void evas_buffer_outbuf_buf_free (Outbuf *buf);
|
||||||
|
|
||||||
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);
|
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));
|
||||||
|
|
||||||
|
|
||||||
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);
|
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_free_region_for_update (Outbuf *buf, RGBA_Image *update);
|
||||||
|
|
|
@ -15,7 +15,10 @@ evas_buffer_outbuf_buf_free(Outbuf *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
Outbuf *
|
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)
|
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)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Outbuf *buf;
|
Outbuf *buf;
|
||||||
|
|
||||||
|
@ -32,7 +35,9 @@ evas_buffer_outbuf_buf_setup_fb(int w, int h, Outbuf_Depth depth, void *dest, in
|
||||||
buf->alpha_level = alpha_level;
|
buf->alpha_level = alpha_level;
|
||||||
buf->color_key = color_key;
|
buf->color_key = color_key;
|
||||||
buf->use_color_key = use_color_key;
|
buf->use_color_key = use_color_key;
|
||||||
|
|
||||||
|
buf->func.new_update_region = new_update_region;
|
||||||
|
buf->func.free_update_region = free_update_region;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,17 +73,26 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
|
||||||
{
|
{
|
||||||
DATA8 thresh;
|
DATA8 thresh;
|
||||||
int xx, yy;
|
int xx, yy;
|
||||||
|
int row_bytes;
|
||||||
|
DATA8 *dest;
|
||||||
DATA32 colorkey;
|
DATA32 colorkey;
|
||||||
DATA32 *src;
|
DATA32 *src;
|
||||||
DATA8 *dst;
|
DATA8 *dst;
|
||||||
|
|
||||||
colorkey = buf->color_key;
|
colorkey = buf->color_key;
|
||||||
thresh = buf->alpha_level;
|
thresh = buf->alpha_level;
|
||||||
|
row_bytes = buf->dest_row_bytes;
|
||||||
|
dest = (DATA8 *)(buf->dest) + (y * row_bytes) + (x * 3);
|
||||||
|
if (buf->func.new_update_region)
|
||||||
|
{
|
||||||
|
dest = buf->func.new_update_region(x, y, w, h, &row_bytes);
|
||||||
|
}
|
||||||
|
if (!dest) break;
|
||||||
if (buf->use_color_key)
|
if (buf->use_color_key)
|
||||||
{
|
{
|
||||||
for (yy = 0; yy < h; yy++)
|
for (yy = 0; yy < h; yy++)
|
||||||
{
|
{
|
||||||
dst = (DATA8 *)(buf->dest) + ((y + yy) * buf->dest_row_bytes) + (x * 3);
|
dst = dest + (yy * row_bytes);
|
||||||
src = update->image->data + (yy * update->image->w);
|
src = update->image->data + (yy * update->image->w);
|
||||||
for (xx = 0; xx < w; xx++)
|
for (xx = 0; xx < w; xx++)
|
||||||
{
|
{
|
||||||
|
@ -102,7 +116,7 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
|
||||||
{
|
{
|
||||||
for (yy = 0; yy < h; yy++)
|
for (yy = 0; yy < h; yy++)
|
||||||
{
|
{
|
||||||
dst = (DATA8 *)(buf->dest) + ((y + yy) * buf->dest_row_bytes) + (x * 3);
|
dst = dest + (yy * row_bytes);
|
||||||
src = update->image->data + (yy * update->image->w);
|
src = update->image->data + (yy * update->image->w);
|
||||||
for (xx = 0; xx < w; xx++)
|
for (xx = 0; xx < w; xx++)
|
||||||
{
|
{
|
||||||
|
@ -113,6 +127,10 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (buf->func.free_update_region)
|
||||||
|
{
|
||||||
|
buf->func.free_update_region(x, y, w, h, dest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OUTBUF_DEPTH_BGR_24BPP_888_888:
|
case OUTBUF_DEPTH_BGR_24BPP_888_888:
|
||||||
|
@ -120,17 +138,26 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
|
||||||
{
|
{
|
||||||
DATA8 thresh;
|
DATA8 thresh;
|
||||||
int xx, yy;
|
int xx, yy;
|
||||||
|
int row_bytes;
|
||||||
|
DATA8 *dest;
|
||||||
DATA32 colorkey;
|
DATA32 colorkey;
|
||||||
DATA32 *src;
|
DATA32 *src;
|
||||||
DATA8 *dst;
|
DATA8 *dst;
|
||||||
|
|
||||||
colorkey = buf->color_key;
|
colorkey = buf->color_key;
|
||||||
thresh = buf->alpha_level;
|
thresh = buf->alpha_level;
|
||||||
|
row_bytes = buf->dest_row_bytes;
|
||||||
|
dest = (DATA8 *)(buf->dest) + (y * row_bytes) + (x * 3);
|
||||||
|
if (buf->func.new_update_region)
|
||||||
|
{
|
||||||
|
dest = buf->func.new_update_region(x, y, w, h, &row_bytes);
|
||||||
|
}
|
||||||
|
if (!dest) break;
|
||||||
if (buf->use_color_key)
|
if (buf->use_color_key)
|
||||||
{
|
{
|
||||||
for (yy = 0; yy < h; yy++)
|
for (yy = 0; yy < h; yy++)
|
||||||
{
|
{
|
||||||
dst = (DATA8 *)(buf->dest) + ((y + yy) * buf->dest_row_bytes) + (x * 3);
|
dst = dest + (yy * row_bytes);
|
||||||
src = update->image->data + (yy * update->image->w);
|
src = update->image->data + (yy * update->image->w);
|
||||||
for (xx = 0; xx < w; xx++)
|
for (xx = 0; xx < w; xx++)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +181,7 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
|
||||||
{
|
{
|
||||||
for (yy = 0; yy < h; yy++)
|
for (yy = 0; yy < h; yy++)
|
||||||
{
|
{
|
||||||
dst = (DATA8 *)(buf->dest) + ((y + yy) * buf->dest_row_bytes) + (x * 3);
|
dst = dest + (yy * row_bytes);
|
||||||
src = update->image->data + (yy * update->image->w);
|
src = update->image->data + (yy * update->image->w);
|
||||||
for (xx = 0; xx < w; xx++)
|
for (xx = 0; xx < w; xx++)
|
||||||
{
|
{
|
||||||
|
@ -165,6 +192,10 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (buf->func.free_update_region)
|
||||||
|
{
|
||||||
|
buf->func.free_update_region(x, y, w, h, dest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OUTBUF_DEPTH_RGB_32BPP_888_8888:
|
case OUTBUF_DEPTH_RGB_32BPP_888_8888:
|
||||||
|
|
Loading…
Reference in New Issue