* evas: make map work with threaded rendering.

SVN revision: 47429
This commit is contained in:
Cedric BAIL 2010-03-24 16:39:39 +00:00
parent f715c8584d
commit 1a51c662bf
11 changed files with 137 additions and 34 deletions

View File

@ -5,26 +5,6 @@
#ifndef _EVAS_MAP_H
#define _EVAS_MAP_H
typedef struct _RGBA_Map_Point RGBA_Map_Point;
// all coords are 20.12
// fp type - an int for now
typedef int FPc;
// fp # of bits of float accuracy
#define FP 8
// fp half (half of an fp unit)
#define FPH (1 << (FP - 1))
// one fp unit
#define FP1 (1 << (FP))
struct _RGBA_Map_Point
{
FPc x, y; // x, y screenspace
FPc z; // z in world space. optional
FPc u, v; // u, v in tex coords
DATA32 col; // color at this point
};
EAPI void
evas_common_map4_rgba(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc,

View File

@ -676,4 +676,100 @@ evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst,
op->free_func = evas_common_pipe_op_image_free;
evas_common_pipe_draw_context_copy(dc, op);
}
static void
evas_common_pipe_op_map4_free(RGBA_Pipe_Op *op)
{
op->op.map4.src->ref--;
if (op->op.map4.src->ref == 0)
evas_cache_image_drop(&op->op.map4.src->cache_entry);
free(op->op.map4.p);
evas_common_pipe_op_free(op);
}
static void
evas_common_pipe_map4_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info)
{
if (info)
{
RGBA_Draw_Context context;
memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
#ifdef EVAS_SLI
evas_common_draw_context_set_sli(&(context), info->y, info->h);
#else
evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
#endif
evas_common_map4_rgba(op->op.map4.src, dst,
&context, op->op.map4.p,
op->op.map4.smooth, op->op.map4.level);
}
else
{
evas_common_map4_rgba(op->op.map4.src, dst,
&(op->context), op->op.map4.p,
op->op.map4.smooth, op->op.map4.level);
}
}
EAPI void
evas_common_pipe_map4_draw(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc, RGBA_Map_Point *p,
int smooth, int level)
{
RGBA_Pipe_Op *op;
RGBA_Map_Point *pts_copy;
int i;
if (!src) return;
pts_copy = malloc(sizeof (RGBA_Map_Point) * 4);
if (!pts_copy) return;
dst->pipe = evas_common_pipe_add(dst->pipe, &op);
if (!dst->pipe)
{
free(pts_copy);
return;
}
for (i = 0; i < 4; ++i)
pts_copy[i] = p[i];
op->op.map4.smooth = smooth;
op->op.map4.level = level;
src->ref++;
op->op.map4.src = src;
op->op.map4.p = pts_copy;
op->op_func = evas_common_pipe_map4_draw_do;
op->free_func = evas_common_pipe_op_map4_free;
evas_common_pipe_draw_context_copy(dc, op);
}
EAPI void
evas_common_pipe_map4_begin(RGBA_Image *root)
{
RGBA_Pipe *p;
int i;
/* Map imply that we need to process them recursively first. */
for (p = root->pipe; p; p = (RGBA_Pipe *)(EINA_INLIST_GET(p))->next)
{
for (i = 0; i < p->op_num; i++)
{
if (p->op[i].op_func == evas_common_pipe_map4_draw_do)
{
if (p->op[i].op.map4.src->pipe)
evas_common_pipe_map4_begin(p->op[i].op.map4.src);
}
else if (p->op[i].op_func == evas_common_pipe_image_draw_do)
{
if (p->op[i].op.image.src->pipe)
evas_common_pipe_map4_begin(p->op[i].op.image.src);
}
}
}
evas_common_pipe_begin(root);
evas_common_pipe_flush(root);
}
#endif

View File

@ -16,6 +16,8 @@ EAPI void evas_common_pipe_grad_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int
EAPI void evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, RGBA_Gradient2 *gr);
EAPI void evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int x, int y, const char *text);
EAPI void evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int smooth, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
EAPI void evas_common_pipe_map4_draw(RGBA_Image *src, RGBA_Image *dst,
RGBA_Draw_Context *dc, RGBA_Map_Point *p,
int smooth, int level);
#endif /* _EVAS_PIPE_H */

View File

