diff --git a/src/lib/evas/common/evas_map_image.c b/src/lib/evas/common/evas_map_image.c index ca3ccfc86d..7e282f6b25 100644 --- a/src/lib/evas/common/evas_map_image.c +++ b/src/lib/evas/common/evas_map_image.c @@ -640,11 +640,67 @@ evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst, #undef FUNC_NAME #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 #undef SCALE_USING_MMX #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 evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst, 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; } +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 evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst, 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); } +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 evas_common_map_rgba_do(const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, diff --git a/src/lib/evas/common/evas_map_image.h b/src/lib/evas/common/evas_map_image.h index 6ea043ddab..7c21999884 100644 --- a/src/lib/evas/common/evas_map_image.h +++ b/src/lib/evas/common/evas_map_image.h @@ -1,7 +1,8 @@ #ifndef _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 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 smooth, int level, 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 evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int npoints, RGBA_Map_Point *points, 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 evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, diff --git a/src/lib/evas/common/evas_map_image_core.c b/src/lib/evas/common/evas_map_image_core.c index b9bbeb57e3..89b50513df 100644 --- a/src/lib/evas/common/evas_map_image_core.c +++ b/src/lib/evas/common/evas_map_image_core.c @@ -115,7 +115,7 @@ { d = dst->image.data; d += (y * dst->cache_entry.w) + x; - func(buf, NULL, dc->mul.col, d, w); + func(buf, NULL, mul_col, d, w); } } else break; @@ -216,7 +216,7 @@ { d = dst->image.data; d += (y * dst->cache_entry.w) + x; - func(buf, NULL, dc->mul.col, d, w); + func(buf, NULL, mul_col, d, w); } } else break; diff --git a/src/lib/evas/common/evas_map_image_internal.c b/src/lib/evas/common/evas_map_image_internal.c index dba252b592..4ca01e698a 100644 --- a/src/lib/evas/common/evas_map_image_internal.c +++ b/src/lib/evas/common/evas_map_image_internal.c @@ -1,12 +1,13 @@ // 66.74 % of time static void FUNC_NAME(RGBA_Image *src, RGBA_Image *dst, - RGBA_Draw_Context *dc, - RGBA_Map_Point *p, + int clip_x, int clip_y, int clip_w, int clip_h, + DATA32 mul_col, int render_op, + RGBA_Map_Point *p, int smooth, int level EINA_UNUSED) // level unused for now - for future use { int i; - int c, cx, cy, cw, ch; + int cx, cy, cw, ch; int ytop, ybottom, ystart, yend, y, sw, shp, swp, direct; Line *spans; DATA32 *buf = NULL, *sp; @@ -14,16 +15,11 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst, int havea = 0; int havecol = 4; - // get the clip - c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h; - if (!c) - { - cx = 0; - cy = 0; - cw = dst->cache_entry.w; - ch = dst->cache_entry.h; - } - + cx = clip_x; + cy = clip_y; + cw = clip_w; + ch = clip_h; + // find y yop line and y bottom line ytop = p[0].y; 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 direct = 0; if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) && - (!dc->mul.use) && (!havea)) + (mul_col == 0xffffffff) && (!havea)) { direct = 1; } @@ -95,10 +91,10 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst, buf = alloca(cw * sizeof(DATA32)); pa = src->cache_entry.flags.alpha; if (havea) src->cache_entry.flags.alpha = 1; - if (dc->mul.use) - func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, cw, dc->render_op); + if (mul_col != 0xffffffff) + func = evas_common_gfx_func_composite_pixel_color_span_get(src, mul_col, dst, cw, render_op); 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; } @@ -124,15 +120,18 @@ FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst, DATA32 *buf = NULL, *sp; RGBA_Gfx_Func func = NULL; int cx, cy, cw, ch; + DATA32 mul_col; int ystart, yend, y, sw, shp, swp, direct; int havecol; int i; - + cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h; + mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; + if (ms->ystart < cy) ystart = cy; else ystart = ms->ystart; if (ms->yend >= (cy + ch)) yend = (cy + ch) - 1;