Evas masking: Free mask surfaces during evas dump
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 27 Apr 2015 06:56:54 +0000 (15:56 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Mon, 27 Apr 2015 07:40:34 +0000 (16:40 +0900)
On minimizing, free all mask surfaces. This could save a lot
of memory.

Also, write "proxy" COW only when there is a surface (the "proxy"
pointer itself is always valid and non-NULL).

src/lib/evas/canvas/evas_render.c

index 58bbd67929beacadbc740c0621b19371c2f7b673..d172cd322d1501bd9d7494cc6c1604d2ef744596 100644 (file)
@@ -2913,19 +2913,24 @@ _evas_canvas_render_dump(Eo *eo_e, Evas_Public_Data *e)
 
              EINA_INLIST_FOREACH(lay->objects, obj)
                {
-                  if (obj->proxy)
+                  if (obj->proxy->surface)
                     {
                        EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, obj->proxy, Evas_Object_Proxy_Data, proxy_write)
                          {
-                            if (proxy_write->surface)
-                              {
-                                 e->engine.func->image_map_surface_free(e->engine.data.output,
-                                                                        proxy_write->surface);
-                                 proxy_write->surface = NULL;
-                              }
+                            e->engine.func->image_map_surface_free(e->engine.data.output, proxy_write->surface);
+                            proxy_write->surface = NULL;
                          }
                        EINA_COW_WRITE_END(evas_object_proxy_cow, obj->proxy, proxy_write);
                     }
+                  if (obj->mask->surface)
+                    {
+                       EINA_COW_WRITE_BEGIN(evas_object_mask_cow, obj->mask, Evas_Object_Mask_Data, mdata)
+                         {
+                            e->engine.func->image_map_surface_free(e->engine.data.output, mdata->surface);
+                            mdata->surface = NULL;
+                         }
+                       EINA_COW_WRITE_END(evas_object_mask_cow, obj->mask, mdata);
+                    }
                   if ((obj->type) && (!strcmp(obj->type, "image")))
                     evas_object_inform_call_image_unloaded(obj->object);
                   _evas_render_dump_map_surfaces(obj->object);