@ -362,6 +362,7 @@ typedef struct _RGBA_Gradient2 RGBA_Gradient2;
typedef struct _RGBA_Gradient2_Type RGBA_Gradient2_Type;
typedef struct _RGBA_Gradient2_Color_Np_Stop RGBA_Gradient2_Color_Np_Stop;
typedef struct _RGBA_Polygon_Point RGBA_Polygon_Point;
typedef struct _RGBA_Map_Point RGBA_Map_Point;
typedef struct _RGBA_Font RGBA_Font;
typedef struct _RGBA_Font_Int RGBA_Font_Int;
typedef struct _RGBA_Font_Source RGBA_Font_Source;
@ -379,6 +380,17 @@ typedef struct _Tilebuf_Rect Tilebuf_Rect;
typedef struct _Evas_Common_Transform Evas_Common_Transform;
// RGBA_Map_Point
// all coords are 20.12
// fp type - an int for now
typedef int FPc;
// fp # of bits of float accuracy
#define FP 8
// fp half (half of an fp unit)
#define FPH (1 << (FP - 1))
// one fp unit
#define FP1 (1 << (FP))
/*
typedef struct _Regionbuf Regionbuf;
typedef struct _Regionspan Regionspan;
@ -652,6 +664,12 @@ struct _RGBA_Pipe_Op
int smooth;
char *text;
} image;
struct {
RGBA_Image *src;
RGBA_Map_Point *p;
int smooth;
int level;
} map4;
} op;
};
@ -853,6 +871,14 @@ struct _RGBA_Polygon_Point
int x, y;
};
struct _RGBA_Map_Point
{
FPc x, y; // x, y screenspace
FPc z; // z in world space. optional
FPc u, v; // u, v in tex coords
DATA32 col; // color at this point
};
// for fonts...
/////
typedef struct _Fash_Item_Index_Map Fash_Item_Index_Map;

View File

@ -306,8 +306,7 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
re = (Render_Engine *)data;
#ifdef BUILD_PIPE_RENDER
evas_common_pipe_begin(surface);
evas_common_pipe_flush(surface);
evas_common_pipe_map4_begin(surface);
#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);

View File

@ -223,8 +223,7 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
re = (Render_Engine *)data;
#ifdef BUILD_PIPE_RENDER
evas_common_pipe_begin(surface);
evas_common_pipe_flush(surface);
evas_common_pipe_map4_begin(surface);
#endif
evas_fb_outbuf_fb_push_updated_region(re->ob, surface, x, y, w, h);
evas_fb_outbuf_fb_free_region_for_update(re->ob, surface);

View File

@ -287,8 +287,7 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
re = (Render_Engine *)data;
#ifdef BUILD_PIPE_RENDER
evas_common_pipe_begin(surface);
evas_common_pipe_flush(surface);
evas_common_pipe_map4_begin(surface);
#endif
evas_software_ddraw_outbuf_push_updated_region(re->ob, surface, x, y, w, h);
evas_software_ddraw_outbuf_free_region_for_update(re->ob, surface);

View File

@ -294,8 +294,7 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
re = (Render_Engine *)data;
#ifdef BUILD_PIPE_RENDER
evas_common_pipe_begin(surface);
evas_common_pipe_flush(surface);
evas_common_pipe_map4_begin(surface);
#endif
evas_software_gdi_outbuf_push_updated_region(re->ob, surface, x, y, w, h);
evas_software_gdi_outbuf_free_region_for_update(re->ob, surface);

View File

@ -814,7 +814,12 @@ eng_image_map4_draw(void *data __UNUSED__, void *context, void *surface, void *i
dx, dy, dw, dh, smooth);
}
else
evas_common_map4_rgba(im, surface, context, p, smooth, level);
#ifdef BUILD_PIPE_RENDER
if (cpunum > 1)
evas_common_pipe_map4_draw(im, surface, context, p, smooth, level);
else
#endif
evas_common_map4_rgba(im, surface, context, p, smooth, level);
evas_common_cpu_end_opt();
}

View File

@ -237,8 +237,7 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
re = (Render_Engine *)data;
#ifdef BUILD_PIPE_RENDER
evas_common_pipe_begin(surface);
evas_common_pipe_flush(surface);
evas_common_pipe_map4_begin(surface);
#endif
evas_qtopia_outbuf_software_qtopia_push_updated_region(re->ob, surface, x, y, w, h);
evas_qtopia_outbuf_software_qtopia_free_region_for_update(re->ob, surface);

View File

@ -661,8 +661,7 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
re = (Render_Engine *)data;
#ifdef BUILD_PIPE_RENDER
evas_common_pipe_begin(surface);
evas_common_pipe_flush(surface);
evas_common_pipe_map4_begin(surface);
#endif
re->outbuf_push_updated_region(re->ob, surface, x, y, w, h);
re->outbuf_free_region_for_update(re->ob, surface);