forked from enlightenment/efl
evas/common: Prepare soil to land map code for threaded render
SVN revision: 81189
This commit is contained in:
parent
b4ceb3f2ba
commit
aa03e70141
|
@ -640,11 +640,67 @@ evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst,
|
||||||
|
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
#undef FUNC_NAME_DO
|
#undef FUNC_NAME_DO
|
||||||
#define FUNC_NAME evas_common_map_rgba_internal
|
#define FUNC_NAME _evas_common_map_rgba_internal
|
||||||
#define FUNC_NAME_DO evas_common_map_rgba_internal_do
|
#define FUNC_NAME_DO evas_common_map_rgba_internal_do
|
||||||
#undef SCALE_USING_MMX
|
#undef SCALE_USING_MMX
|
||||||
#include "evas_map_image_internal.c"
|
#include "evas_map_image_internal.c"
|
||||||
|
|
||||||
|
#ifdef BUILD_MMX
|
||||||
|
void evas_common_map_rgba_internal_mmx(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map_Point *p, int smooth, int level)
|
||||||
|
{
|
||||||
|
int clip_x, clip_y, clip_w, clip_h;
|
||||||
|
DATA32 mul_col;
|
||||||
|
|
||||||
|
if (dc->clip.use)
|
||||||
|
{
|
||||||
|
clip_x = dc->clip.x;
|
||||||
|
clip_y = dc->clip.y;
|
||||||
|
clip_w = dc->clip.w;
|
||||||
|
clip_h = dc->clip.h;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clip_x = clip_y = 0;
|
||||||
|
clip_w = dst->cache_entry.w;
|
||||||
|
clip_h = dst->cache_entry.h;
|
||||||
|
}
|
||||||
|
|
||||||
|
mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
|
||||||
|
|
||||||
|
_evas_common_map_rgba_internal_mmx(src, dst,
|
||||||
|
clip_x, clip_y, clip_w, clip_h,
|
||||||
|
mul_col, dc->render_op,
|
||||||
|
p, smooth, level);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void evas_common_map_rgba_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map_Point *p, int smooth, int level)
|
||||||
|
{
|
||||||
|
int clip_x, clip_y, clip_w, clip_h;
|
||||||
|
DATA32 mul_col;
|
||||||
|
|
||||||
|
if (dc->clip.use)
|
||||||
|
{
|
||||||
|
clip_x = dc->clip.x;
|
||||||
|
clip_y = dc->clip.y;
|
||||||
|
clip_w = dc->clip.w;
|
||||||
|
clip_h = dc->clip.h;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clip_x = clip_y = 0;
|
||||||
|
clip_w = dst->cache_entry.w;
|
||||||
|
clip_h = dst->cache_entry.h;
|
||||||
|
}
|
||||||
|
|
||||||
|
mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
|
||||||
|
|
||||||
|
_evas_common_map_rgba_internal(src, dst,
|
||||||
|
clip_x, clip_y, clip_w, clip_h,
|
||||||
|
mul_col, dc->render_op,
|
||||||
|
p, smooth, level);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
|
evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
|
||||||
RGBA_Draw_Context *dc,
|
RGBA_Draw_Context *dc,
|
||||||
|
@ -694,6 +750,56 @@ evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
|
||||||
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
|
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
evas_common_map_thread_rgba_cb(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map *map, int smooth, int level, int offset, Evas_Common_Map_Thread_RGBA_Cb cb)
|
||||||
|
{
|
||||||
|
static Cutout_Rects *rects = NULL;
|
||||||
|
Cutout_Rect *r;
|
||||||
|
int c, cx, cy, cw, ch;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (src->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
|
||||||
|
{
|
||||||
|
#ifdef EVAS_CSERVE2
|
||||||
|
if (evas_cserve2_use_get())
|
||||||
|
evas_cache2_image_load_data(&src->cache_entry);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
evas_cache_image_load_data(&src->cache_entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
evas_common_image_colorspace_normalize(src);
|
||||||
|
|
||||||
|
if (!src->image.data) return;
|
||||||
|
|
||||||
|
if ((!dc->cutout.rects) && (!dc->clip.use))
|
||||||
|
{
|
||||||
|
cb(src, dst, dc, map, smooth, level, offset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* save out clip info */
|
||||||
|
c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h;
|
||||||
|
evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
|
||||||
|
/* our clip is 0 size.. abort */
|
||||||
|
if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
|
||||||
|
{
|
||||||
|
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rects = evas_common_draw_context_apply_cutouts(dc, rects);
|
||||||
|
for (i = 0; i < rects->active; ++i)
|
||||||
|
{
|
||||||
|
r = rects->rects + i;
|
||||||
|
evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
|
||||||
|
cb(src, dst, dc, map, smooth, level, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* restore clip info */
|
||||||
|
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
|
evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
|
||||||
RGBA_Draw_Context *dc,
|
RGBA_Draw_Context *dc,
|
||||||
|
@ -714,6 +820,26 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
|
||||||
evas_common_map_rgba_cb(src, dst, dc, npoints, p, smooth, level, cb);
|
evas_common_map_rgba_cb(src, dst, dc, npoints, p, smooth, level, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints EINA_UNUSED, RGBA_Map_Point *p, int smooth, int level)
|
||||||
|
{
|
||||||
|
#ifdef BUILD_MMX
|
||||||
|
int mmx, sse, sse2;
|
||||||
|
|
||||||
|
evas_common_cpu_can_do(&mmx, &sse, &sse2);
|
||||||
|
if (mmx)
|
||||||
|
_evas_common_map_rgba_internal_mmx(src, dst,
|
||||||
|
clip_x, clip_y, clip_w, clip_h,
|
||||||
|
mul_col, render_op,
|
||||||
|
p, smooth, level);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
_evas_common_map_rgba_internal(src, dst,
|
||||||
|
clip_x, clip_y, clip_w, clip_h,
|
||||||
|
mul_col, render_op,
|
||||||
|
p, smooth, level);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_map_rgba_do(const Eina_Rectangle *clip,
|
evas_common_map_rgba_do(const Eina_Rectangle *clip,
|
||||||
RGBA_Image *src, RGBA_Image *dst,
|
RGBA_Image *src, RGBA_Image *dst,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef _EVAS_MAP_H
|
#ifndef _EVAS_MAP_H
|
||||||
#define _EVAS_MAP_H
|
#define _EVAS_MAP_H
|
||||||
|
|
||||||
typedef void (*Evas_Common_Map_RGBA_Cb)(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map_Point *p, int smooth, int level);
|
typedef void (*Evas_Common_Map_RGBA_Cb) (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map_Point *p, int smooth, int level);
|
||||||
|
typedef void (*Evas_Common_Map_Thread_RGBA_Cb) (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map *map, int smooth, int level, int offset);
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
|
evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
|
||||||
|
@ -9,12 +10,17 @@ evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
|
||||||
int npoints, RGBA_Map_Point *points,
|
int npoints, RGBA_Map_Point *points,
|
||||||
int smooth, int level,
|
int smooth, int level,
|
||||||
Evas_Common_Map_RGBA_Cb cb);
|
Evas_Common_Map_RGBA_Cb cb);
|
||||||
|
|
||||||
|
EAPI void evas_common_map_thread_rgba_cb(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map *map, int smooth, int level, int offset, Evas_Common_Map_Thread_RGBA_Cb cb);
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
|
evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
|
||||||
RGBA_Draw_Context *dc,
|
RGBA_Draw_Context *dc,
|
||||||
int npoints, RGBA_Map_Point *points,
|
int npoints, RGBA_Map_Point *points,
|
||||||
int smooth, int level);
|
int smooth, int level);
|
||||||
|
|
||||||
|
EAPI void evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints, RGBA_Map_Point *p, int smooth, int level);
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst,
|
evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst,
|
||||||
RGBA_Draw_Context *dc,
|
RGBA_Draw_Context *dc,
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
{
|
{
|
||||||
d = dst->image.data;
|
d = dst->image.data;
|
||||||
d += (y * dst->cache_entry.w) + x;
|
d += (y * dst->cache_entry.w) + x;
|
||||||
func(buf, NULL, dc->mul.col, d, w);
|
func(buf, NULL, mul_col, d, w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
|
@ -216,7 +216,7 @@
|
||||||
{
|
{
|
||||||
d = dst->image.data;
|
d = dst->image.data;
|
||||||
d += (y * dst->cache_entry.w) + x;
|
d += (y * dst->cache_entry.w) + x;
|
||||||
func(buf, NULL, dc->mul.col, d, w);
|
func(buf, NULL, mul_col, d, w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
// 66.74 % of time
|
// 66.74 % of time
|
||||||
static void
|
static void
|
||||||
FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
|
FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
|
||||||
RGBA_Draw_Context *dc,
|
int clip_x, int clip_y, int clip_w, int clip_h,
|
||||||
RGBA_Map_Point *p,
|
DATA32 mul_col, int render_op,
|
||||||
|
RGBA_Map_Point *p,
|
||||||
int smooth, int level EINA_UNUSED) // level unused for now - for future use
|
int smooth, int level EINA_UNUSED) // level unused for now - for future use
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int c, cx, cy, cw, ch;
|
int cx, cy, cw, ch;
|
||||||
int ytop, ybottom, ystart, yend, y, sw, shp, swp, direct;
|
int ytop, ybottom, ystart, yend, y, sw, shp, swp, direct;
|
||||||
Line *spans;
|
Line *spans;
|
||||||
DATA32 *buf = NULL, *sp;
|
DATA32 *buf = NULL, *sp;
|
||||||
|
@ -14,16 +15,11 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
|
||||||
int havea = 0;
|
int havea = 0;
|
||||||
int havecol = 4;
|
int havecol = 4;
|
||||||
|
|
||||||
// get the clip
|
cx = clip_x;
|
||||||
c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h;
|
cy = clip_y;
|
||||||
if (!c)
|
cw = clip_w;
|
||||||
{
|
ch = clip_h;
|
||||||
cx = 0;
|
|
||||||
cy = 0;
|
|
||||||
cw = dst->cache_entry.w;
|
|
||||||
ch = dst->cache_entry.h;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find y yop line and y bottom line
|
// find y yop line and y bottom line
|
||||||
ytop = p[0].y;
|
ytop = p[0].y;
|
||||||
if ((p[0].col >> 24) < 0xff) havea = 1;
|
if ((p[0].col >> 24) < 0xff) havea = 1;
|
||||||
|
@ -84,7 +80,7 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
|
||||||
// if operation is solid, bypass buf and draw func and draw direct to dst
|
// if operation is solid, bypass buf and draw func and draw direct to dst
|
||||||
direct = 0;
|
direct = 0;
|
||||||
if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
|
if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
|
||||||
(!dc->mul.use) && (!havea))
|
(mul_col == 0xffffffff) && (!havea))
|
||||||
{
|
{
|
||||||
direct = 1;
|
direct = 1;
|
||||||
}
|
}
|
||||||
|
@ -95,10 +91,10 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
|
||||||
buf = alloca(cw * sizeof(DATA32));
|
buf = alloca(cw * sizeof(DATA32));
|
||||||
pa = src->cache_entry.flags.alpha;
|
pa = src->cache_entry.flags.alpha;
|
||||||
if (havea) src->cache_entry.flags.alpha = 1;
|
if (havea) src->cache_entry.flags.alpha = 1;
|
||||||
if (dc->mul.use)
|
if (mul_col != 0xffffffff)
|
||||||
func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, cw, dc->render_op);
|
func = evas_common_gfx_func_composite_pixel_color_span_get(src, mul_col, dst, cw, render_op);
|
||||||
else
|
else
|
||||||
func = evas_common_gfx_func_composite_pixel_span_get(src, dst, cw, dc->render_op);
|
func = evas_common_gfx_func_composite_pixel_span_get(src, dst, cw, render_op);
|
||||||
src->cache_entry.flags.alpha = pa;
|
src->cache_entry.flags.alpha = pa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,15 +120,18 @@ FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst,
|
||||||
DATA32 *buf = NULL, *sp;
|
DATA32 *buf = NULL, *sp;
|
||||||
RGBA_Gfx_Func func = NULL;
|
RGBA_Gfx_Func func = NULL;
|
||||||
int cx, cy, cw, ch;
|
int cx, cy, cw, ch;
|
||||||
|
DATA32 mul_col;
|
||||||
int ystart, yend, y, sw, shp, swp, direct;
|
int ystart, yend, y, sw, shp, swp, direct;
|
||||||
int havecol;
|
int havecol;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cx = dc->clip.x;
|
cx = dc->clip.x;
|
||||||
cy = dc->clip.y;
|
cy = dc->clip.y;
|
||||||
cw = dc->clip.w;
|
cw = dc->clip.w;
|
||||||
ch = dc->clip.h;
|
ch = dc->clip.h;
|
||||||
|
|
||||||
|
mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
|
||||||
|
|
||||||
if (ms->ystart < cy) ystart = cy;
|
if (ms->ystart < cy) ystart = cy;
|
||||||
else ystart = ms->ystart;
|
else ystart = ms->ystart;
|
||||||
if (ms->yend >= (cy + ch)) yend = (cy + ch) - 1;
|
if (ms->yend >= (cy + ch)) yend = (cy + ch) - 1;
|
||||||
|
|
Loading…
Reference in New Issue