summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-11 16:11:21 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-11 23:26:36 +0900
commit6da5d54f8e41ad6f7d916dd5dde044bbc48ee325 (patch)
tree08d2804c1700829f03110896cf56267eb898e3b2 /src/lib/evas/canvas
parent8f62e4f7cef8ddc7caec5567e012c59cb44f68c3 (diff)
evas render2 - more work on fleshing it out a bit
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r--src/lib/evas/canvas/evas_object_rectangle.c9
-rw-r--r--src/lib/evas/canvas/render2/evas_render2.c2
-rw-r--r--src/lib/evas/canvas/render2/evas_render2_th_main.c62
-rw-r--r--src/lib/evas/canvas/render2/region.c27
-rw-r--r--src/lib/evas/canvas/render2/region.h3
5 files changed, 66 insertions, 37 deletions
diff --git a/src/lib/evas/canvas/evas_object_rectangle.c b/src/lib/evas/canvas/evas_object_rectangle.c
index bcbb627ec0..b154bb5a0c 100644
--- a/src/lib/evas/canvas/evas_object_rectangle.c
+++ b/src/lib/evas/canvas/evas_object_rectangle.c
@@ -139,9 +139,6 @@ evas_object_rectangle_render2_walk(Evas_Object *eo_obj,
139 // just became visible or invisible 139 // just became visible or invisible
140 if (visible_is != visible_was) 140 if (visible_is != visible_was)
141 { 141 {
142 printf(" UP1 %p - %4i %4i %4ix%4i\n", eo_obj,
143 obj->cur->cache.clip.x, obj->cur->cache.clip.y,
144 obj->cur->cache.clip.w, obj->cur->cache.clip.h);
145 region_rect_add 142 region_rect_add
146 (updates, 143 (updates,
147 obj->cur->cache.clip.x - offx, obj->cur->cache.clip.y - offy, 144 obj->cur->cache.clip.x - offx, obj->cur->cache.clip.y - offy,
@@ -162,9 +159,6 @@ evas_object_rectangle_render2_walk(Evas_Object *eo_obj,
162 (obj->restack) 159 (obj->restack)
163 ) 160 )
164 { 161 {
165 printf(" UP2 %p - %4i %4i %4ix%4i\n", eo_obj,
166 obj->prev->cache.clip.x, obj->prev->cache.clip.y,
167 obj->prev->cache.clip.w, obj->prev->cache.clip.h);
168 region_rect_add 162 region_rect_add
169 (updates, 163 (updates,
170 obj->prev->cache.clip.x - offx, obj->prev->cache.clip.y - offy, 164 obj->prev->cache.clip.x - offx, obj->prev->cache.clip.y - offy,
@@ -179,9 +173,6 @@ nochange:
179 // object hasn't really changed 173 // object hasn't really changed
180 if ((visible_is) && (evas_object_is_opaque(eo_obj, obj))) 174 if ((visible_is) && (evas_object_is_opaque(eo_obj, obj)))
181 { 175 {
182 printf(" NO- %p - %4i %4i %4ix%4i\n", eo_obj,
183 obj->cur->cache.clip.x, obj->cur->cache.clip.y,
184 obj->cur->cache.clip.w, obj->cur->cache.clip.h);
185 region_rect_del 176 region_rect_del
186 (updates, 177 (updates,
187 obj->cur->cache.clip.x - offx, obj->cur->cache.clip.y - offy, 178 obj->cur->cache.clip.x - offx, obj->cur->cache.clip.y - offy,
diff --git a/src/lib/evas/canvas/render2/evas_render2.c b/src/lib/evas/canvas/render2/evas_render2.c
index d3bac270ce..04549589bb 100644
--- a/src/lib/evas/canvas/render2/evas_render2.c
+++ b/src/lib/evas/canvas/render2/evas_render2.c
@@ -76,7 +76,7 @@ _evas_render2(Eo *eo_e, Evas_Public_Data *e)
76 // if render threads not initted - init them - maybe move this later? 76 // if render threads not initted - init them - maybe move this later?
77 _evas_render2_th_init(); 77 _evas_render2_th_init();
78 78
79 printf("------------------------------------------------ %p %p\n", eo_e, e); 79 printf("-------------------------------------------- %p %p\n", eo_e, e);
80 // wait for any previous render pass to do its thing 80 // wait for any previous render pass to do its thing
81 t = get_time(); 81 t = get_time();
82 evas_canvas_async_block(e); 82 evas_canvas_async_block(e);
diff --git a/src/lib/evas/canvas/render2/evas_render2_th_main.c b/src/lib/evas/canvas/render2/evas_render2_th_main.c
index e0bcc02d8b..8f164f0135 100644
--- a/src/lib/evas/canvas/render2/evas_render2_th_main.c
+++ b/src/lib/evas/canvas/render2/evas_render2_th_main.c
@@ -104,12 +104,12 @@ _evas_render2_th_main_obj_del_handle(Evas_Public_Data *e,
104} 104}
105 105
106static void 106static void
107_evas_render2_th_main_obj_basic_process(Evas_Public_Data *e, 107_evas_render2_th_main_obj_basic_walk_process(Evas_Public_Data *e,
108 Evas_Object_Protected_Data *obj, 108 Evas_Object_Protected_Data *obj,
109 void *updates, 109 void *updates,
110 int offx, 110 int offx,
111 int offy, 111 int offy,
112 int l EINA_UNUSED) 112 int l EINA_UNUSED)
113{ 113{
114 Evas_Object *eo_obj = obj->object; 114 Evas_Object *eo_obj = obj->object;
115 115
@@ -130,12 +130,12 @@ _evas_render2_th_main_obj_basic_process(Evas_Public_Data *e,
130} 130}
131 131
132static void 132static void
133_evas_render2_th_main_obj_process(Evas_Public_Data *e, 133_evas_render2_th_main_obj_walk_process(Evas_Public_Data *e,
134 Evas_Object_Protected_Data *obj, 134 Evas_Object_Protected_Data *obj,
135 void *updates, 135 void *updates,
136 int offx, 136 int offx,
137 int offy, 137 int offy,
138 int l EINA_UNUSED) 138 int l EINA_UNUSED)
139{ 139{
140 // process object OR walk through child objects if smart and process those 140 // process object OR walk through child objects if smart and process those
141 Evas_Object_Protected_Data *obj2; 141 Evas_Object_Protected_Data *obj2;
@@ -154,8 +154,8 @@ _evas_render2_th_main_obj_process(Evas_Public_Data *e,
154 obj->func->render2_walk(eo_obj, obj, obj->private_data, 154 obj->func->render2_walk(eo_obj, obj, obj->private_data,
155 updates, offx, offy); 155 updates, offx, offy);
156 EINA_INLIST_FOREACH(il, obj2) 156 EINA_INLIST_FOREACH(il, obj2)
157 _evas_render2_th_main_obj_process(e, obj2, updates, 157 _evas_render2_th_main_obj_walk_process(e, obj2, updates,
158 offx, offy, l + 1); 158 offx, offy, l + 1);
159 if (obj->changed) 159 if (obj->changed)
160 { 160 {
161 evas_object_clip_changes_clean(eo_obj); 161 evas_object_clip_changes_clean(eo_obj);
@@ -163,8 +163,8 @@ _evas_render2_th_main_obj_process(Evas_Public_Data *e,
163 evas_object_change_reset(eo_obj); 163 evas_object_change_reset(eo_obj);
164 } 164 }
165 } 165 }
166 else _evas_render2_th_main_obj_basic_process(e, obj, updates, 166 else _evas_render2_th_main_obj_basic_walk_process(e, obj, updates,
167 offx, offy, l); 167 offx, offy, l);
168} 168}
169 169
170static Region * 170static Region *
@@ -172,10 +172,11 @@ _evas_render2_regions_merge(Region *region)
172{ 172{
173 Region *region2; 173 Region *region2;
174 Box *rects; 174 Box *rects;
175 int num, i; 175 int num, i, w, h;
176 int tsize = 16; 176 int tsize = 16;
177 177
178 region2 = region_new(); 178 region_size_get(region, &w, &h);
179 region2 = region_new(w, h);
179 rects = region_rects(region); 180 rects = region_rects(region);
180 num = region_rects_num(region); 181 num = region_rects_num(region);
181 for (i = 0; i < num; i++) 182 for (i = 0; i < num; i++)
@@ -205,16 +206,16 @@ _evas_render2_th_main_do(Eo *eo_e, Evas_Public_Data *e)
205 int rects_num, i; 206 int rects_num, i;
206 static int num = 0; 207 static int num = 0;
207 208
208 updates = region_new(); 209 updates = region_new(e->output.w, e->output.h);
209 printf("........... updates # %i\n", num++); 210 printf("........... updates # %i\n", num++);
210 t = get_time(); 211 t = get_time();
211 EINA_INLIST_FOREACH(e->layers, lay) 212 EINA_INLIST_FOREACH(e->layers, lay)
212 { 213 {
213 EINA_INLIST_FOREACH(lay->objects, obj) 214 EINA_INLIST_FOREACH(lay->objects, obj)
214 { 215 {
215 _evas_render2_th_main_obj_process(e, obj, 216 _evas_render2_th_main_obj_walk_process(e, obj,
216 updates, 0, 0, 217 updates, 0, 0,
217 0); 218 0);
218 } 219 }
219 } 220 }
220 // add explicitly exposed/damaged regions of the canvas 221 // add explicitly exposed/damaged regions of the canvas
@@ -231,6 +232,7 @@ _evas_render2_th_main_do(Eo *eo_e, Evas_Public_Data *e)
231 t = get_time() - t; 232 t = get_time() - t;
232 printf("T: update generation: "); out_time(t); 233 printf("T: update generation: "); out_time(t);
233 234
235 t = get_time();
234 updates = _evas_render2_regions_merge(updates); 236 updates = _evas_render2_regions_merge(updates);
235 237
236 rects = region_rects(updates); 238 rects = region_rects(updates);
@@ -255,6 +257,22 @@ _evas_render2_th_main_do(Eo *eo_e, Evas_Public_Data *e)
255 printf("T: merge updates: "); out_time(t); 257 printf("T: merge updates: "); out_time(t);
256 258
257 // ... now render every update region 259 // ... now render every update region
260 EINA_LIST_FOREACH(updates_list, l, rect)
261 {
262 // XXX: create update buffer
263 EINA_INLIST_FOREACH(e->layers, lay)
264 {
265 EINA_INLIST_FOREACH(lay->objects, obj)
266 {
267// render to update buffer
268// _evas_render2_th_main_obj_render_process(e, obj,
269// updates, 0, 0,
270// 0);
271 }
272 }
273 // delete update buffer
274 }
275 // free up updates we don't need anymore
258 region_free(updates); 276 region_free(updates);
259 277
260 e->changed = EINA_FALSE; 278 e->changed = EINA_FALSE;
diff --git a/src/lib/evas/canvas/render2/region.c b/src/lib/evas/canvas/render2/region.c
index 30999d92f3..df7d711216 100644
--- a/src/lib/evas/canvas/render2/region.c
+++ b/src/lib/evas/canvas/render2/region.c
@@ -64,6 +64,7 @@ struct _Region_Data
64 64
65struct _Region 65struct _Region
66{ 66{
67 int w, h;
67 struct { 68 struct {
68 int x, y; 69 int x, y;
69 unsigned int w, h; 70 unsigned int w, h;
@@ -712,12 +713,14 @@ _region_del(Region *region, Box *r1, Box *r1end, Box *r2, Box *r2end,
712/////////////////////////////////////////////////////////////////////////// 713///////////////////////////////////////////////////////////////////////////
713 714
714Region * 715Region *
715region_new(void) 716region_new(int w, int h)
716{ 717{
717 Region *region = calloc(1, sizeof(Region)); 718 Region *region = calloc(1, sizeof(Region));
718 if (!region) return NULL; 719 if (!region) return NULL;
719 region->bound = _region_emptybox; 720 region->bound = _region_emptybox;
720 region->data = &_region_emptydata; 721 region->data = &_region_emptydata;
722 region->w = w;
723 region->h = h;
721 return region; 724 return region;
722} 725}
723 726
@@ -729,6 +732,13 @@ region_free(Region *region)
729 free(region); 732 free(region);
730} 733}
731 734
735void
736region_size_get(Region *region, int *w, int *h)
737{
738 *w = region->w;
739 *h = region->h;
740}
741
732int 742int
733region_rects_num(Region *region) 743region_rects_num(Region *region)
734{ 744{
@@ -747,6 +757,9 @@ region_copy(Region *dest, Region *src)
747 dest->last_del.w = 0; 757 dest->last_del.w = 0;
748 dest->last_add.w = 0; 758 dest->last_add.w = 0;
749 759
760 dest->w = src->w;
761 dest->h = src->h;
762
750 dest->bound = src->bound; 763 dest->bound = src->bound;
751 if ((!src->data) || (!src->data->size)) 764 if ((!src->data) || (!src->data->size))
752 { 765 {
@@ -875,6 +888,8 @@ region_rect_add(Region *dest, int x, int y, unsigned int w, unsigned int h)
875 Region region; 888 Region region;
876 Eina_Bool ret; 889 Eina_Bool ret;
877 890
891 RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, dest->w, dest->h);
892
878 if (!w || !h) return EINA_FALSE; 893 if (!w || !h) return EINA_FALSE;
879 894
880 if (dest->last_add.w > 0) 895 if (dest->last_add.w > 0)
@@ -1026,16 +1041,16 @@ region_validate(Region *region, Eina_Bool *overlap_ret)
1026 1041
1027 // Set up the first region to be the first rectangle in region 1042 // Set up the first region to be the first rectangle in region
1028 // Note that step 2 code will never overflow the ri[0].reg rects array 1043 // Note that step 2 code will never overflow the ri[0].reg rects array
1029 ri = malloc(4 * sizeof(Region_Info)); 1044 ri = calloc(1, 4 * sizeof(Region_Info));
1030 if (!ri) return _region_break(region); 1045 if (!ri) return _region_break(region);
1031 size_ri = 4; 1046 size_ri = 4;
1032 num_ri = 1; 1047 num_ri = 1;
1033 ri[0].prev_band = 0;
1034 ri[0].cur_band = 0;
1035 ri[0].reg = *region; 1048 ri[0].reg = *region;
1036 box = PIXREGION_BOXPTR(&ri[0].reg); 1049 box = PIXREGION_BOXPTR(&ri[0].reg);
1037 ri[0].reg.bound = *box; 1050 ri[0].reg.bound = *box;
1038 ri[0].reg.data->num = 1; 1051 ri[0].reg.data->num = 1;
1052 ri[0].reg.w = region->w;
1053 ri[0].reg.h = region->h;
1039 1054
1040 // Now scatter rectangles into the minimum set of valid regions. If the 1055 // Now scatter rectangles into the minimum set of valid regions. If the
1041 // next rectangle to be added to a region would force an existing rectangle 1056 // next rectangle to be added to a region would force an existing rectangle
@@ -1099,6 +1114,8 @@ region_validate(Region *region, Eina_Bool *overlap_ret)
1099 rit->cur_band = 0; 1114 rit->cur_band = 0;
1100 rit->reg.bound = *box; 1115 rit->reg.bound = *box;
1101 rit->reg.data = NULL; 1116 rit->reg.data = NULL;
1117 rit->reg.w = region->w;
1118 rit->reg.h = region->h;
1102 // MUST force allocation 1119 // MUST force allocation
1103 if (!_region_rect_alloc(&rit->reg, (i + num_ri) / num_ri)) goto bail; 1120 if (!_region_rect_alloc(&rit->reg, (i + num_ri) / num_ri)) goto bail;
1104 next_rect: ; 1121 next_rect: ;
@@ -1199,6 +1216,8 @@ region_rect_del(Region *dest, int x, int y, unsigned int w, unsigned int h)
1199 Region region; 1216 Region region;
1200 Eina_Bool ret; 1217 Eina_Bool ret;
1201 1218
1219 RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, dest->w, dest->h);
1220
1202 if (!w || !h) return EINA_FALSE; 1221 if (!w || !h) return EINA_FALSE;
1203 1222
1204 if (dest->last_del.w > 0) 1223 if (dest->last_del.w > 0)
diff --git a/src/lib/evas/canvas/render2/region.h b/src/lib/evas/canvas/render2/region.h
index adb10a2cd4..63bb4cf086 100644
--- a/src/lib/evas/canvas/render2/region.h
+++ b/src/lib/evas/canvas/render2/region.h
@@ -70,8 +70,9 @@ struct _Box
70 70
71/* creation/destruction */ 71/* creation/destruction */
72 72
73Region *region_new (void); 73Region *region_new (int w, int h);
74void region_free (Region *region); 74void region_free (Region *region);
75void region_size_get (Region *region, int *w, int *h);
75 76
76void region_move (Region *region, int x, int y); 77void region_move (Region *region, int x, int y);
77Eina_Bool region_copy (Region *dest, Region *source); 78Eina_Bool region_copy (Region *dest, Region *source);