summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-07-04 09:39:23 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-07-04 09:39:23 +0000
commit1d415b796bf0f506ef7888195faa8ec0ed1f0d06 (patch)
tree7b79753ca57cf5d98c831f19609fccc6749aa214 /legacy/evas/src/lib
parent5ef3b00eaf4886d130dfd938354abbc7a8e5a702 (diff)
evas: add more infrastructure to the prepare stage of pipe rendering.
NOTE: this improve some test by 10 to 15% some other are down by 5%. Their is still more tunning and improvement possible now (Particularly with Map), but it will do for now. SVN revision: 73264
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/canvas/evas_clip.c12
-rw-r--r--legacy/evas/src/lib/canvas/evas_map.c10
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_image.c7
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_smart.c61
-rw-r--r--legacy/evas/src/lib/canvas/evas_render.c4
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw.h2
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw_main.c30
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font.h2
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_draw.c161
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_main.c9
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_scalecache.c3
-rw-r--r--legacy/evas/src/lib/engines/common/evas_line_main.c2
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image.c347
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image.h13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image_internal.c67
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c286
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.h9
-rw-r--r--legacy/evas/src/lib/engines/common/evas_rectangle.h2
-rw-r--r--legacy/evas/src/lib/engines/common/evas_rectangle_main.c54
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_main.c27
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_main.h5
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_sample.c83
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth.c74
-rw-r--r--legacy/evas/src/lib/engines/common/evas_text_utils.c10
-rw-r--r--legacy/evas/src/lib/engines/common/evas_text_utils.h5
-rw-r--r--legacy/evas/src/lib/engines/common_16/evas_soft16_main.c5
-rw-r--r--legacy/evas/src/lib/engines/common_16/evas_soft16_rectangle.c5
-rw-r--r--legacy/evas/src/lib/engines/common_8/evas_soft8_main.c5
-rw-r--r--legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c5
-rw-r--r--legacy/evas/src/lib/include/evas_common.h11
-rw-r--r--legacy/evas/src/lib/include/evas_private.h3
31 files changed, 1134 insertions, 185 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_clip.c b/legacy/evas/src/lib/canvas/evas_clip.c
index 435a0ffbaa..6baa28cdb3 100644
--- a/legacy/evas/src/lib/canvas/evas_clip.c
+++ b/legacy/evas/src/lib/canvas/evas_clip.c
@@ -179,11 +179,11 @@ evas_object_clip_set(Evas_Object *obj, Evas_Object *clip)
179 if (obj == clip) return; 179 if (obj == clip) return;
180 if (evas_object_intercept_call_clip_set(obj, clip)) return; 180 if (evas_object_intercept_call_clip_set(obj, clip)) return;
181 // illegal to set anything but a rect as a clip 181 // illegal to set anything but a rect as a clip
182 if (clip->type != o_rect_type) 182 /* if (clip->type != o_rect_type) */
183 { 183 /* { */
184 ERR("For now a clip on other object than a rectangle is disabled"); 184 /* ERR("For now a clip on other object than a rectangle is disabled"); */
185 return; 185 /* return; */
186 } 186 /* } */
187 if (obj->smart.smart) 187 if (obj->smart.smart)
188 { 188 {
189 if (obj->smart.smart->smart_class->clip_set) 189 if (obj->smart.smart->smart_class->clip_set)
@@ -228,7 +228,7 @@ evas_object_clip_set(Evas_Object *obj, Evas_Object *clip)
228 228
229 /* If it's NOT a rectangle set the mask bits too */ 229 /* If it's NOT a rectangle set the mask bits too */
230 /* FIXME: Optmz ths chck */ 230 /* FIXME: Optmz ths chck */
231 if (strcmp(evas_object_type_get(clip),"rectangle") == 0) 231 if (clip->type == o_rect_type)
232 obj->cur.mask = NULL; 232 obj->cur.mask = NULL;
233 else 233 else
234 { 234 {
diff --git a/legacy/evas/src/lib/canvas/evas_map.c b/legacy/evas/src/lib/canvas/evas_map.c
index 9c2d71a056..f402db77c9 100644
--- a/legacy/evas/src/lib/canvas/evas_map.c
+++ b/legacy/evas/src/lib/canvas/evas_map.c
@@ -144,7 +144,9 @@ _evas_map_copy(Evas_Map *dst, const Evas_Map *src)
144 ERR("cannot copy map of different sizes: dst=%i, src=%i", dst->count, src->count); 144 ERR("cannot copy map of different sizes: dst=%i, src=%i", dst->count, src->count);
145 return EINA_FALSE; 145 return EINA_FALSE;
146 } 146 }
147 memcpy(dst->points, src->points, src->count * sizeof(Evas_Map_Point)); 147 if (dst == src) return EINA_TRUE;
148 if (dst->points != src->points)
149 memcpy(dst->points, src->points, src->count * sizeof(Evas_Map_Point));
148 dst->smooth = src->smooth; 150 dst->smooth = src->smooth;
149 dst->alpha = src->alpha; 151 dst->alpha = src->alpha;
150 dst->persp = src->persp; 152 dst->persp = src->persp;
@@ -170,10 +172,10 @@ _evas_map_free(Evas_Object *obj, Evas_Map *m)
170 { 172 {
171 if (m->surface) 173 if (m->surface)
172 obj->layer->evas->engine.func->image_map_surface_free 174 obj->layer->evas->engine.func->image_map_surface_free
173 (obj->layer->evas->engine.data.output, m->surface); 175 (obj->layer->evas->engine.data.output, m->surface);
174 if (obj->spans) 176 if (obj->spans)
175 { 177 {
176 // FIXME: destroy engine side spans 178 obj->layer->evas->engine.func->image_map_clean(obj->layer->evas->engine.data.output, obj->spans);
177 free(obj->spans); 179 free(obj->spans);
178 obj->spans = NULL; 180 obj->spans = NULL;
179 } 181 }
@@ -487,7 +489,7 @@ evas_object_map_set(Evas_Object *obj, const Evas_Map *map)
487 _evas_map_copy(obj->cur.map, map); 489 _evas_map_copy(obj->cur.map, map);
488 else 490 else
489 { 491 {
490 if (obj->cur.map) evas_map_free(obj->cur.map); 492 if (obj->cur.map) _evas_map_free(obj, obj->cur.map);
491 obj->cur.map = _evas_map_dup(map); 493 obj->cur.map = _evas_map_dup(map);
492 if (obj->cur.usemap) 494 if (obj->cur.usemap)
493 evas_object_mapped_clip_across_mark(obj); 495 evas_object_mapped_clip_across_mark(obj);
diff --git a/legacy/evas/src/lib/canvas/evas_object_image.c b/legacy/evas/src/lib/canvas/evas_object_image.c
index b880be806b..b18ac653be 100644
--- a/legacy/evas/src/lib/canvas/evas_object_image.c
+++ b/legacy/evas/src/lib/canvas/evas_object_image.c
@@ -2952,14 +2952,11 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
2952 } 2952 }
2953 if ((obj->cur.map) && (obj->cur.map->count > 3) && (obj->cur.usemap)) 2953 if ((obj->cur.map) && (obj->cur.map->count > 3) && (obj->cur.usemap))
2954 { 2954 {
2955 RGBA_Map_Point *pts;
2956
2957 evas_object_map_update(obj, x, y, imagew, imageh, uvw, uvh); 2955 evas_object_map_update(obj, x, y, imagew, imageh, uvw, uvh);
2958 pts = obj->spans->pts;
2959 2956
2960 obj->layer->evas->engine.func->image_map_draw 2957 obj->layer->evas->engine.func->image_map_draw
2961 (output, context, surface, pixels, obj->cur.map->count, 2958 (output, context, surface, pixels, obj->spans,
2962 pts, o->cur.smooth_scale | obj->cur.map->smooth, 0); 2959 o->cur.smooth_scale | obj->cur.map->smooth, 0);
2963 } 2960 }
2964 else 2961 else
2965 { 2962 {
diff --git a/legacy/evas/src/lib/canvas/evas_object_smart.c b/legacy/evas/src/lib/canvas/evas_object_smart.c
index 83b4e88d67..3d9c89dd35 100644
--- a/legacy/evas/src/lib/canvas/evas_object_smart.c
+++ b/legacy/evas/src/lib/canvas/evas_object_smart.c
@@ -1008,19 +1008,74 @@ static void
1008evas_object_smart_render_pre(Evas_Object *obj) 1008evas_object_smart_render_pre(Evas_Object *obj)
1009{ 1009{
1010 if (obj->pre_render_done) return; 1010 if (obj->pre_render_done) return;
1011 if (!obj->child_has_map) 1011 if (!obj->child_has_map && !obj->cur.cached_surface)
1012 { 1012 {
1013#if 0 1013#if 0
1014 Evas_Object_Smart *o; 1014 Evas_Object_Smart *o;
1015 1015
1016 fprintf(stderr, "");
1016 o = (Evas_Object_Smart *)(obj->object_data); 1017 o = (Evas_Object_Smart *)(obj->object_data);
1017 if (o->member_count > 1 && 1018 if (/* o->member_count > 1 && */
1018 obj->cur.bounding_box.w == obj->prev.bounding_box.w && 1019 obj->cur.bounding_box.w == obj->prev.bounding_box.w &&
1019 obj->cur.bounding_box.h == obj->prev.bounding_box.h && 1020 obj->cur.bounding_box.h == obj->prev.bounding_box.h &&
1020 (obj->cur.bounding_box.x != obj->prev.bounding_box.x || 1021 (obj->cur.bounding_box.x != obj->prev.bounding_box.x ||
1021 obj->cur.bounding_box.y != obj->prev.bounding_box.y)) 1022 obj->cur.bounding_box.y != obj->prev.bounding_box.y))
1022 { 1023 {
1023 fprintf(stderr, "Wouhou, I can detect moving smart object (%s, %p < %p)\n", evas_object_type_get(obj), obj, obj->smart.parent); 1024 Eina_Bool cache_map = EINA_FALSE;
1025
1026 /* Check parent speed */
1027 /* - same speed => do not map this object */
1028 /* - different speed => map this object */
1029 /* - if parent is mapped then map this object */
1030
1031 if (!obj->smart.parent || obj->smart.parent->child_has_map)
1032 {
1033 cache_map = EINA_TRUE;
1034 }
1035 else
1036 {
1037 if (_evas_render_has_map(obj->smart.parent))
1038 {
1039 cache_map = EINA_TRUE;
1040 }
1041 else
1042 {
1043 int speed_x, speed_y;
1044 int speed_px, speed_py;
1045
1046 speed_x = obj->cur.geometry.x - obj->prev.geometry.x;
1047 speed_y = obj->cur.geometry.y - obj->prev.geometry.y;
1048
1049 speed_px = obj->smart.parent->cur.geometry.x - obj->smart.parent->prev.geometry.x;
1050 speed_py = obj->smart.parent->cur.geometry.y - obj->smart.parent->prev.geometry.y;
1051
1052 /* speed_x = obj->cur.bounding_box.x - obj->prev.bounding_box.x; */
1053 /* speed_y = obj->cur.bounding_box.y - obj->prev.bounding_box.y; */
1054
1055 /* speed_px = obj->smart.parent->cur.bounding_box.x - obj->smart.parent->prev.bounding_box.x; */
1056 /* speed_py = obj->smart.parent->cur.bounding_box.y - obj->smart.parent->prev.bounding_box.y; */
1057
1058 fprintf(stderr, "speed: '%s',%p (%i, %i) vs '%s',%p (%i, %i)\n",
1059 evas_object_type_get(obj), obj, speed_x, speed_y,
1060 evas_object_type_get(obj->smart.parent), obj->smart.parent, speed_px, speed_py);
1061
1062 if (speed_x != speed_px || speed_y != speed_py)
1063 cache_map = EINA_TRUE;
1064 }
1065 }
1066
1067 if (cache_map)
1068 fprintf(stderr, "Wouhou, I can detect moving smart object (%s, %p [%i, %i, %i, %i] < %s, %p [%i, %i, %i, %i])\n",
1069 evas_object_type_get(obj), obj,
1070 obj->cur.bounding_box.x - obj->prev.bounding_box.x,
1071 obj->cur.bounding_box.y - obj->prev.bounding_box.y,
1072 obj->cur.bounding_box.w, obj->cur.bounding_box.h,
1073 evas_object_type_get(obj->smart.parent), obj->smart.parent,
1074 obj->smart.parent->cur.bounding_box.x - obj->smart.parent->prev.bounding_box.x,
1075 obj->smart.parent->cur.bounding_box.y - obj->smart.parent->prev.bounding_box.y,
1076 obj->smart.parent->cur.bounding_box.w, obj->smart.parent->cur.bounding_box.h);
1077
1078 obj->cur.cached_surface = cache_map;
1024 } 1079 }
1025#endif 1080#endif
1026 } 1081 }
diff --git a/legacy/evas/src/lib/canvas/evas_render.c b/legacy/evas/src/lib/canvas/evas_render.c
index 11edcf3bdb..374938b581 100644
--- a/legacy/evas/src/lib/canvas/evas_render.c
+++ b/legacy/evas/src/lib/canvas/evas_render.c
@@ -822,7 +822,6 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
822 _evas_render_has_map(obj)); 822 _evas_render_has_map(obj));
823 if (_evas_render_has_map(obj)) 823 if (_evas_render_has_map(obj))
824 { 824 {
825 RGBA_Map_Point *pts;
826 int sw, sh; 825 int sw, sh;
827 Eina_Bool changed = EINA_FALSE, rendered = EINA_FALSE; 826 Eina_Bool changed = EINA_FALSE, rendered = EINA_FALSE;
828 827
@@ -840,7 +839,6 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
840 } 839 }
841 840
842 evas_object_map_update(obj, off_x, off_y, sw, sh, sw, sh); 841 evas_object_map_update(obj, off_x, off_y, sw, sh, sw, sh);
843 pts = obj->spans->pts;
844 842
845 if (obj->cur.map->surface) 843 if (obj->cur.map->surface)
846 { 844 {
@@ -1032,7 +1030,7 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
1032 (e->engine.data.output, e->engine.data.context); 1030 (e->engine.data.output, e->engine.data.context);
1033 obj->layer->evas->engine.func->image_map_draw 1031 obj->layer->evas->engine.func->image_map_draw
1034 (e->engine.data.output, e->engine.data.context, surface, 1032 (e->engine.data.output, e->engine.data.context, surface,
1035 obj->cur.map->surface, obj->cur.map->count, pts, 1033 obj->cur.map->surface, obj->spans,
1036 obj->cur.map->smooth, 0); 1034 obj->cur.map->smooth, 0);
1037 } 1035 }
1038 // FIXME: needs to cache these maps and 1036 // FIXME: needs to cache these maps and
diff --git a/legacy/evas/src/lib/engines/common/evas_draw.h b/legacy/evas/src/lib/engines/common/evas_draw.h
index 34e0ed3e4a..6599d54c00 100644
--- a/legacy/evas/src/lib/engines/common/evas_draw.h
+++ b/legacy/evas/src/lib/engines/common/evas_draw.h
@@ -24,7 +24,7 @@ EAPI void evas_common_draw_context_cutouts_free (Cutout
24EAPI void evas_common_draw_context_cutouts_del (Cutout_Rects* rects, int idx); 24EAPI void evas_common_draw_context_cutouts_del (Cutout_Rects* rects, int idx);
25EAPI void evas_common_draw_context_add_cutout (RGBA_Draw_Context *dc, int x, int y, int w, int h); 25EAPI void evas_common_draw_context_add_cutout (RGBA_Draw_Context *dc, int x, int y, int w, int h);
26EAPI void evas_common_draw_context_clear_cutouts (RGBA_Draw_Context *dc); 26EAPI void evas_common_draw_context_clear_cutouts (RGBA_Draw_Context *dc);
27EAPI Cutout_Rects *evas_common_draw_context_apply_cutouts (RGBA_Draw_Context *dc); 27EAPI Cutout_Rects *evas_common_draw_context_apply_cutouts (RGBA_Draw_Context *dc, Cutout_Rects *recycle);
28EAPI void evas_common_draw_context_apply_clear_cutouts (Cutout_Rects* rects); 28EAPI void evas_common_draw_context_apply_clear_cutouts (Cutout_Rects* rects);
29EAPI void evas_common_draw_context_apply_clean_cutouts (Cutout_Rects* rects); 29EAPI void evas_common_draw_context_apply_clean_cutouts (Cutout_Rects* rects);
30EAPI void evas_common_draw_context_set_anti_alias (RGBA_Draw_Context *dc, unsigned char aa); 30EAPI void evas_common_draw_context_set_anti_alias (RGBA_Draw_Context *dc, unsigned char aa);
diff --git a/legacy/evas/src/lib/engines/common/evas_draw_main.c b/legacy/evas/src/lib/engines/common/evas_draw_main.c
index d08e7885eb..28b54cd0ae 100644
--- a/legacy/evas/src/lib/engines/common/evas_draw_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_draw_main.c
@@ -14,6 +14,7 @@ evas_common_draw_context_cutouts_new(void)
14EAPI void 14EAPI void
15evas_common_draw_context_cutouts_free(Cutout_Rects* rects) 15evas_common_draw_context_cutouts_free(Cutout_Rects* rects)
16{ 16{
17 if (!rects) return ;
17 rects->active = 0; 18 rects->active = 0;
18} 19}
19 20
@@ -90,7 +91,7 @@ evas_common_draw_context_free(RGBA_Draw_Context *dc)
90EAPI void 91EAPI void
91evas_common_draw_context_clear_cutouts(RGBA_Draw_Context *dc) 92evas_common_draw_context_clear_cutouts(RGBA_Draw_Context *dc)
92{ 93{
93 evas_common_draw_context_apply_clean_cutouts(&dc->cutout); 94 evas_common_draw_context_cutouts_free(&dc->cutout);
94} 95}
95 96
96EAPI void 97EAPI void
@@ -557,9 +558,9 @@ evas_common_draw_context_cutout_split(Cutout_Rects* res, int idx, Cutout_Rect *s
557} 558}
558 559
559EAPI Cutout_Rects* 560EAPI Cutout_Rects*
560evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc) 561evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc, Cutout_Rects *reuse)
561{ 562{
562 Cutout_Rects* res, *res2; 563 Cutout_Rects* res = NULL;
563 int i; 564 int i;
564 int j; 565 int j;
565 566
@@ -567,7 +568,15 @@ evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
567 if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL; 568 if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL;
568 569
569 570
570 res = evas_common_draw_context_cutouts_new(); 571 if (!reuse)
572 {
573 res = evas_common_draw_context_cutouts_new();
574 }
575 else
576 {
577 evas_common_draw_context_cutouts_free(reuse);
578 res = reuse;
579 }
571 evas_common_draw_context_cutouts_add(res, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); 580 evas_common_draw_context_cutouts_add(res, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
572 581
573 for (i = 0; i < dc->cutout.active; ++i) 582 for (i = 0; i < dc->cutout.active; ++i)
@@ -636,15 +645,18 @@ evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc)
636 } 645 }
637 } 646 }
638 } 647 }
639 res2 = evas_common_draw_context_cutouts_new(); 648
649 /* Repack the cutout */
650 j = 0;
640 for (i = 0; i < res->active; i++) 651 for (i = 0; i < res->active; i++)
641 { 652 {
642 if (RI.w == 0) continue; 653 if (RI.w == 0) continue;
643 evas_common_draw_context_cutouts_add(res2, RI.x, RI.y, RI.w, RI.h); 654 if (i != j)
655 RJ = RI;
656 j++;
644 } 657 }
645 free(res->rects); 658 res->active = j;
646 free(res); 659 return res;
647 return res2;
648 } 660 }
649 return res; 661 return res;
650} 662}
diff --git a/legacy/evas/src/lib/engines/common/evas_font.h b/legacy/evas/src/lib/engines/common/evas_font.h
index 313c23e9b7..5c7c1afcd3 100644
--- a/legacy/evas/src/lib/engines/common/evas_font.h
+++ b/legacy/evas/src/lib/engines/common/evas_font.h
@@ -25,6 +25,8 @@ EAPI Eina_Bool evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *
25EAPI FT_UInt evas_common_get_char_index (RGBA_Font_Int* fi, Eina_Unicode gl); 25EAPI FT_UInt evas_common_get_char_index (RGBA_Font_Int* fi, Eina_Unicode gl);
26EAPI void evas_common_font_draw_init (void); 26EAPI void evas_common_font_draw_init (void);
27EAPI void evas_common_font_draw_prepare (Evas_Text_Props *text_props); 27EAPI void evas_common_font_draw_prepare (Evas_Text_Props *text_props);
28EAPI void evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Gfx_Func func, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props);
29EAPI Eina_Bool evas_common_font_draw_prepare_cutout(Cutout_Rects *reuse, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Gfx_Func *func);
28 30
29/* load */ 31/* load */
30EAPI void evas_common_font_dpi_set (int dpi); 32EAPI void evas_common_font_dpi_set (int dpi);
diff --git a/legacy/evas/src/lib/engines/common/evas_font_draw.c b/legacy/evas/src/lib/engines/common/evas_font_draw.c
index c1308a911c..f635756dea 100644
--- a/legacy/evas/src/lib/engines/common/evas_font_draw.c
+++ b/legacy/evas/src/lib/engines/common/evas_font_draw.c
@@ -40,21 +40,22 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, in
40 40
41 im = dst->image.data; 41 im = dst->image.data;
42 42
43 if (!text_props->bin) return ; 43 if (!text_props->glyphs) return ;
44 44
45 glyphs = (void*) eina_binbuf_string_get(text_props->bin); 45 glyphs = text_props->glyphs;
46 length = eina_binbuf_length_get(text_props->bin) / sizeof (Evas_Glyph); 46 length = text_props->glyphs_length;
47 for (it = 0; it < length; ++it) 47 for (it = 0; it < length; ++it, ++glyphs)
48 { 48 {
49 RGBA_Font_Glyph *fg; 49 RGBA_Font_Glyph *fg;
50 int chr_x, chr_y; 50 int chr_x, chr_y;
51 51
52 fg = glyphs[it].fg; 52 fg = glyphs->fg;
53 53
54 glyphs[it].coord.w = fg->glyph_out->bitmap.width; 54 /* FIXME: Why was that moved out of prepare ? This increase cache miss. */
55 glyphs[it].coord.h = fg->glyph_out->bitmap.rows; 55 glyphs->coord.w = fg->glyph_out->bitmap.width;
56 glyphs[it].j = fg->glyph_out->bitmap.pitch; 56 glyphs->coord.h = fg->glyph_out->bitmap.rows;
57 glyphs[it].data = fg->glyph_out->bitmap.buffer; 57 glyphs->j = fg->glyph_out->bitmap.pitch;
58 glyphs->data = fg->glyph_out->bitmap.buffer;
58 59
59 if (dc->font_ext.func.gl_new) 60 if (dc->font_ext.func.gl_new)
60 { 61 {
@@ -63,19 +64,19 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, in
63 fg->ext_dat_free = dc->font_ext.func.gl_free; 64 fg->ext_dat_free = dc->font_ext.func.gl_free;
64 } 65 }
65 66
66 chr_x = x + glyphs[it].coord.x/* EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR */; 67 chr_x = x + glyphs->coord.x/* EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR */;
67 chr_y = y + glyphs[it].coord.y/* EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR */; 68 chr_y = y + glyphs->coord.y/* EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR */;
68 69
69 if (chr_x < (ext_x + ext_w)) 70 if (chr_x < (ext_x + ext_w))
70 { 71 {
71 DATA8 *data; 72 DATA8 *data;
72 int i, j, w, h; 73 int i, j, w, h;
73 74
74 data = glyphs[it].data; 75 data = glyphs->data;
75 j = glyphs[it].j; 76 j = glyphs->j;
76 w = glyphs[it].coord.w; 77 w = glyphs->coord.w;
77 if (j < w) j = w; 78 if (j < w) j = w;
78 h = glyphs[it].coord.h; 79 h = glyphs->coord.h;
79 80
80#ifdef HAVE_PIXMAN 81#ifdef HAVE_PIXMAN
81# ifdef PIXMAN_FONT 82# ifdef PIXMAN_FONT
@@ -230,16 +231,21 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props)
230{ 231{
231 RGBA_Font_Int *fi; 232 RGBA_Font_Int *fi;
232 RGBA_Font_Glyph *fg; 233 RGBA_Font_Glyph *fg;
234 Evas_Glyph *glyphs;
235 int glyphs_length;
236 int glyphs_max;
233 EVAS_FONT_WALK_TEXT_INIT(); 237 EVAS_FONT_WALK_TEXT_INIT();
234 238
235 fi = text_props->font_instance; 239 fi = text_props->font_instance;
236 if (!fi) return; 240 if (!fi) return;
237 241
238 if (!text_props->changed && text_props->generation == fi->generation && text_props->bin) 242 if (!text_props->changed && text_props->generation == fi->generation && text_props->glyphs)
239 return ; 243 return ;
240 244
241 if (!text_props->bin) text_props->bin = eina_binbuf_new(); 245 glyphs = text_props->glyphs;
242 else eina_binbuf_reset(text_props->bin); 246 glyphs_length = 0;
247 glyphs_max = text_props->glyphs_length;
248 text_props->glyphs_length = 0;
243 249
244 evas_common_font_int_reload(fi); 250 evas_common_font_int_reload(fi);
245 251
@@ -254,7 +260,7 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props)
254 260
255 EVAS_FONT_WALK_TEXT_START() 261 EVAS_FONT_WALK_TEXT_START()
256 { 262 {
257 Evas_Glyph glyph; 263 Evas_Glyph *glyph;
258 FT_UInt idx; 264 FT_UInt idx;
259 265
260 if (!EVAS_FONT_WALK_IS_VISIBLE) continue; 266 if (!EVAS_FONT_WALK_IS_VISIBLE) continue;
@@ -264,15 +270,28 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props)
264 if (!fg) continue; 270 if (!fg) continue;
265 if (!fg->glyph_out) evas_common_font_int_cache_glyph_render(fg); 271 if (!fg->glyph_out) evas_common_font_int_cache_glyph_render(fg);
266 272
267 glyph.fg = fg; 273 if (glyphs_length + 1 >= glyphs_max)
268 glyph.coord.x = EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR; 274 {
269 glyph.coord.y = EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR; 275 Evas_Glyph *tmp;
270 glyph.idx = idx; 276
277 glyphs_max += 8;
278 tmp = realloc(glyphs, glyphs_max * sizeof (Evas_Glyph));
279 if (!tmp) return ;
280 glyphs = tmp;
281 text_props->glyphs = glyphs;
282 }
283
284 glyph = glyphs + glyphs_length++;
271 285
272 eina_binbuf_append_length(text_props->bin, (void*) &glyph, sizeof (Evas_Glyph)); 286 glyph->fg = fg;
287 glyph->idx = idx;
288 glyph->coord.x = EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR;
289 glyph->coord.y = EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR;
273 } 290 }
274 EVAS_FONT_WALK_TEXT_END(); 291 EVAS_FONT_WALK_TEXT_END();
275 292
293 text_props->glyphs_length = glyphs_length;
294 text_props->glyphs = glyphs;
276 /* check if there's a request queue in fi, if so ask cserve2 to render 295 /* check if there's a request queue in fi, if so ask cserve2 to render
277 * those glyphs 296 * those glyphs
278 */ 297 */
@@ -283,10 +302,10 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props)
283EAPI void 302EAPI void
284evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props) 303evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props)
285{ 304{
305 static Cutout_Rects *rects = NULL;
286 int ext_x, ext_y, ext_w, ext_h; 306 int ext_x, ext_y, ext_w, ext_h;
287 int im_w, im_h; 307 int im_w, im_h;
288 RGBA_Gfx_Func func; 308 RGBA_Gfx_Func func;
289 Cutout_Rects *rects;
290 Cutout_Rect *r; 309 Cutout_Rect *r;
291 int c, cx, cy, cw, ch; 310 int c, cx, cy, cw, ch;
292 int i; 311 int i;
@@ -335,7 +354,7 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, cons
335 /* our clip is 0 size.. abort */ 354 /* our clip is 0 size.. abort */
336 if ((dc->clip.w > 0) && (dc->clip.h > 0)) 355 if ((dc->clip.w > 0) && (dc->clip.h > 0))
337 { 356 {
338 rects = evas_common_draw_context_apply_cutouts(dc); 357 rects = evas_common_draw_context_apply_cutouts(dc, rects);
339 for (i = 0; i < rects->active; ++i) 358 for (i = 0; i < rects->active; ++i)
340 { 359 {
341 r = rects->rects + i; 360 r = rects->rects + i;
@@ -344,8 +363,96 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, cons
344 func, r->x, r->y, r->w, r->h, 363 func, r->x, r->y, r->w, r->h,
345 im_w, im_h); 364 im_w, im_h);
346 } 365 }
347 evas_common_draw_context_apply_clear_cutouts(rects);
348 } 366 }
349 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 367 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
350 } 368 }
351} 369}
370
371EAPI void
372evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Gfx_Func func,
373 RGBA_Image *dst, RGBA_Draw_Context *dc,
374 int x, int y, const Evas_Text_Props *text_props)
375{
376 Eina_Rectangle area;
377 Cutout_Rect *r;
378 int i;
379 int im_w, im_h;
380
381 im_w = dst->cache_entry.w;
382 im_h = dst->cache_entry.h;
383
384 if (!reuse)
385 {
386 evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
387 evas_common_font_draw_internal(dst, dc, x, y, text_props,
388 func, clip->x, clip->y, clip->w, clip->h,
389 im_w, im_h);
390 return ;
391 }
392
393 for (i = 0; i < reuse->active; ++i)
394 {
395 r = reuse->rects + i;
396
397 EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h);
398 if (!eina_rectangle_intersection(&area, clip)) continue ;
399 evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
400 evas_common_font_draw_internal(dst, dc, x, y, text_props,
401 func, area.x, area.y, area.w, area.h,
402 im_w, im_h);
403 }
404}
405
406EAPI Eina_Bool
407evas_common_font_draw_prepare_cutout(Cutout_Rects *reuse, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Gfx_Func *func)
408{
409 int ext_x, ext_y, ext_w, ext_h;
410 int im_w, im_h;
411
412 im_w = dst->cache_entry.w;
413 im_h = dst->cache_entry.h;
414
415 *func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst, 1, dc->render_op);
416
417 ext_x = 0; ext_y = 0; ext_w = im_w; ext_h = im_h;
418 if (dc->clip.use)
419 {
420 ext_x = dc->clip.x;
421 ext_y = dc->clip.y;
422 ext_w = dc->clip.w;
423 ext_h = dc->clip.h;
424 if (ext_x < 0)
425 {
426 ext_w += ext_x;
427 ext_x = 0;
428 }
429 if (ext_y < 0)
430 {
431 ext_h += ext_y;
432 ext_y = 0;
433 }
434 if ((ext_x + ext_w) > im_w)
435 ext_w = im_w - ext_x;
436 if ((ext_y + ext_h) > im_h)
437 ext_h = im_h - ext_y;
438 }
439 if (ext_w <= 0) return EINA_FALSE;
440 if (ext_h <= 0) return EINA_FALSE;
441
442 if (dc->cutout.rects)
443 {
444 evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
445 /* our clip is 0 size.. abort */
446 if ((dc->clip.w > 0) && (dc->clip.h > 0))
447 {
448 reuse = evas_common_draw_context_apply_cutouts(dc, reuse);
449 }
450 else
451 {
452 return EINA_FALSE;
453 }
454 }
455
456 return EINA_TRUE;
457}
458
diff --git a/legacy/evas/src/lib/engines/common/evas_font_main.c b/legacy/evas/src/lib/engines/common/evas_font_main.c
index bd4c6785f9..100f3b7523 100644
--- a/legacy/evas/src/lib/engines/common/evas_font_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_font_main.c
@@ -562,9 +562,14 @@ evas_common_get_char_index(RGBA_Font_Int* fi, Eina_Unicode gl)
562// } 562// }
563 563
564 evas_common_font_int_reload(fi); 564 evas_common_font_int_reload(fi);
565 FTLOCK(); 565 /*
566 * There is no point in locking FreeType at this point as all caller
567 * are running in the main loop at a time where there is zero chance
568 * that something else try to use it.
569 */
570 /* FTLOCK(); */
566 result.index = FT_Get_Char_Index(fi->src->ft.face, gl); 571 result.index = FT_Get_Char_Index(fi->src->ft.face, gl);
567 FTUNLOCK(); 572 /* FTUNLOCK(); */
568 result.gl = gl; 573 result.gl = gl;
569 574
570// eina_hash_direct_add(fi->indexes, &result->gl, result); 575// eina_hash_direct_add(fi->indexes, &result->gl, result);
diff --git a/legacy/evas/src/lib/engines/common/evas_image_scalecache.c b/legacy/evas/src/lib/engines/common/evas_image_scalecache.c
index 99ecd308c9..5a2d7a25a3 100644
--- a/legacy/evas/src/lib/engines/common/evas_image_scalecache.c
+++ b/legacy/evas/src/lib/engines/common/evas_image_scalecache.c
@@ -221,8 +221,7 @@ _sci_find(RGBA_Image *im,
221 { 221 {
222 if (im->cache.list != l) 222 if (im->cache.list != l)
223 { 223 {
224 im->cache.list = eina_list_remove_list(im->cache.list, l); 224 im->cache.list = eina_list_promote_list(im->cache.list, l);
225 im->cache.list = eina_list_prepend(im->cache.list, sci);
226 } 225 }
227 return sci; 226 return sci;
228 } 227 }
diff --git a/legacy/evas/src/lib/engines/common/evas_line_main.c b/legacy/evas/src/lib/engines/common/evas_line_main.c
index fc1385f293..76417f5ac7 100644
--- a/legacy/evas/src/lib/engines/common/evas_line_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_line_main.c
@@ -47,6 +47,8 @@ evas_common_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, in
47 int clx, cly, clw, clh; 47 int clx, cly, clw, clh;
48 int cuse, cx, cy, cw, ch; 48 int cuse, cx, cy, cw, ch;
49 49
50 /* No cutout ? FIXME ? */
51
50 if ((x0 == x1) && (y0 == y1)) 52 if ((x0 == x1) && (y0 == y1))
51 { 53 {
52 _evas_draw_point(dst, dc, x0, y0); 54 _evas_draw_point(dst, dc, x0, y0);
diff --git a/legacy/evas/src/lib/engines/common/evas_map_image.c b/legacy/evas/src/lib/engines/common/evas_map_image.c
index 4106c206e1..776820f04b 100644
--- a/legacy/evas/src/lib/engines/common/evas_map_image.c
+++ b/legacy/evas/src/lib/engines/common/evas_map_image.c
@@ -1,4 +1,5 @@
1#include "evas_common.h" 1#include "evas_common.h"
2#include "evas_private.h"
2#include "evas_blend_private.h" 3#include "evas_blend_private.h"
3#ifdef EVAS_CSERVE2 4#ifdef EVAS_CSERVE2
4#include "evas_cs2_private.h" 5#include "evas_cs2_private.h"
@@ -33,7 +34,7 @@ struct _Line
33 Span span[2]; 34 Span span[2];
34}; 35};
35 36
36static FPc 37static inline FPc
37_interp(int x1, int x2, int p, FPc u1, FPc u2) 38_interp(int x1, int x2, int p, FPc u1, FPc u2)
38{ 39{
39 FPc u; 40 FPc u;
@@ -46,7 +47,7 @@ _interp(int x1, int x2, int p, FPc u1, FPc u2)
46 return u1 + u; 47 return u1 + u;
47} 48}
48 49
49static DATA32 50static inline DATA32
50_interp_col(int x1, int x2, int p, DATA32 col1, DATA32 col2) 51_interp_col(int x1, int x2, int p, DATA32 col1, DATA32 col2)
51{ 52{
52 x2 -= x1; 53 x2 -= x1;
@@ -56,7 +57,7 @@ _interp_col(int x1, int x2, int p, DATA32 col1, DATA32 col2)
56 return INTERP_256(p, col2, col1); 57 return INTERP_256(p, col2, col1);
57} 58}
58 59
59static void 60static inline void
60_limit(Span *s, int c1, int c2, int nocol) 61_limit(Span *s, int c1, int c2, int nocol)
61{ 62{
62 if (s->x1 < c1) 63 if (s->x1 < c1)
@@ -357,17 +358,293 @@ _calc_spans(RGBA_Map_Point *p, Line *spans, int ystart, int yend, int cx, int cy
357 } 358 }
358} 359}
359 360
361/* FIXME: Account for 10% during pipe rendering, should be improved
362 * Could be computing the interpolation once somehow.
363 */
364static void
365_clip_spans(Line *spans, int ystart, int yend,
366 int cx, int cw, Eina_Bool nocol)
367{
368 int y, yp;
369
370 for (y = ystart, yp = 0; y <= yend; y++, yp++)
371 {
372 if (spans[yp].span[0].x1 > -1)
373 {
374 if ((spans[yp].span[0].x1 >= (cx + cw)) ||
375 (spans[yp].span[0].x2 < cx))
376 {
377 spans[yp].span[0].x1 = -1;
378 }
379 else
380 {
381 _limit(&(spans[yp].span[0]), cx, cx + cw, nocol);
382
383 if ((spans[yp].span[1].x1 >= (cx + cw)) ||
384 (spans[yp].span[1].x2 < cx))
385 {
386 spans[yp].span[1].x1 = -1;
387 }
388 else
389 {
390 _limit(&(spans[yp].span[1]),
391 spans[yp].span[0].x2,
392 cx + cw, nocol);
393 }
394 }
395 }
396 }
397}
398
399typedef struct _RGBA_Map_Spans RGBA_Map_Spans;
400typedef struct _RGBA_Map_Cutout RGBA_Map_Cutout;
401
402struct _RGBA_Map_Spans
403{
404 Line *spans;
405 int size;
406 int ystart;
407 int yend;
408
409 int havecol;
410 Eina_Bool nocol;
411 Eina_Bool havea;
412 Eina_Bool direct;
413};
414
415struct _RGBA_Map_Cutout
416{
417 int count;
418
419 Cutout_Rects *rects;
420 RGBA_Map_Spans spans[1];
421};
422
423EAPI void
424evas_common_map_rgba_clean(RGBA_Map *m)
425{
426 RGBA_Map_Cutout *spans = m->engine_data;
427
428 if (spans)
429 {
430 int i;
431
432 if (spans->rects)
433 evas_common_draw_context_apply_clear_cutouts(spans->rects);
434 for (i = 0; i < spans->count; i++)
435 free(spans->spans[i].spans);
436 free(spans);
437 }
438
439 m->engine_data = NULL;
440}
441
442static void
443_rgba_map_cutout_resize(RGBA_Map *m, int count)
444{
445 RGBA_Map_Cutout *old = m->engine_data;
446 RGBA_Map_Cutout *r;
447 int size;
448 int i;
449
450 if (count == 0)
451 goto empty;
452
453 if (old && old->count == count)
454 {
455 return ;
456 }
457
458 size = sizeof (RGBA_Map_Cutout) + sizeof (RGBA_Map_Spans) * (count - 1);
459
460 if (old)
461 {
462 for (i = 0; i < old->count; i++)
463 {
464 free(old->spans[i].spans);
465 old->spans[i].spans = NULL;
466 }
467 }
468
469 r = realloc(old, size);
470 if (!r)
471 goto empty;
472
473 memset(r, 0, size);
474 m->engine_data = r;
475 r->count = count;
476 return ;
477
478 empty:
479 evas_common_map_rgba_clean(m);
480 return ;
481}
482
483static void
484_evas_common_map_rgba_span(RGBA_Map_Spans *span,
485 RGBA_Image *src, RGBA_Image *dst,
486 RGBA_Draw_Context *dc,
487 RGBA_Map_Point *p,
488 int cx, int cy, int cw, int ch)
489{
490 int ytop, ybottom, sw;
491 unsigned int i;
492
493 span->havecol = 4;
494 span->havea = 0;
495 span->direct = 0;
496
497 // find y yop line and y bottom line
498 ytop = p[0].y;
499 if ((p[0].col >> 24) < 0xff) span->havea = 1;
500 if (p[0].col == 0xffffffff) span->havecol--;
501 for (i = 1; i < 4; i++)
502 {
503 if (p[i].y < ytop) ytop = p[i].y;
504 if ((p[i].col >> 24) < 0xff) span->havea = 1;
505 if (p[i].col == 0xffffffff) span->havecol--;
506 }
507
508 ybottom = p[0].y;
509 for (i = 1; i < 4; i++)
510 {
511 if (p[i].y > ybottom) ybottom = p[i].y;
512 }
513
514 // convert to screen space from fixed point
515 ytop = ytop >> FP;
516 ybottom = ybottom >> FP;
517
518 // if its outside the clip vertical bounds - don't bother
519 if ((ytop >= (cy + ch)) || (ybottom < cy)) return;
520
521 // limit to the clip vertical bounds
522 if (ytop < cy) span->ystart = cy;
523 else span->ystart = ytop;
524 if (ybottom >= (cy + ch)) span->yend = (cy + ch) - 1;
525 else span->yend = ybottom;
526
527 // get some source image information
528 sw = src->cache_entry.w;
529
530 // limit u,v coords of points to be within the source image
531 for (i = 0; i < 4; i++)
532 {
533 if (p[i].u < 0) p[i].u = 0;
534 else if (p[i].u > (int)(sw << FP))
535 p[i].u = src->cache_entry.w << FP;
536
537 if (p[i].v < 0) p[i].v = 0;
538 else if (p[i].v > (int)(sw << FP))
539 p[i].v = src->cache_entry.h << FP;
540 }
541
542 // allocate some spans to hold out span list
543 if (span->size < (span->yend - span->ystart + 1))
544 {
545 free(span->spans);
546 span->size = (span->yend - span->ystart + 1);
547 span->spans = calloc(1, span->size * sizeof(Line));
548 }
549 if (!span->spans) return;
550
551 // calculate the spans list
552 _calc_spans(p, span->spans, span->ystart, span->yend, cx, cy, cw, ch);
553
554 // if operation is solid, bypass buf and draw func and draw direct to dst
555 if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
556 (!dc->mul.use) && (!span->havea))
557 {
558 span->direct = 1;
559 }
560}
561
562EAPI Eina_Bool
563evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst,
564 RGBA_Draw_Context *dc,
565 RGBA_Map *m)
566{
567 RGBA_Map_Cutout *spans;
568 Cutout_Rects *rects;
569 Cutout_Rect *r;
570 int i;
571
572 if ((!dc->cutout.rects) && (!dc->clip.use))
573 {
574 evas_common_draw_context_clip_clip(dc, 0, 0,
575 dst->cache_entry.w, dst->cache_entry.h);
576 if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
577 {
578 _rgba_map_cutout_resize(m, 0);
579 return EINA_FALSE;
580 }
581
582 _rgba_map_cutout_resize(m, 1);
583 if (!m->engine_data) return EINA_FALSE;
584
585 spans = m->engine_data;
586
587 _evas_common_map_rgba_span(&spans->spans[0], src, dst, dc, m->pts,
588 0, 0,
589 dst->cache_entry.w, dst->cache_entry.h);
590 return EINA_TRUE;
591 }
592
593 evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
594 /* our clip is 0 size.. abort */
595 if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
596 {
597 _rgba_map_cutout_resize(m, 0);
598 return EINA_FALSE;
599 }
600
601 spans = m->engine_data;
602 if (spans)
603 {
604 rects = spans->rects;
605 spans->rects = NULL;
606 }
607 else
608 {
609 rects = evas_common_draw_context_cutouts_new();
610 }
611 rects = evas_common_draw_context_apply_cutouts(dc, rects);
612 _rgba_map_cutout_resize(m, rects->active);
613
614 spans = m->engine_data;
615 if (!spans)
616 {
617 evas_common_draw_context_apply_clear_cutouts(rects);
618 return EINA_FALSE;
619 }
620
621 spans->rects = rects;
622 for (i = 0; i < spans->rects->active; ++i)
623 {
624 r = spans->rects->rects + i;
625
626 _evas_common_map_rgba_span(&spans->spans[i], src, dst, dc, m->pts,
627 r->x, r->y, r->w, r->h);
628 }
629
630 return EINA_TRUE;
631}
632
360#ifdef BUILD_SCALE_SMOOTH 633#ifdef BUILD_SCALE_SMOOTH
361# ifdef BUILD_MMX 634# ifdef BUILD_MMX
362# undef FUNC_NAME 635# undef FUNC_NAME
636# undef FUNC_NAME_DO
363# define FUNC_NAME evas_common_map_rgba_internal_mmx 637# define FUNC_NAME evas_common_map_rgba_internal_mmx
638# define FUNC_NAME_DO evas_common_map_rgba_internal_mmx_do
364# undef SCALE_USING_MMX 639# undef SCALE_USING_MMX
365# define SCALE_USING_MMX 640# define SCALE_USING_MMX
366# include "evas_map_image_internal.c" 641# include "evas_map_image_internal.c"
367# endif 642# endif
368# ifdef BUILD_C 643# ifdef BUILD_C
369# undef FUNC_NAME 644# undef FUNC_NAME
645# undef FUNC_NAME_DO
370# define FUNC_NAME evas_common_map_rgba_internal 646# define FUNC_NAME evas_common_map_rgba_internal
647# define FUNC_NAME_DO evas_common_map_rgba_internal_do
371# undef SCALE_USING_MMX 648# undef SCALE_USING_MMX
372# include "evas_map_image_internal.c" 649# include "evas_map_image_internal.c"
373# endif 650# endif
@@ -382,7 +659,7 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
382#ifdef BUILD_MMX 659#ifdef BUILD_MMX
383 int mmx, sse, sse2; 660 int mmx, sse, sse2;
384#endif 661#endif
385 Cutout_Rects *rects; 662 static Cutout_Rects *rects = NULL;
386 Cutout_Rect *r; 663 Cutout_Rect *r;
387 int c, cx, cy, cw, ch; 664 int c, cx, cy, cw, ch;
388 int i; 665 int i;
@@ -422,7 +699,7 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
422 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 699 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
423 return; 700 return;
424 } 701 }
425 rects = evas_common_draw_context_apply_cutouts(dc); 702 rects = evas_common_draw_context_apply_cutouts(dc, rects);
426 for (i = 0; i < rects->active; ++i) 703 for (i = 0; i < rects->active; ++i)
427 { 704 {
428 r = rects->rects + i; 705 r = rects->rects + i;
@@ -436,7 +713,65 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
436 evas_common_map_rgba_internal(src, dst, dc, p, smooth, level); 713 evas_common_map_rgba_internal(src, dst, dc, p, smooth, level);
437#endif 714#endif
438 } 715 }
439 evas_common_draw_context_apply_clear_cutouts(rects);
440 /* restore clip info */ 716 /* restore clip info */
441 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 717 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
442} 718}
719
720EAPI void
721evas_common_map_rgba_do(const Eina_Rectangle *clip,
722 RGBA_Image *src, RGBA_Image *dst,
723 RGBA_Draw_Context *dc,
724 const RGBA_Map *m,
725 int smooth, int level)
726{
727#ifdef BUILD_MMX
728 int mmx, sse, sse2;
729#endif
730 const Cutout_Rects *rects;
731 const RGBA_Map_Cutout *spans;
732 Eina_Rectangle area;
733 Cutout_Rect *r;
734 int i;
735
736#ifdef BUILD_MMX
737 evas_common_cpu_can_do(&mmx, &sse, &sse2);
738#endif
739
740 spans = m->engine_data;
741 rects = spans->rects;
742 if (rects->active == 0 &&
743 spans->count == 1)
744 {
745 evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h);
746#ifdef BUILD_MMX
747 if (mmx)
748 evas_common_map_rgba_internal_mmx_do(src, dst, dc,
749 &spans->spans[0], smooth, level);
750 else
751#endif
752#ifdef BUILD_C
753 evas_common_map_rgba_internal_do(src, dst, dc,
754 &spans->spans[0], smooth, level);
755#endif
756 return ;
757 }
758
759 for (i = 0; i < rects->active; ++i)
760 {
761 r = rects->rects + i;
762
763 EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h);
764 if (!eina_rectangle_intersection(&area, clip)) continue ;
765 evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
766#ifdef BUILD_MMX
767 if (mmx)
768 evas_common_map_rgba_internal_mmx_do(src, dst, dc,
769 &spans->spans[i], smooth, level);
770 else
771#endif
772#ifdef BUILD_C
773 evas_common_map_rgba_internal_do(src, dst, dc,
774 &spans->spans[i], smooth, level);
775#endif
776 }
777}
diff --git a/legacy/evas/src/lib/engines/common/evas_map_image.h b/legacy/evas/src/lib/engines/common/evas_map_image.h
index a7cb8cf6b6..f9c7b971bd 100644
--- a/legacy/evas/src/lib/engines/common/evas_map_image.h
+++ b/legacy/evas/src/lib/engines/common/evas_map_image.h
@@ -7,4 +7,17 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
7 int npoints, RGBA_Map_Point *points, 7 int npoints, RGBA_Map_Point *points,
8 int smooth, int level); 8 int smooth, int level);
9 9
10EAPI Eina_Bool
11evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst,
12 RGBA_Draw_Context *dc,
13 RGBA_Map *m);
14EAPI void
15evas_common_map_rgba_do(const Eina_Rectangle *clip,
16 RGBA_Image *src, RGBA_Image *dst,
17 RGBA_Draw_Context *dc,
18 const RGBA_Map *m,
19 int smooth, int level);
20EAPI void
21evas_common_map_rgba_clean(RGBA_Map *m);
22
10#endif /* _EVAS_MAP_H */ 23#endif /* _EVAS_MAP_H */
diff --git a/legacy/evas/src/lib/engines/common/evas_map_image_internal.c b/legacy/evas/src/lib/engines/common/evas_map_image_internal.c
index d60117e8ba..8f4660f1f3 100644
--- a/legacy/evas/src/lib/engines/common/evas_map_image_internal.c
+++ b/legacy/evas/src/lib/engines/common/evas_map_image_internal.c
@@ -74,7 +74,6 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
74 74
75 // allocate some spans to hold out span list 75 // allocate some spans to hold out span list
76 spans = alloca((yend - ystart + 1) * sizeof(Line)); 76 spans = alloca((yend - ystart + 1) * sizeof(Line));
77 if (!spans) return;
78 memset(spans, 0, (yend - ystart + 1) * sizeof(Line)); 77 memset(spans, 0, (yend - ystart + 1) * sizeof(Line));
79 78
80 // calculate the spans list 79 // calculate the spans list
@@ -94,7 +93,6 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
94 int pa; 93 int pa;
95 94
96 buf = alloca(cw * sizeof(DATA32)); 95 buf = alloca(cw * sizeof(DATA32));
97 if (!buf) return;
98 pa = src->cache_entry.flags.alpha; 96 pa = src->cache_entry.flags.alpha;
99 if (havea) src->cache_entry.flags.alpha = 1; 97 if (havea) src->cache_entry.flags.alpha = 1;
100 if (dc->mul.use) 98 if (dc->mul.use)
@@ -115,3 +113,68 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
115#include "evas_map_image_core.c" 113#include "evas_map_image_core.c"
116 } 114 }
117} 115}
116
117static void
118FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst,
119 RGBA_Draw_Context *dc,
120 const RGBA_Map_Spans *ms,
121 int smooth, int level __UNUSED__) // level unused for now - for future use
122{
123 Line *spans;
124 DATA32 *buf = NULL, *sp;
125 RGBA_Gfx_Func func = NULL;
126 int cx, cy, cw, ch;
127 int ystart, yend, y, sw, shp, swp, direct;
128 int havecol;
129 int i;
130
131 cx = dc->clip.x;
132 cy = dc->clip.y;
133 cw = dc->clip.w;
134 ch = dc->clip.h;
135
136 if (ms->ystart < cy) ystart = cy;
137 else ystart = ms->ystart;
138 if (ms->yend >= (cy + ch)) yend = (cy + ch) - 1;
139 else yend = ms->yend;
140
141 // get some source image information
142 sp = src->image.data;
143 sw = src->cache_entry.w;
144 swp = sw << (FP + FPI);
145 shp = src->cache_entry.h << (FP + FPI);
146 havecol = ms->havecol;
147 direct = ms->direct;
148
149 // allocate some s to hold out span list
150 spans = alloca((yend - ystart + 1) * sizeof(Line));
151 memcpy(spans, &ms->spans[ystart - ms->ystart],
152 (yend - ystart + 1) * sizeof(Line));
153 _clip_spans(spans, ystart, yend, cx, cw, ms->nocol);
154
155 // if operation is solid, bypass buf and draw func and draw direct to dst
156 if (!direct)
157 {
158 int pa;
159
160 buf = alloca(cw * sizeof(DATA32));
161 pa = src->cache_entry.flags.alpha;
162 if (ms->havea) src->cache_entry.flags.alpha = 1;
163 if (dc->mul.use)
164 func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, cw, dc->render_op);
165 else
166 func = evas_common_gfx_func_composite_pixel_span_get(src, dst, cw, dc->render_op);
167 src->cache_entry.flags.alpha = pa;
168 }
169
170 if (!havecol)
171 {
172#undef COLMUL
173#include "evas_map_image_core.c"
174 }
175 else
176 {
177#define COLMUL 1
178#include "evas_map_image_core.c"
179 }
180}
diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c
index 0249595f93..590bcd44ca 100644
--- a/legacy/evas/src/lib/engines/common/evas_pipe.c
+++ b/legacy/evas/src/lib/engines/common/evas_pipe.c
@@ -1,5 +1,3 @@
1// THIS IS DEPRECATED. WILL GO EVENTUALLTY. NO NEED TO SUPPORT ANYMORE
2
3#include "evas_common.h" 1#include "evas_common.h"
4#include <unistd.h> 2#include <unistd.h>
5 3
@@ -79,14 +77,14 @@ evas_common_pipe_thread(void *data)
79 77
80 EINA_INLIST_FOREACH(thinfo->tasks, info) 78 EINA_INLIST_FOREACH(thinfo->tasks, info)
81 { 79 {
82 EINA_INLIST_FOREACH(EINA_INLIST_GET(info->im->cache_entry.pipe), p) 80 EINA_INLIST_FOREACH(EINA_INLIST_GET(thinfo->im->cache_entry.pipe), p)
83 { 81 {
84 int i; 82 int i;
85 83
86 for (i = 0; i < p->op_num; i++) 84 for (i = 0; i < p->op_num; i++)
87 { 85 {
88 if (p->op[i].op_func) 86 if (p->op[i].op_func && p->op[i].render)
89 p->op[i].op_func(info->im, &(p->op[i]), info); 87 p->op[i].op_func(thinfo->im, &(p->op[i]), info);
90 } 88 }
91 } 89 }
92 } 90 }
@@ -100,12 +98,58 @@ evas_common_pipe_thread(void *data)
100#endif 98#endif
101 99
102#ifdef BUILD_PTHREAD 100#ifdef BUILD_PTHREAD
101static Eina_List *im_task = NULL;
102static Eina_List *text_task = NULL;
103static Thinfo task_thinfo[TH_MAX];
104static pthread_barrier_t task_thbarrier[2];
105static LK(im_task_mutex);
106static LK(text_task_mutex);
107
103static int thread_num = 0; 108static int thread_num = 0;
104static Thinfo thinfo[TH_MAX]; 109static Thinfo thinfo[TH_MAX];
105static pthread_barrier_t thbarrier[2]; 110static pthread_barrier_t thbarrier[2];
106 111
107static RGBA_Pipe_Thread_Info *buf = NULL; 112static RGBA_Pipe_Thread_Info *buf = NULL;
108static unsigned int buf_size = 0; 113static unsigned int buf_size = 0;
114
115static Cutout_Rects *
116evas_pipe_cutout_rects_pop(Thinfo *info)
117{
118 Cutout_Rects *r;
119
120 r = eina_array_pop(&info->cutout_trash);
121 if (!r) r = evas_common_draw_context_cutouts_new();
122 return r;
123}
124
125static void
126evas_pipe_cutout_rects_push(Thinfo *info, Cutout_Rects *r)
127{
128 /* evas_common_draw_context_apply_clean_cutouts(r); */
129 evas_common_draw_context_cutouts_free(r);
130 eina_array_push(&info->cutout_trash, r);
131}
132
133static void
134evas_pipe_cutout_rects_rotate(Cutout_Rects *r)
135{
136 static int current = 0;
137
138 if (current >= thread_num) current = 0;
139 evas_pipe_cutout_rects_push(&task_thinfo[current], r);
140 current++;
141}
142
143static void
144evas_pipe_prepare_push(RGBA_Pipe_Op *op)
145{
146 static int current = 0;
147
148 if (current >= thread_num) current = 0;
149 eina_array_push(&task_thinfo[current].rects_task, op);
150 current++;
151}
152
109#endif 153#endif
110 154
111static void 155static void
@@ -145,12 +189,11 @@ evas_common_pipe_begin(RGBA_Image *im)
145 for (y = 0; y < im->cache_entry.h; y += estimatey) 189 for (y = 0; y < im->cache_entry.h; y += estimatey)
146 for (x = 0; x < im->cache_entry.w; x += estimatex) 190 for (x = 0; x < im->cache_entry.w; x += estimatex)
147 { 191 {
148 info->im = im; 192 EINA_RECTANGLE_SET(&info->area, x, y,
149 info->x = x; 193 (x + estimatex > im->cache_entry.w) ? im->cache_entry.w - x : estimatex,
150 info->y = y; 194 (y + estimatey > im->cache_entry.h) ? im->cache_entry.h - y : estimatey);
151 info->w = (x + estimatex > im->cache_entry.w) ? im->cache_entry.w - x : estimatex;
152 info->h = (y + estimatey > im->cache_entry.h) ? im->cache_entry.h - y : estimatey;
153 195
196 thinfo[cpu].im = im;
154 thinfo[cpu].tasks = eina_inlist_prepend((void*) thinfo[cpu].tasks, EINA_INLIST_GET(info)); 197 thinfo[cpu].tasks = eina_inlist_prepend((void*) thinfo[cpu].tasks, EINA_INLIST_GET(info));
155 cpu++; 198 cpu++;
156 if (cpu >= (unsigned int) thread_num) cpu = 0; 199 if (cpu >= (unsigned int) thread_num) cpu = 0;
@@ -180,18 +223,14 @@ evas_common_pipe_flush(RGBA_Image *im)
180 RGBA_Pipe *p; 223 RGBA_Pipe *p;
181 int i; 224 int i;
182 225
183 info.im = im; 226 EINA_RECTANGLE_SET(&info.area, 0, 0, im->cache_entry.w, im->cache_entry.h);
184 info.x = 0;
185 info.y = 0;
186 info.w = im->cache_entry.w;
187 info.h = im->cache_entry.h;
188 227
189 /* process pipe - 1 thead */ 228 /* process pipe - 1 thead */
190 for (p = im->cache_entry.pipe; p; p = (RGBA_Pipe *)(EINA_INLIST_GET(p))->next) 229 for (p = im->cache_entry.pipe; p; p = (RGBA_Pipe *)(EINA_INLIST_GET(p))->next)
191 { 230 {
192 for (i = 0; i < p->op_num; i++) 231 for (i = 0; i < p->op_num; i++)
193 { 232 {
194 if (p->op[i].op_func) 233 if (p->op[i].render && p->op[i].op_func)
195 { 234 {
196 p->op[i].op_func(im, &(p->op[i]), &info); 235 p->op[i].op_func(im, &(p->op[i]), &info);
197 } 236 }
@@ -223,6 +262,7 @@ evas_common_pipe_free(RGBA_Image *im)
223 { 262 {
224 p->op[i].free_func(&(p->op[i])); 263 p->op[i].free_func(&(p->op[i]));
225 } 264 }
265 if (p->op[i].rects) evas_pipe_cutout_rects_rotate(p->op[i].rects);
226 } 266 }
227 im->cache_entry.pipe = (RGBA_Pipe *)eina_inlist_remove(EINA_INLIST_GET(im->cache_entry.pipe), EINA_INLIST_GET(p)); 267 im->cache_entry.pipe = (RGBA_Pipe *)eina_inlist_remove(EINA_INLIST_GET(im->cache_entry.pipe), EINA_INLIST_GET(p));
228 free(p); 268 free(p);
@@ -239,10 +279,28 @@ evas_common_pipe_rectangle_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, cons
239 RGBA_Draw_Context context; 279 RGBA_Draw_Context context;
240 280
241 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); 281 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
242 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h); 282 evas_common_rectangle_draw_do(op->rects, &info->area, dst, &(context),
243 evas_common_rectangle_draw(dst, &(context), 283 op->op.rect.x, op->op.rect.y,
244 op->op.rect.x, op->op.rect.y, 284 op->op.rect.w, op->op.rect.h);
245 op->op.rect.w, op->op.rect.h); 285}
286
287static Eina_Bool
288evas_common_pipe_rectangle_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op)
289{
290 RGBA_Draw_Context context;
291 Cutout_Rects *recycle;
292 Thinfo *info = data;
293 Eina_Bool r;
294
295 recycle = evas_pipe_cutout_rects_pop(info);
296 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
297 r = evas_common_rectangle_draw_prepare(recycle, dst, &context,
298 op->op.rect.x, op->op.rect.y,
299 op->op.rect.w, op->op.rect.h);
300 if (recycle->active) op->rects = recycle;
301 else evas_pipe_cutout_rects_push(info, recycle);
302
303 return r;
246} 304}
247 305
248EAPI void 306EAPI void
@@ -259,6 +317,8 @@ evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, i
259 op->op.rect.h = h; 317 op->op.rect.h = h;
260 op->op_func = evas_common_pipe_rectangle_draw_do; 318 op->op_func = evas_common_pipe_rectangle_draw_do;
261 op->free_func = evas_common_pipe_op_free; 319 op->free_func = evas_common_pipe_op_free;
320 op->prepare_func = evas_common_pipe_rectangle_prepare;
321 evas_pipe_prepare_push(op);
262 evas_common_pipe_draw_context_copy(dc, op); 322 evas_common_pipe_draw_context_copy(dc, op);
263} 323}
264 324
@@ -269,7 +329,7 @@ evas_common_pipe_line_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGB
269 RGBA_Draw_Context context; 329 RGBA_Draw_Context context;
270 330
271 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); 331 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
272 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h); 332 evas_common_draw_context_clip_clip(&(context), info->area.x, info->area.y, info->area.w, info->area.h);
273 evas_common_line_draw(dst, &(context), 333 evas_common_line_draw(dst, &(context),
274 op->op.line.x0, op->op.line.y0, 334 op->op.line.x0, op->op.line.y0,
275 op->op.line.x1, op->op.line.y1); 335 op->op.line.x1, op->op.line.y1);
@@ -289,6 +349,7 @@ evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
289 op->op.line.y1 = y1; 349 op->op.line.y1 = y1;
290 op->op_func = evas_common_pipe_line_draw_do; 350 op->op_func = evas_common_pipe_line_draw_do;
291 op->free_func = evas_common_pipe_op_free; 351 op->free_func = evas_common_pipe_op_free;
352 op->prepare_func = NULL;
292 evas_common_pipe_draw_context_copy(dc, op); 353 evas_common_pipe_draw_context_copy(dc, op);
293} 354}
294 355
@@ -298,6 +359,7 @@ evas_common_pipe_op_poly_free(RGBA_Pipe_Op *op)
298{ 359{
299 RGBA_Polygon_Point *p; 360 RGBA_Polygon_Point *p;
300 361
362#if 0
301 while (op->op.poly.points) 363 while (op->op.poly.points)
302 { 364 {
303 p = op->op.poly.points; 365 p = op->op.poly.points;
@@ -305,6 +367,7 @@ evas_common_pipe_op_poly_free(RGBA_Pipe_Op *op)
305 EINA_INLIST_GET(p)); 367 EINA_INLIST_GET(p));
306 free(p); 368 free(p);
307 } 369 }
370#endif
308 evas_common_pipe_op_free(op); 371 evas_common_pipe_op_free(op);
309} 372}
310 373
@@ -314,9 +377,9 @@ evas_common_pipe_poly_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGB
314 RGBA_Draw_Context context; 377 RGBA_Draw_Context context;
315 378
316 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); 379 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
317 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h); 380 evas_common_draw_context_clip_clip(&(context), info->area.x, info->area.y, info->area.w, info->area.h);
318 evas_common_polygon_draw(dst, &(context), 381 evas_common_polygon_draw(dst, &(context),
319 op->op.poly.points, 0, 0); 382 op->op.poly.points, op->op.poly.x, op->op.poly.y);
320} 383}
321 384
322EAPI void 385EAPI void
@@ -324,12 +387,13 @@ evas_common_pipe_poly_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
324 RGBA_Polygon_Point *points, int x, int y) 387 RGBA_Polygon_Point *points, int x, int y)
325{ 388{
326 RGBA_Pipe_Op *op; 389 RGBA_Pipe_Op *op;
327 RGBA_Polygon_Point *pts = NULL, *p, *pp; 390 /* RGBA_Polygon_Point *pts = NULL, *p, *pp; */
328 391
329 if (!points) return; 392 if (!points) return;
330 dst->cache_entry.pipe = evas_common_pipe_add(dst->cache_entry.pipe, &op); 393 dst->cache_entry.pipe = evas_common_pipe_add(dst->cache_entry.pipe, &op);
331 if (!dst->cache_entry.pipe) return; 394 if (!dst->cache_entry.pipe) return;
332 /* FIXME: copy points - maybe we should refcount? */ 395 /* FIXME: copy points - maybe we should refcount? */
396#if 0
333 for (p = points; p; p = (RGBA_Polygon_Point *)(EINA_INLIST_GET(p))->next) 397 for (p = points; p; p = (RGBA_Polygon_Point *)(EINA_INLIST_GET(p))->next)
334 { 398 {
335 pp = calloc(1, sizeof(RGBA_Polygon_Point)); 399 pp = calloc(1, sizeof(RGBA_Polygon_Point));
@@ -340,9 +404,13 @@ evas_common_pipe_poly_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
340 pts = (RGBA_Polygon_Point *)eina_inlist_append(EINA_INLIST_GET(pts), EINA_INLIST_GET(pp)); 404 pts = (RGBA_Polygon_Point *)eina_inlist_append(EINA_INLIST_GET(pts), EINA_INLIST_GET(pp));
341 } 405 }
342 } 406 }
343 op->op.poly.points = pts; 407#endif
408 op->op.poly.x = x;
409 op->op.poly.y = y;
410 op->op.poly.points = points/* pts */;
344 op->op_func = evas_common_pipe_poly_draw_do; 411 op->op_func = evas_common_pipe_poly_draw_do;
345 op->free_func = evas_common_pipe_op_poly_free; 412 op->free_func = evas_common_pipe_op_poly_free;
413 op->prepare_func = NULL; /* FIXME: If we really want to improve it, we should prepare span for it here */
346 evas_common_pipe_draw_context_copy(dc, op); 414 evas_common_pipe_draw_context_copy(dc, op);
347} 415}
348 416
@@ -360,8 +428,24 @@ evas_common_pipe_text_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGB
360 RGBA_Draw_Context context; 428 RGBA_Draw_Context context;
361 429
362 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); 430 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
363 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h); 431 evas_common_font_draw_do(op->rects, &info->area, op->op.text.func, dst, &(context), op->op.text.x, op->op.text.y, op->op.text.intl_props);
364 evas_common_font_draw(dst, &(context), op->op.text.x, op->op.text.y, op->op.text.intl_props); 432}
433
434static Eina_Bool
435evas_common_pipe_text_draw_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op)
436{
437 RGBA_Draw_Context context;
438 Cutout_Rects *recycle;
439 Thinfo *info = data;
440 Eina_Bool r;
441
442 recycle = evas_pipe_cutout_rects_pop(info);
443 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
444 r = evas_common_font_draw_prepare_cutout(recycle, dst, &context, &(op->op.text.func));
445 if (recycle->active) op->rects = recycle;
446 else evas_pipe_cutout_rects_push(info, recycle);
447
448 return r;
365} 449}
366 450
367EAPI void 451EAPI void
@@ -378,6 +462,8 @@ evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
378 evas_common_text_props_content_ref(intl_props); 462 evas_common_text_props_content_ref(intl_props);
379 op->op_func = evas_common_pipe_text_draw_do; 463 op->op_func = evas_common_pipe_text_draw_do;
380 op->free_func = evas_common_pipe_op_text_free; 464 op->free_func = evas_common_pipe_op_text_free;
465 op->prepare_func = evas_common_pipe_text_draw_prepare;
466 evas_pipe_prepare_push(op);
381 evas_common_pipe_draw_context_copy(dc, op); 467 evas_common_pipe_draw_context_copy(dc, op);
382 evas_common_pipe_text_prepare(intl_props); 468 evas_common_pipe_text_prepare(intl_props);
383} 469}
@@ -394,15 +480,35 @@ evas_common_pipe_op_image_free(RGBA_Pipe_Op *op)
394 evas_common_pipe_op_free(op); 480 evas_common_pipe_op_free(op);
395} 481}
396 482
483static Eina_Bool
484evas_common_pipe_op_image_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op)
485{
486 RGBA_Draw_Context context;
487 Cutout_Rects *recycle;
488 Thinfo *info = data;
489 Eina_Bool r;
490
491 recycle = evas_pipe_cutout_rects_pop(info);
492 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
493 r = evas_common_scale_rgba_in_to_out_clip_prepare(recycle, op->op.image.src, dst, &(context),
494 op->op.image.dx, op->op.image.dy,
495 op->op.image.dw, op->op.image.dh);
496 if (recycle->active) op->rects = recycle;
497 else evas_pipe_cutout_rects_push(info, recycle);
498
499 return r;
500}
501
397static void 502static void
398evas_common_pipe_image_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGBA_Pipe_Thread_Info *info) 503evas_common_pipe_image_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGBA_Pipe_Thread_Info *info)
399{ 504{
400 RGBA_Draw_Context context; 505 RGBA_Draw_Context context;
401 506
402 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); 507 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
403 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
404 508
405#ifdef SCALECACHE 509#ifdef SCALECACHE
510 /* FIXME: Make the scalecache path use the prepared Cutout ? */
511 evas_common_draw_context_clip_clip(&(context), info->area.x, info->area.y, info->area.w, info->area.h);
406 evas_common_rgba_image_scalecache_do((Image_Entry *)(op->op.image.src), 512 evas_common_rgba_image_scalecache_do((Image_Entry *)(op->op.image.src),
407 dst, &(context), 513 dst, &(context),
408 op->op.image.smooth, 514 op->op.image.smooth,
@@ -417,29 +523,31 @@ evas_common_pipe_image_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RG
417#else 523#else
418 if (op->op.image.smooth) 524 if (op->op.image.smooth)
419 { 525 {
420 evas_common_scale_rgba_in_to_out_clip_smooth(op->op.image.src, 526 evas_common_scale_rgba_in_to_out_clip_smooth_do(op->rects, &info->area,
421 dst, &(context), 527 op->op.image.src,
422 op->op.image.sx, 528 dst, &(context),
423 op->op.image.sy, 529 op->op.image.sx,
424 op->op.image.sw, 530 op->op.image.sy,
425 op->op.image.sh, 531 op->op.image.sw,
426 op->op.image.dx, 532 op->op.image.sh,
427 op->op.image.dy, 533 op->op.image.dx,
428 op->op.image.dw, 534 op->op.image.dy,
429 op->op.image.dh); 535 op->op.image.dw,
536 op->op.image.dh);
430 } 537 }
431 else 538 else
432 { 539 {
433 evas_common_scale_rgba_in_to_out_clip_sample(op->op.image.src, 540 evas_common_scale_rgba_in_to_out_clip_sample_do(op->rects, &info->area,
434 dst, &(context), 541 op->op.image.src,
435 op->op.image.sx, 542 dst, &(context),
436 op->op.image.sy, 543 op->op.image.sx,
437 op->op.image.sw, 544 op->op.image.sy,
438 op->op.image.sh, 545 op->op.image.sw,
439 op->op.image.dx, 546 op->op.image.sh,
440 op->op.image.dy, 547 op->op.image.dx,
441 op->op.image.dw, 548 op->op.image.dy,
442 op->op.image.dh); 549 op->op.image.dw,
550 op->op.image.dh);
443 } 551 }
444#endif 552#endif
445} 553}
@@ -471,6 +579,8 @@ evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst,
471 op->op.image.src = src; 579 op->op.image.src = src;
472 op->op_func = evas_common_pipe_image_draw_do; 580 op->op_func = evas_common_pipe_image_draw_do;
473 op->free_func = evas_common_pipe_op_image_free; 581 op->free_func = evas_common_pipe_op_image_free;
582 op->prepare_func = evas_common_pipe_op_image_prepare;
583 evas_pipe_prepare_push(op);
474 evas_common_pipe_draw_context_copy(dc, op); 584 evas_common_pipe_draw_context_copy(dc, op);
475 585
476 evas_common_pipe_image_load(src); 586 evas_common_pipe_image_load(src);
@@ -482,7 +592,7 @@ evas_common_pipe_op_map_free(RGBA_Pipe_Op *op)
482 op->op.map.src->ref--; 592 op->op.map.src->ref--;
483 if (op->op.map.src->ref == 0) 593 if (op->op.map.src->ref == 0)
484 evas_cache_image_drop(&op->op.map.src->cache_entry); 594 evas_cache_image_drop(&op->op.map.src->cache_entry);
485 free(op->op.map.p); 595 /* free(op->op.map.p); */
486 evas_common_pipe_op_free(op); 596 evas_common_pipe_op_free(op);
487} 597}
488 598
@@ -492,43 +602,56 @@ evas_common_pipe_map_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGBA
492 RGBA_Draw_Context context; 602 RGBA_Draw_Context context;
493 603
494 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); 604 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
495 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h); 605 evas_common_map_rgba_do(&info->area, op->op.map.src, dst,
606 &context, op->op.map.m,
607 op->op.map.smooth, op->op.map.level);
608}
609
610static Eina_Bool
611evas_common_pipe_map_draw_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op)
612{
613 RGBA_Draw_Context context;
614 Thinfo *info = data;
615 Eina_Bool r;
616
617 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
618 r = evas_common_map_rgba_prepare(op->op.map.src, dst,
619 &context, op->op.map.m);
496 620
497 evas_common_map_rgba(op->op.map.src, dst, 621 return r;
498 &context, op->op.map.npoints, op->op.map.p,
499 op->op.map.smooth, op->op.map.level);
500} 622}
501 623
502EAPI void 624EAPI void
503evas_common_pipe_map_draw(RGBA_Image *src, RGBA_Image *dst, 625evas_common_pipe_map_draw(RGBA_Image *src, RGBA_Image *dst,
504 RGBA_Draw_Context *dc, int npoints, RGBA_Map_Point *p, 626 RGBA_Draw_Context *dc, RGBA_Map *m,
505 int smooth, int level) 627 int smooth, int level)
506{ 628{
507 RGBA_Pipe_Op *op; 629 RGBA_Pipe_Op *op;
508 RGBA_Map_Point *pts_copy; 630 /* RGBA_Map_Point *pts_copy; */
509 int i; 631 int i;
510 632
511 if (!src) return; 633 if (!src) return;
512 pts_copy = malloc(sizeof (RGBA_Map_Point) * 4); 634 /* pts_copy = malloc(sizeof (RGBA_Map_Point) * 4); */
513 if (!pts_copy) return; 635 /* if (!pts_copy) return; */
514 dst->cache_entry.pipe = evas_common_pipe_add(dst->cache_entry.pipe, &op); 636 dst->cache_entry.pipe = evas_common_pipe_add(dst->cache_entry.pipe, &op);
515 if (!dst->cache_entry.pipe) 637 if (!dst->cache_entry.pipe)
516 { 638 {
517 free(pts_copy); 639 /* free(pts_copy); */
518 return; 640 return;
519 } 641 }
520 642
521 for (i = 0; i < 4; ++i) 643 /* for (i = 0; i < 4; ++i) */
522 pts_copy[i] = p[i]; 644 /* pts_copy[i] = p[i]; */
523 645
524 op->op.map.npoints = npoints;
525 op->op.map.smooth = smooth; 646 op->op.map.smooth = smooth;
526 op->op.map.level = level; 647 op->op.map.level = level;
527 src->ref++; 648 src->ref++;
528 op->op.map.src = src; 649 op->op.map.src = src;
529 op->op.map.p = pts_copy; 650 op->op.map.m = m;
530 op->op_func = evas_common_pipe_map_draw_do; 651 op->op_func = evas_common_pipe_map_draw_do;
531 op->free_func = evas_common_pipe_op_map_free; 652 op->free_func = evas_common_pipe_op_map_free;
653 op->prepare_func = evas_common_pipe_map_draw_prepare;
654 evas_pipe_prepare_push(op);
532 evas_common_pipe_draw_context_copy(dc, op); 655 evas_common_pipe_draw_context_copy(dc, op);
533 656
534 evas_common_pipe_image_load(src); 657 evas_common_pipe_image_load(src);
@@ -563,15 +686,6 @@ evas_common_pipe_map_render(RGBA_Image *root)
563} 686}
564 687
565#ifdef BUILD_PTHREAD 688#ifdef BUILD_PTHREAD
566static Eina_List *im_task = NULL;
567static Eina_List *text_task = NULL;
568static Thinfo task_thinfo[TH_MAX];
569static pthread_barrier_t task_thbarrier[2];
570static LK(im_task_mutex);
571static LK(text_task_mutex);
572#endif
573
574#ifdef BUILD_PTHREAD
575static void* 689static void*
576evas_common_pipe_load(void *data) 690evas_common_pipe_load(void *data)
577{ 691{
@@ -580,6 +694,9 @@ evas_common_pipe_load(void *data)
580 tinfo = data; 694 tinfo = data;
581 for (;;) 695 for (;;)
582 { 696 {
697 RGBA_Pipe_Op *op;
698 Eina_Array_Iterator it;
699 unsigned int i;
583 /* wait for start signal */ 700 /* wait for start signal */
584 pthread_barrier_wait(&(tinfo->barrier[0])); 701 pthread_barrier_wait(&(tinfo->barrier[0]));
585 702
@@ -625,6 +742,10 @@ evas_common_pipe_load(void *data)
625 } 742 }
626 } 743 }
627 744
745 EINA_ARRAY_ITER_NEXT(&tinfo->rects_task, i, op, it)
746 op->render = op->prepare_func(tinfo, tinfo->im, op);
747 eina_array_clean(&tinfo->rects_task);
748
628 /* send finished signal */ 749 /* send finished signal */
629 pthread_barrier_wait(&(tinfo->barrier[1])); 750 pthread_barrier_wait(&(tinfo->barrier[1]));
630 } 751 }
@@ -636,20 +757,23 @@ evas_common_pipe_load(void *data)
636static volatile int bval = 0; 757static volatile int bval = 0;
637 758
638static void 759static void
639evas_common_pipe_load_do(void) 760evas_common_pipe_load_do(RGBA_Image *im)
640{ 761{
641#ifdef BUILD_PTHREAD 762#ifdef BUILD_PTHREAD
642 if (!im_task && !text_task) return ; 763 int i;
643 764
644 /* Notify worker thread. */ 765 for (i = 0; i < thread_num; i++)
645 pthread_barrier_wait(&(task_thbarrier[0])); 766 task_thinfo[i].im = im;
646 767
647 /* sync worker threads */ 768 /* Notify worker thread. */
648 pthread_barrier_wait(&(task_thbarrier[1])); 769 pthread_barrier_wait(&(task_thbarrier[0]));
770
771 /* sync worker threads */
772 pthread_barrier_wait(&(task_thbarrier[1]));
649#endif 773#endif
650} 774}
651 775
652static Eina_Bool 776EAPI Eina_Bool
653evas_common_pipe_init(void) 777evas_common_pipe_init(void)
654{ 778{
655#ifdef BUILD_PTHREAD 779#ifdef BUILD_PTHREAD
@@ -703,6 +827,8 @@ evas_common_pipe_init(void)
703 task_thinfo[i].thread_num = i; 827 task_thinfo[i].thread_num = i;
704 task_thinfo[i].tasks = NULL; 828 task_thinfo[i].tasks = NULL;
705 task_thinfo[i].barrier = task_thbarrier; 829 task_thinfo[i].barrier = task_thbarrier;
830 eina_array_step_set(&task_thinfo[i].cutout_trash, sizeof (Eina_Array), 8);
831 eina_array_step_set(&task_thinfo[i].rects_task, sizeof (Eina_Array), 8);
706 /* setup initial locks */ 832 /* setup initial locks */
707 pthread_create(&(task_thinfo[i].thread_id), &attr, 833 pthread_create(&(task_thinfo[i].thread_id), &attr,
708 evas_common_pipe_load, &(task_thinfo[i])); 834 evas_common_pipe_load, &(task_thinfo[i]));
@@ -746,7 +872,7 @@ evas_common_pipe_text_prepare(Evas_Text_Props *text_props)
746 fi = text_props->font_instance; 872 fi = text_props->font_instance;
747 if (!fi) return ; 873 if (!fi) return ;
748 874
749 if (!text_props->changed && text_props->generation == fi->generation && text_props->bin) 875 if (!text_props->changed && text_props->generation == fi->generation && text_props->glyphs)
750 return ; 876 return ;
751 877
752 LKL(fi->ft_mutex); 878 LKL(fi->ft_mutex);
@@ -783,7 +909,7 @@ evas_common_pipe_map_begin(RGBA_Image *root)
783 } 909 }
784 } 910 }
785 911
786 evas_common_pipe_load_do(); 912 evas_common_pipe_load_do(root);
787 913
788 evas_common_pipe_map_render(root); 914 evas_common_pipe_map_render(root);
789} 915}
diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.h b/legacy/evas/src/lib/engines/common/evas_pipe.h
index b4614241b7..c6a28ff78e 100644
--- a/legacy/evas/src/lib/engines/common/evas_pipe.h
+++ b/legacy/evas/src/lib/engines/common/evas_pipe.h
@@ -7,10 +7,13 @@
7#ifdef BUILD_PTHREAD 7#ifdef BUILD_PTHREAD
8typedef struct _Thinfo 8typedef struct _Thinfo
9{ 9{
10 RGBA_Image *im;
10 int thread_num; 11 int thread_num;
11 pthread_t thread_id; 12 pthread_t thread_id;
12 pthread_barrier_t *barrier; 13 pthread_barrier_t *barrier;
13 const Eina_Inlist *tasks; 14 const Eina_Inlist *tasks;
15 Eina_Array cutout_trash;
16 Eina_Array rects_task;
14} Thinfo; 17} Thinfo;
15#endif 18#endif
16 19
@@ -18,6 +21,8 @@ typedef struct _Thinfo
18 * threadable 21 * threadable
19 */ 22 */
20 23
24EAPI Eina_Bool evas_common_pipe_init(void);
25
21EAPI void evas_common_pipe_free(RGBA_Image *im); 26EAPI void evas_common_pipe_free(RGBA_Image *im);
22EAPI void evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); 27EAPI void evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
23EAPI void evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1); 28EAPI void evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
@@ -28,8 +33,8 @@ EAPI void evas_common_pipe_image_load(RGBA_Image *im);
28EAPI 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); 33EAPI 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);
29EAPI void evas_common_pipe_map_begin(RGBA_Image *root); 34EAPI void evas_common_pipe_map_begin(RGBA_Image *root);
30EAPI void evas_common_pipe_map_draw(RGBA_Image *src, RGBA_Image *dst, 35EAPI void evas_common_pipe_map_draw(RGBA_Image *src, RGBA_Image *dst,
31 RGBA_Draw_Context *dc, int npoints, RGBA_Map_Point *p, 36 RGBA_Draw_Context *dc, RGBA_Map *m,
32 int smooth, int level); 37 int smooth, int level);
33EAPI void evas_common_pipe_flush(RGBA_Image *im); 38EAPI void evas_common_pipe_flush(RGBA_Image *im);
34 39
35#endif /* _EVAS_PIPE_H */ 40#endif /* _EVAS_PIPE_H */
diff --git a/legacy/evas/src/lib/engines/common/evas_rectangle.h b/legacy/evas/src/lib/engines/common/evas_rectangle.h
index a653b047a2..8fdcb774cd 100644
--- a/legacy/evas/src/lib/engines/common/evas_rectangle.h
+++ b/legacy/evas/src/lib/engines/common/evas_rectangle.h
@@ -6,6 +6,8 @@ EAPI void evas_common_rectangle_init (void);
6 6
7EAPI void evas_common_rectangle_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); 7EAPI void evas_common_rectangle_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
8 8
9EAPI void evas_common_rectangle_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
10EAPI Eina_Bool evas_common_rectangle_draw_prepare(Cutout_Rects *reuse, const RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
9 11
10#endif /* _EVAS_RECTANGLE_H */ 12#endif /* _EVAS_RECTANGLE_H */
11 13
diff --git a/legacy/evas/src/lib/engines/common/evas_rectangle_main.c b/legacy/evas/src/lib/engines/common/evas_rectangle_main.c
index cd3d16c1c8..40747613b9 100644
--- a/legacy/evas/src/lib/engines/common/evas_rectangle_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_rectangle_main.c
@@ -1,4 +1,5 @@
1#include "evas_common.h" 1#include "evas_common.h"
2#include "evas_private.h"
2#include "evas_blend_private.h" 3#include "evas_blend_private.h"
3 4
4static void rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); 5static void rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
@@ -11,7 +12,7 @@ evas_common_rectangle_init(void)
11EAPI void 12EAPI void
12evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) 13evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
13{ 14{
14 Cutout_Rects *rects; 15 static Cutout_Rects *rects = NULL;
15 Cutout_Rect *r; 16 Cutout_Rect *r;
16 int c, cx, cy, cw, ch; 17 int c, cx, cy, cw, ch;
17 int i; 18 int i;
@@ -34,20 +35,67 @@ evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
34 /* our clip is 0 size.. abort */ 35 /* our clip is 0 size.. abort */
35 if ((dc->clip.w > 0) && (dc->clip.h > 0)) 36 if ((dc->clip.w > 0) && (dc->clip.h > 0))
36 { 37 {
37 rects = evas_common_draw_context_apply_cutouts(dc); 38 rects = evas_common_draw_context_apply_cutouts(dc, rects);
38 for (i = 0; i < rects->active; ++i) 39 for (i = 0; i < rects->active; ++i)
39 { 40 {
40 r = rects->rects + i; 41 r = rects->rects + i;
41 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 42 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
42 rectangle_draw_internal(dst, dc, x, y, w, h); 43 rectangle_draw_internal(dst, dc, x, y, w, h);
43 } 44 }
44 evas_common_draw_context_apply_clear_cutouts(rects);
45 } 45 }
46 } 46 }
47 /* restore clip info */ 47 /* restore clip info */
48 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 48 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
49} 49}
50 50
51EAPI Eina_Bool
52evas_common_rectangle_draw_prepare(Cutout_Rects *reuse, const RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
53{
54 if ((w <= 0) || (h <= 0)) return EINA_FALSE;
55 if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, dst->cache_entry.w, dst->cache_entry.h)))
56 return EINA_FALSE;
57 /* save out clip info */
58 evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
59 /* no cutouts - cut right to the chase */
60 if (dc->cutout.rects)
61 {
62 evas_common_draw_context_clip_clip(dc, x, y, w, h);
63 /* our clip is 0 size.. abort */
64 if ((dc->clip.w > 0) && (dc->clip.h > 0))
65 reuse = evas_common_draw_context_apply_cutouts(dc, reuse);
66 }
67
68 return EINA_TRUE;
69}
70
71EAPI void
72evas_common_rectangle_draw_do(const Cutout_Rects *reuse,
73 const Eina_Rectangle *clip,
74 RGBA_Image *dst, RGBA_Draw_Context *dc,
75 int x, int y, int w, int h)
76{
77 Eina_Rectangle area;
78 Cutout_Rect *r;
79 int i;
80
81 if (!reuse)
82 {
83 evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h);
84 rectangle_draw_internal(dst, dc, x, y, w, h);
85 return ;
86 }
87
88 for (i = 0; i < reuse->active; ++i)
89 {
90 r = reuse->rects + i;
91
92 EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h);
93 if (!eina_rectangle_intersection(&area, clip)) continue ;
94 evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
95 rectangle_draw_internal(dst, dc, x, y, w, h);
96 }
97}
98
51static void 99static void
52rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) 100rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
53{ 101{
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_main.c b/legacy/evas/src/lib/engines/common/evas_scale_main.c
index 959336c0f7..bb11c6bded 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_main.c
@@ -1,6 +1,33 @@
1#include "evas_common.h" 1#include "evas_common.h"
2#include "evas_private.h"
2 3
3EAPI void 4EAPI void
4evas_common_scale_init(void) 5evas_common_scale_init(void)
5{ 6{
6} 7}
8
9EAPI Eina_Bool
10evas_common_scale_rgba_in_to_out_clip_prepare(Cutout_Rects *reuse, const RGBA_Image *src __UNUSED__,
11 const RGBA_Image *dst,
12 RGBA_Draw_Context *dc,
13 int dst_region_x, int dst_region_y,
14 int dst_region_w, int dst_region_h)
15{
16 /* handle cutouts here! */
17 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return EINA_FALSE;
18 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h,
19 0, 0, dst->cache_entry.w, dst->cache_entry.h)))
20 return EINA_FALSE;
21 /* no cutouts - cut right to the chase */
22 if (!dc->cutout.rects) return EINA_TRUE;
23
24 evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
25 evas_common_draw_context_clip_clip(dc, dst_region_x, dst_region_y, dst_region_w, dst_region_h);
26 /* our clip is 0 size.. abort */
27 if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
28 return EINA_FALSE;
29 reuse = evas_common_draw_context_apply_cutouts(dc, reuse);
30
31 return EINA_TRUE;
32}
33
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_main.h b/legacy/evas/src/lib/engines/common/evas_scale_main.h
index eafd9d2ae2..e2ef8fa9ce 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_main.h
+++ b/legacy/evas/src/lib/engines/common/evas_scale_main.h
@@ -10,4 +10,9 @@ EAPI void evas_common_scale_rgba_in_to_out_clip_sample (RGBA_Image *src, RG
10 10
11EAPI void evas_common_rgba_image_scalecache_dump(void); 11EAPI void evas_common_rgba_image_scalecache_dump(void);
12 12
13EAPI void evas_common_scale_rgba_in_to_out_clip_sample_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, 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);
14EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, 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);
15EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_prepare (Cutout_Rects *reuse, const RGBA_Image *src, const RGBA_Image *dst, RGBA_Draw_Context *dc, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
16
17
13#endif /* _EVAS_SCALE_MAIN_H */ 18#endif /* _EVAS_SCALE_MAIN_H */
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_sample.c b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
index 3b232213d4..ea1061802d 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_sample.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
@@ -1,11 +1,28 @@
1#include "evas_common.h" 1#include "evas_common.h"
2#include "evas_blend_private.h" 2#include "evas_blend_private.h"
3 3
4void scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, 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); 4static void scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, 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);
5 5
6#ifndef BUILD_SCALE_SMOOTH 6#ifndef BUILD_SCALE_SMOOTH
7#ifdef BUILD_SCALE_SAMPLE 7#ifdef BUILD_SCALE_SAMPLE
8EAPI void 8EAPI void
9evas_common_scale_rgba_in_to_out_clip_smooth_do(const Cutout_Rects *reuse,
10 const Eina_Rectangle *clip,
11 RGBA_Image *src, RGBA_Image *dst,
12 RGBA_Draw_Context *dc,
13 int src_region_x, int src_region_y,
14 int src_region_w, int src_region_h,
15 int dst_region_x, int dst_region_y,
16 int dst_region_w, int dst_region_h)
17{
18 evas_common_scale_rgba_in_to_out_clip_sample_do(reuse, clip, src, dst, dc,
19 src_region_x, src_region_y,
20 src_region_w, src_region_h,
21 dst_region_x, dst_region_y,
22 dst_region_w, dst_region_h);
23}
24
25EAPI void
9evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst, 26evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
10 RGBA_Draw_Context *dc, 27 RGBA_Draw_Context *dc,
11 int src_region_x, int src_region_y, 28 int src_region_x, int src_region_y,
@@ -31,7 +48,7 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
31 int dst_region_x, int dst_region_y, 48 int dst_region_x, int dst_region_y,
32 int dst_region_w, int dst_region_h) 49 int dst_region_w, int dst_region_h)
33{ 50{
34 Cutout_Rects *rects; 51 static Cutout_Rects *rects = NULL;
35 Cutout_Rect *r; 52 Cutout_Rect *r;
36 int c, cx, cy, cw, ch; 53 int c, cx, cy, cw, ch;
37 int i; 54 int i;
@@ -60,7 +77,7 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
60 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 77 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
61 return; 78 return;
62 } 79 }
63 rects = evas_common_draw_context_apply_cutouts(dc); 80 rects = evas_common_draw_context_apply_cutouts(dc, rects);
64 for (i = 0; i < rects->active; ++i) 81 for (i = 0; i < rects->active; ++i)
65 { 82 {
66 r = rects->rects + i; 83 r = rects->rects + i;
@@ -72,12 +89,51 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
72 dst_region_w, dst_region_h); 89 dst_region_w, dst_region_h);
73 90
74 } 91 }
75 evas_common_draw_context_apply_clear_cutouts(rects);
76 /* restore clip info */ 92 /* restore clip info */
77 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 93 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
78} 94}
79 95
80void 96EAPI void
97evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse,
98 const Eina_Rectangle *clip,
99 RGBA_Image *src, RGBA_Image *dst,
100 RGBA_Draw_Context *dc,
101 int src_region_x, int src_region_y,
102 int src_region_w, int src_region_h,
103 int dst_region_x, int dst_region_y,
104 int dst_region_w, int dst_region_h)
105{
106 Eina_Rectangle area;
107 Cutout_Rect *r;
108 int i;
109
110 if (!reuse)
111 {
112 evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h);
113 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
114 src_region_x, src_region_y,
115 src_region_w, src_region_h,
116 dst_region_x, dst_region_y,
117 dst_region_w, dst_region_h);
118 return;
119 }
120
121 for (i = 0; i < reuse->active; ++i)
122 {
123 r = reuse->rects + i;
124
125 EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h);
126 if (!eina_rectangle_intersection(&area, clip)) continue ;
127 evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
128 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
129 src_region_x, src_region_y,
130 src_region_w, src_region_h,
131 dst_region_x, dst_region_y,
132 dst_region_w, dst_region_h);
133 }
134}
135
136static void
81scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, 137scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
82 RGBA_Draw_Context *dc, 138 RGBA_Draw_Context *dc,
83 int src_region_x, int src_region_y, 139 int src_region_x, int src_region_y,
@@ -403,5 +459,22 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
403 dst_region_x, dst_region_y, 459 dst_region_x, dst_region_y,
404 dst_region_w, dst_region_h); 460 dst_region_w, dst_region_h);
405} 461}
462
463EAPI void
464evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse,
465 const Eina_Rectangle *clip,
466 RGBA_Image *src, RGBA_Image *dst,
467 RGBA_Draw_Context *dc,
468 int src_region_x, int src_region_y,
469 int src_region_w, int src_region_h,
470 int dst_region_x, int dst_region_y,
471 int dst_region_w, int dst_region_h)
472{
473 evas_common_scale_rgba_in_to_out_clip_smooth_do(reuse, clip, src, dst, dc,
474 src_region_x, src_region_y,
475 src_region_w, src_region_h,
476 dst_region_x, dst_region_y,
477 dst_region_w, dst_region_h);
478}
406#endif 479#endif
407#endif 480#endif
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c
index d3aada65b6..ca852033c8 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c
@@ -460,7 +460,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
460# ifdef BUILD_MMX 460# ifdef BUILD_MMX
461 int mmx, sse, sse2; 461 int mmx, sse, sse2;
462# endif 462# endif
463 Cutout_Rects *rects; 463 static Cutout_Rects *rects = NULL;
464 Cutout_Rect *r; 464 Cutout_Rect *r;
465 int c, cx, cy, cw, ch; 465 int c, cx, cy, cw, ch;
466 int i; 466 int i;
@@ -503,7 +503,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
503 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 503 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
504 return; 504 return;
505 } 505 }
506 rects = evas_common_draw_context_apply_cutouts(dc); 506 rects = evas_common_draw_context_apply_cutouts(dc, rects);
507 for (i = 0; i < rects->active; ++i) 507 for (i = 0; i < rects->active; ++i)
508 { 508 {
509 r = rects->rects + i; 509 r = rects->rects + i;
@@ -525,8 +525,76 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
525 dst_region_w, dst_region_h); 525 dst_region_w, dst_region_h);
526# endif 526# endif
527 } 527 }
528 evas_common_draw_context_apply_clear_cutouts(rects);
529 /* restore clip info */ 528 /* restore clip info */
530 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 529 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
531} 530}
531
532EAPI void
533evas_common_scale_rgba_in_to_out_clip_smooth_do(const Cutout_Rects *reuse,
534 const Eina_Rectangle *clip,
535 RGBA_Image *src, RGBA_Image *dst,
536 RGBA_Draw_Context *dc,
537 int src_region_x, int src_region_y,
538 int src_region_w, int src_region_h,
539 int dst_region_x, int dst_region_y,
540 int dst_region_w, int dst_region_h)
541{
542# ifdef BUILD_MMX
543 int mmx, sse, sse2;
544# endif
545 Eina_Rectangle area;
546 Cutout_Rect *r;
547 int i;
548
549# ifdef BUILD_MMX
550 evas_common_cpu_can_do(&mmx, &sse, &sse2);
551# endif
552 if (!reuse)
553 {
554 evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h);
555# ifdef BUILD_MMX
556 if (mmx)
557 evas_common_scale_rgba_in_to_out_clip_smooth_mmx(src, dst, dc,
558 src_region_x, src_region_y,
559 src_region_w, src_region_h,
560 dst_region_x, dst_region_y,
561 dst_region_w, dst_region_h);
562 else
563# endif
564# ifdef BUILD_C
565 evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc,
566 src_region_x, src_region_y,
567 src_region_w, src_region_h,
568 dst_region_x, dst_region_y,
569 dst_region_w, dst_region_h);
570# endif
571 return ;
572 }
573
574 for (i = 0; i < reuse->active; ++i)
575 {
576 r = reuse->rects + i;
577
578 EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h);
579 if (!eina_rectangle_intersection(&area, clip)) continue ;
580 evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
581# ifdef BUILD_MMX
582 if (mmx)
583 evas_common_scale_rgba_in_to_out_clip_smooth_mmx(src, dst, dc,
584 src_region_x, src_region_y,
585 src_region_w, src_region_h,
586 dst_region_x, dst_region_y,
587 dst_region_w, dst_region_h);
588 else
589# endif
590# ifdef BUILD_C
591 evas_common_scale_rgba_in_to_out_clip_smooth_c(src, dst, dc,
592 src_region_x, src_region_y,
593 src_region_w, src_region_h,
594 dst_region_x, dst_region_y,
595 dst_region_w, dst_region_h);
596# endif
597 }
598}
599
532#endif 600#endif
diff --git a/legacy/evas/src/lib/engines/common/evas_text_utils.c b/legacy/evas/src/lib/engines/common/evas_text_utils.c
index c1c1a2335e..acdcc0042f 100644
--- a/legacy/evas/src/lib/engines/common/evas_text_utils.c
+++ b/legacy/evas/src/lib/engines/common/evas_text_utils.c
@@ -36,6 +36,8 @@ evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst,
36 const Evas_Text_Props *src) 36 const Evas_Text_Props *src)
37{ 37{
38 memcpy(dst, src, sizeof(Evas_Text_Props)); 38 memcpy(dst, src, sizeof(Evas_Text_Props));
39 dst->glyphs = NULL;
40 dst->glyphs_length = 0;
39 evas_common_text_props_content_ref(dst); 41 evas_common_text_props_content_ref(dst);
40} 42}
41 43
@@ -66,11 +68,9 @@ evas_common_text_props_content_unref(Evas_Text_Props *props)
66 68
67 if (--(props->info->refcount) == 0) 69 if (--(props->info->refcount) == 0)
68 { 70 {
69 if (props->bin) 71 free(props->glyphs);
70 { 72 props->glyphs = NULL;
71 eina_binbuf_free(props->bin); 73 props->glyphs_length = 0;
72 props->bin = NULL;
73 }
74 74
75 if (props->info->glyph) 75 if (props->info->glyph)
76 free(props->info->glyph); 76 free(props->info->glyph);
diff --git a/legacy/evas/src/lib/engines/common/evas_text_utils.h b/legacy/evas/src/lib/engines/common/evas_text_utils.h
index a10ce7d569..675df6c200 100644
--- a/legacy/evas/src/lib/engines/common/evas_text_utils.h
+++ b/legacy/evas/src/lib/engines/common/evas_text_utils.h
@@ -18,6 +18,8 @@ typedef enum
18/* Used for showing "malformed" or missing chars */ 18/* Used for showing "malformed" or missing chars */
19#define REPLACEMENT_CHAR 0xFFFD 19#define REPLACEMENT_CHAR 0xFFFD
20 20
21typedef struct _Evas_Glyph Evas_Glyph;
22
21struct _Evas_Text_Props 23struct _Evas_Text_Props
22{ 24{
23 /* Start and len represent the start offset and the length in the 25 /* Start and len represent the start offset and the length in the
@@ -31,7 +33,8 @@ struct _Evas_Text_Props
31 Evas_Text_Props_Info *info; 33 Evas_Text_Props_Info *info;
32 void *font_instance; 34 void *font_instance;
33 35
34 Eina_Binbuf *bin; 36 Evas_Glyph *glyphs;
37 int glyphs_length;
35 38
36 int generation; 39 int generation;
37 Eina_Bool changed : 1; 40 Eina_Bool changed : 1;
diff --git a/legacy/evas/src/lib/engines/common_16/evas_soft16_main.c b/legacy/evas/src/lib/engines/common_16/evas_soft16_main.c
index 6028744a92..5258b7d5ab 100644
--- a/legacy/evas/src/lib/engines/common_16/evas_soft16_main.c
+++ b/legacy/evas/src/lib/engines/common_16/evas_soft16_main.c
@@ -474,8 +474,8 @@ evas_common_soft16_image_draw(Soft16_Image *src, Soft16_Image *dst,
474 int dst_region_w, int dst_region_h, 474 int dst_region_w, int dst_region_h,
475 int smooth __UNUSED__) 475 int smooth __UNUSED__)
476{ 476{
477 static Cutout_Rects *rects = NULL;
477 Eina_Rectangle sr, dr; 478 Eina_Rectangle sr, dr;
478 Cutout_Rects *rects;
479 Cutout_Rect *r; 479 Cutout_Rect *r;
480 struct RGBA_Draw_Context_clip clip_bkp; 480 struct RGBA_Draw_Context_clip clip_bkp;
481 int i; 481 int i;
@@ -510,14 +510,13 @@ evas_common_soft16_image_draw(Soft16_Image *src, Soft16_Image *dst,
510 dc->clip = clip_bkp; 510 dc->clip = clip_bkp;
511 return; 511 return;
512 } 512 }
513 rects = evas_common_draw_context_apply_cutouts(dc); 513 rects = evas_common_draw_context_apply_cutouts(dc, rects);
514 for (i = 0; i < rects->active; i++) 514 for (i = 0; i < rects->active; i++)
515 { 515 {
516 r = rects->rects + i; 516 r = rects->rects + i;
517 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 517 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
518 _soft16_image_draw_sampled_int(src, dst, dc, sr, dr); 518 _soft16_image_draw_sampled_int(src, dst, dc, sr, dr);
519 } 519 }
520 evas_common_draw_context_apply_clear_cutouts(rects);
521 dc->clip = clip_bkp; 520 dc->clip = clip_bkp;
522} 521}
523 522
diff --git a/legacy/evas/src/lib/engines/common_16/evas_soft16_rectangle.c b/legacy/evas/src/lib/engines/common_16/evas_soft16_rectangle.c
index bd38fce9a7..ac6aa46eaa 100644
--- a/legacy/evas/src/lib/engines/common_16/evas_soft16_rectangle.c
+++ b/legacy/evas/src/lib/engines/common_16/evas_soft16_rectangle.c
@@ -78,8 +78,8 @@ void
78evas_common_soft16_rectangle_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, 78evas_common_soft16_rectangle_draw(Soft16_Image *dst, RGBA_Draw_Context *dc,
79 int x, int y, int w, int h) 79 int x, int y, int w, int h)
80{ 80{
81 static Cutout_Rects *rects = NULL;
81 Eina_Rectangle dr; 82 Eina_Rectangle dr;
82 Cutout_Rects *rects;
83 Cutout_Rect *r; 83 Cutout_Rect *r;
84 struct RGBA_Draw_Context_clip c_bkp; 84 struct RGBA_Draw_Context_clip c_bkp;
85 int i; 85 int i;
@@ -108,14 +108,13 @@ evas_common_soft16_rectangle_draw(Soft16_Image *dst, RGBA_Draw_Context *dc,
108 dc->clip = c_bkp; 108 dc->clip = c_bkp;
109 return; 109 return;
110 } 110 }
111 rects = evas_common_draw_context_apply_cutouts(dc); 111 rects = evas_common_draw_context_apply_cutouts(dc, rects);
112 for (i = 0; i < rects->active; ++i) 112 for (i = 0; i < rects->active; ++i)
113 { 113 {
114 r = rects->rects + i; 114 r = rects->rects + i;
115 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 115 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
116 _soft16_rectangle_draw_int(dst, dc, dr); 116 _soft16_rectangle_draw_int(dst, dc, dr);
117 } 117 }
118 evas_common_draw_context_apply_clear_cutouts(rects);
119 dc->clip = c_bkp; 118 dc->clip = c_bkp;
120} 119}
121 120
diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_main.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_main.c
index cc4ce25abb..02282b8d7c 100644
--- a/legacy/evas/src/lib/engines/common_8/evas_soft8_main.c
+++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_main.c
@@ -523,8 +523,8 @@ evas_common_soft8_image_draw(Soft8_Image * src, Soft8_Image * dst,
523 int dst_region_w, int dst_region_h, 523 int dst_region_w, int dst_region_h,
524 int smooth __UNUSED__) 524 int smooth __UNUSED__)
525{ 525{
526 static Cutout_Rects *rects = NULL;
526 Eina_Rectangle sr, dr; 527 Eina_Rectangle sr, dr;
527 Cutout_Rects *rects;
528 Cutout_Rect *r; 528 Cutout_Rect *r;
529 struct RGBA_Draw_Context_clip clip_bkp; 529 struct RGBA_Draw_Context_clip clip_bkp;
530 int i; 530 int i;
@@ -569,14 +569,13 @@ evas_common_soft8_image_draw(Soft8_Image * src, Soft8_Image * dst,
569 dc->clip = clip_bkp; 569 dc->clip = clip_bkp;
570 return; 570 return;
571 } 571 }
572 rects = evas_common_draw_context_apply_cutouts(dc); 572 rects = evas_common_draw_context_apply_cutouts(dc, rects);
573 for (i = 0; i < rects->active; i++) 573 for (i = 0; i < rects->active; i++)
574 { 574 {
575 r = rects->rects + i; 575 r = rects->rects + i;
576 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 576 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
577 _soft8_image_draw_sampled_int(src, dst, dc, sr, dr); 577 _soft8_image_draw_sampled_int(src, dst, dc, sr, dr);
578 } 578 }
579 evas_common_draw_context_apply_clear_cutouts(rects);
580 dc->clip = clip_bkp; 579 dc->clip = clip_bkp;
581} 580}
582 581
diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c
index 150f262e8e..98a053bb81 100644
--- a/legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c
+++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c
@@ -79,8 +79,8 @@ void
79evas_common_soft8_rectangle_draw(Soft8_Image * dst, RGBA_Draw_Context * dc, 79evas_common_soft8_rectangle_draw(Soft8_Image * dst, RGBA_Draw_Context * dc,
80 int x, int y, int w, int h) 80 int x, int y, int w, int h)
81{ 81{
82 static Cutout_Rects *rects = NULL;
82 Eina_Rectangle dr; 83 Eina_Rectangle dr;
83 Cutout_Rects *rects;
84 Cutout_Rect *r; 84 Cutout_Rect *r;
85 struct RGBA_Draw_Context_clip c_bkp; 85 struct RGBA_Draw_Context_clip c_bkp;
86 int i; 86 int i;
@@ -113,13 +113,12 @@ evas_common_soft8_rectangle_draw(Soft8_Image * dst, RGBA_Draw_Context * dc,
113 dc->clip = c_bkp; 113 dc->clip = c_bkp;
114 return; 114 return;
115 } 115 }
116 rects = evas_common_draw_context_apply_cutouts(dc); 116 rects = evas_common_draw_context_apply_cutouts(dc, rects);
117 for (i = 0; i < rects->active; ++i) 117 for (i = 0; i < rects->active; ++i)
118 { 118 {
119 r = rects->rects + i; 119 r = rects->rects + i;
120 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); 120 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
121 _soft8_rectangle_draw_int(dst, dc, dr); 121 _soft8_rectangle_draw_int(dst, dc, dr);
122 } 122 }
123 evas_common_draw_context_apply_clear_cutouts(rects);
124 dc->clip = c_bkp; 123 dc->clip = c_bkp;
125} 124}
diff --git a/legacy/evas/src/lib/include/evas_common.h b/legacy/evas/src/lib/include/evas_common.h
index c9a9511c6b..eba2039a08 100644
--- a/legacy/evas/src/lib/include/evas_common.h
+++ b/legacy/evas/src/lib/include/evas_common.h
@@ -728,8 +728,10 @@ struct _RGBA_Draw_Context
728struct _RGBA_Pipe_Op 728struct _RGBA_Pipe_Op
729{ 729{
730 RGBA_Draw_Context context; 730 RGBA_Draw_Context context;
731 Eina_Bool (*prepare_func) (void *data, RGBA_Image *dst, RGBA_Pipe_Op *op);
731 void (*op_func) (RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGBA_Pipe_Thread_Info *info); 732 void (*op_func) (RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGBA_Pipe_Thread_Info *info);
732 void (*free_func) (RGBA_Pipe_Op *op); 733 void (*free_func) (RGBA_Pipe_Op *op);
734 Cutout_Rects *rects;
733 735
734 union { 736 union {
735 struct { 737 struct {
@@ -739,11 +741,13 @@ struct _RGBA_Pipe_Op
739 int x0, y0, x1, y1; 741 int x0, y0, x1, y1;
740 } line; 742 } line;
741 struct { 743 struct {
744 int x, y;
742 RGBA_Polygon_Point *points; 745 RGBA_Polygon_Point *points;
743 } poly; 746 } poly;
744 struct { 747 struct {
745 int x, y; 748 int x, y;
746 Evas_Text_Props *intl_props; 749 Evas_Text_Props *intl_props;
750 RGBA_Gfx_Func func;
747 } text; 751 } text;
748 struct { 752 struct {
749 RGBA_Image *src; 753 RGBA_Image *src;
@@ -753,12 +757,14 @@ struct _RGBA_Pipe_Op
753 } image; 757 } image;
754 struct { 758 struct {
755 RGBA_Image *src; 759 RGBA_Image *src;
756 RGBA_Map_Point *p; 760 RGBA_Map *m;
757 int npoints; 761 int npoints;
758 int smooth; 762 int smooth;
759 int level; 763 int level;
760 } map; 764 } map;
761 } op; 765 } op;
766
767 Eina_Bool render : 1;
762}; 768};
763 769
764#define PIPE_LEN 256 770#define PIPE_LEN 256
@@ -773,8 +779,7 @@ struct _RGBA_Pipe
773struct _RGBA_Pipe_Thread_Info 779struct _RGBA_Pipe_Thread_Info
774{ 780{
775 EINA_INLIST; 781 EINA_INLIST;
776 RGBA_Image *im; 782 Eina_Rectangle area;
777 int x, y, w, h;
778}; 783};
779#endif 784#endif
780 785
diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h
index d21ab0a7ab..86dab875d5 100644
--- a/legacy/evas/src/lib/include/evas_private.h
+++ b/legacy/evas/src/lib/include/evas_private.h
@@ -834,9 +834,10 @@ struct _Evas_Func
834 int (*image_scale_hint_get) (void *data, void *image); 834 int (*image_scale_hint_get) (void *data, void *image);
835 int (*font_last_up_to_pos) (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int x, int y); 835 int (*font_last_up_to_pos) (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int x, int y);
836 836
837 void (*image_map_draw) (void *data, void *context, void *surface, void *image, int npoints, RGBA_Map_Point *p, int smooth, int level); 837 void (*image_map_draw) (void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level);
838 void *(*image_map_surface_new) (void *data, int w, int h, int alpha); 838 void *(*image_map_surface_new) (void *data, int w, int h, int alpha);
839 void (*image_map_surface_free) (void *data, void *surface); 839 void (*image_map_surface_free) (void *data, void *surface);
840 void (*image_map_clean) (void *data, RGBA_Map *m);
840 841
841 void (*image_content_hint_set) (void *data, void *surface, int hint); 842 void (*image_content_hint_set) (void *data, void *surface, int hint);
842 int (*image_content_hint_get) (void *data, void *surface); 843 int (*image_content_hint_get) (void *data, void *surface);