summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-01-21 17:30:18 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-21 17:51:15 +0900
commit15f7cefa68ff89bde8418092389faa670db8caeb (patch)
treea5ae21ecb73c664085e1b0d68d55a0df58960209 /src/lib/evas/canvas
parent0793dee86ae9f80f63f70b170c3f5ec15946824f (diff)
Evas masking: Fix major memory leak
The memory usage graph was going up and to the right! I was told this is always a good thing! ... maybe not this time :) Hopefully I didn't forget a case. An intense session of genlist scrolling with masks all over the place and masks of masks didn't show any glitch, crash or memory leak.
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r--src/lib/evas/canvas/evas_object_main.c15
-rw-r--r--src/lib/evas/canvas/evas_render.c9
2 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index 65ed1893bb..bf8aac2bf4 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -179,6 +179,21 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer)
179 map_write->surface = NULL; 179 map_write->surface = NULL;
180 EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write); 180 EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
181 } 181 }
182 if (obj->mask->is_mask)
183 {
184 EINA_COW_WRITE_BEGIN(evas_object_mask_cow, obj->mask, Evas_Object_Mask_Data, mask)
185 mask->is_mask = EINA_FALSE;
186 mask->redraw = EINA_FALSE;
187 mask->is_alpha = EINA_FALSE;
188 mask->x = mask->y = mask->w = mask->h = 0;
189 if (mask->surface)
190 {
191 obj->layer->evas->engine.func->image_map_surface_free
192 (obj->layer->evas->engine.data.output, mask->surface);
193 mask->surface = NULL;
194 }
195 EINA_COW_WRITE_END(evas_object_mask_cow, obj->mask, mask);
196 }
182 evas_object_grabs_cleanup(eo_obj, obj); 197 evas_object_grabs_cleanup(eo_obj, obj);
183 evas_object_intercept_cleanup(eo_obj); 198 evas_object_intercept_cleanup(eo_obj);
184 if (obj->smart.parent) was_smart_child = 1; 199 if (obj->smart.parent) was_smart_child = 1;
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 18560bf583..d67a4e540f 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -1519,6 +1519,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1519 } 1519 }
1520 else 1520 else
1521 { 1521 {
1522 Eina_Bool unset_image_clip = EINA_FALSE;
1522 RDI(level); 1523 RDI(level);
1523 1524
1524 if (obj->cur->clipper) 1525 if (obj->cur->clipper)
@@ -1540,6 +1541,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1540 1541
1541 if (mask->mask->surface) 1542 if (mask->mask->surface)
1542 { 1543 {
1544 unset_image_clip = EINA_TRUE;
1543 e->engine.func->context_clip_image_set 1545 e->engine.func->context_clip_image_set
1544 (e->engine.data.output, ctx, 1546 (e->engine.data.output, ctx,
1545 mask->mask->surface, 1547 mask->mask->surface,
@@ -1551,6 +1553,11 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1551 obj->func->render(eo_obj, obj, obj->private_data, 1553 obj->func->render(eo_obj, obj, obj->private_data,
1552 e->engine.data.output, ctx, 1554 e->engine.data.output, ctx,
1553 surface, off_x, off_y, EINA_FALSE); 1555 surface, off_x, off_y, EINA_FALSE);
1556 if (unset_image_clip)
1557 {
1558 e->engine.func->context_clip_image_unset
1559 (e->engine.data.output, ctx);
1560 }
1554 } 1561 }
1555 if (!use_mapped_ctx) 1562 if (!use_mapped_ctx)
1556 e->engine.func->context_free(e->engine.data.output, ctx); 1563 e->engine.func->context_free(e->engine.data.output, ctx);
@@ -1808,6 +1815,8 @@ evas_render_mask_subrender(Evas_Public_Data *evas,
1808 mdata->is_alpha = EINA_TRUE; 1815 mdata->is_alpha = EINA_TRUE;
1809 } 1816 }
1810 1817
1818 mdata->surface = ENFN->image_dirty_region(ENDT, mdata->surface, 0, 0, w, h);
1819
1811 /* END OF HACK */ 1820 /* END OF HACK */
1812 1821
1813end: 1822end: