and fix more filter messups. o->fitler will be leaked on obj deletion
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 20 Apr 2011 08:06:59 +0000 (08:06 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 20 Apr 2011 08:06:59 +0000 (08:06 +0000)
as there was no cleanup.. and the method of exposing
evas_filter_key_get() was so out of step with any other code i have
ever seen.. letalong evas... fix.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@58747 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_filter.c
src/lib/canvas/evas_object_image.c
src/lib/canvas/evas_object_main.c
src/lib/include/evas_private.h

index 37a7ac7..3db2063 100644 (file)
@@ -143,7 +143,7 @@ evas_object_filter_mode_set(Evas_Object *o, Evas_Filter_Mode mode)
    return EINA_FALSE;
    MAGIC_CHECK_END();
    
-   if (mode != EVAS_FILTER_MODE_OBJECT && mode != EVAS_FILTER_MODE_BELOW)
+   if ((mode != EVAS_FILTER_MODE_OBJECT) && (mode != EVAS_FILTER_MODE_BELOW))
       return EINA_FALSE;
    
    if (!o->filter)
@@ -205,8 +205,12 @@ evas_object_filter_set(Evas_Object *o, Evas_Filter filter)
      }
    info->datalen = finfo->datasize;
    if (finfo->datasize)
-      // FIXME: hande calloc fail
-      info->data = calloc(1,finfo->datasize);
+     {
+        info->data = calloc(1, finfo->datasize);
+        if (!info->data)
+          {
+          }
+     }
    else
       info->data = NULL;
    info->data_free = NULL;
@@ -332,10 +336,13 @@ evas_object_filter_param_set_float(Evas_Object *o, const char *param,
              rv = EINA_TRUE;
           }
      }
-
    return rv;
 }
 
+
+
+
+
 /*
  * Internal call
  */
@@ -344,7 +351,7 @@ evas_filter_get_size(Evas_Filter_Info *info, int inw, int inh,
                      int *outw, int *outh, Eina_Bool inv)
 {
    if (!info) return -1;
-   if (!outw && !outh) return 0;
+   if ((!outw) && (!outh)) return 0;
    
    if (filterinfo[info->filter].sizefn)
       return filterinfo[info->filter].sizefn(info, inw, inh, outw, outh, inv);
@@ -397,6 +404,43 @@ evas_filter_key_get(const Evas_Filter_Info *info, uint32_t *lenp)
    return key;
 }
 
+Evas_Software_Filter_Fn
+evas_filter_software_get(Evas_Filter_Info *info)
+{
+   return filterinfo[info->filter].filter;
+}
+
+void
+evas_filter_free(Evas_Object *o)
+{
+   if (!o->filter) return;
+   free(o->filter);
+   o->filter = NULL;
+}
+
+
+
+
+/*
+ * Private calls
+ */
+static Evas_Filter_Info *
+filter_alloc(Evas_Object *o)
+{
+   Evas_Filter_Info *info;
+   
+   if (!o) return NULL;
+   info = calloc(1,sizeof(struct Evas_Filter_Info));
+   if (!info) return NULL;
+   info->dirty = 1;
+   info->filter = EVAS_FILTER_NONE;
+   info->mode = EVAS_FILTER_MODE_OBJECT;
+   info->datalen = 0;
+
+   o->filter = info;
+
+   return info;
+}
 
 static int
 blur_size_get(Evas_Filter_Info *info, int inw, int inh, int *outw, int *outh, 
@@ -417,7 +461,7 @@ blur_size_get(Evas_Filter_Info *info, int inw, int inh, int *outw, int *outh,
    return 0;
 }
 
-/**
+/*
  * Generate a key for the Gaussian generator.
  *
  * The size is:
@@ -449,32 +493,23 @@ gaussian_key_get(const Evas_Filter_Info *info, uint32_t *lenp)
    return key;
 }
 
-Evas_Software_Filter_Fn
-evas_filter_software_get(Evas_Filter_Info *info)
-{
-   return filterinfo[info->filter].filter;
-}
 
-/*
- * Private calls
- */
-static Evas_Filter_Info *
-filter_alloc(Evas_Object *o)
-{
-   Evas_Filter_Info *info;
-   if (!o) return NULL;
 
-   // FIXME: handle alloc failure
-   info = calloc(1,sizeof(struct Evas_Filter_Info));
-   info->dirty = 1;
-   info->filter = EVAS_FILTER_NONE;
-   info->mode = EVAS_FILTER_MODE_OBJECT;
-   info->datalen = 0;
 
-   o->filter = info;
 
-   return info;
-}
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 /**
  * Software implementations
index 8503ae5..85444f5 100644 (file)
@@ -2450,7 +2450,6 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
                {
                   uint32_t len;
                   uint8_t *key;
-                  uint8_t *evas_filter_key_get(void *, void *);
 
                   if (obj->filter->key) free(obj->filter->key);
                   key = evas_filter_key_get(obj->filter, &len);
index f7b7ee8..c7e555e 100644 (file)
@@ -34,6 +34,7 @@ evas_object_free(Evas_Object *obj, int clean_layer)
 {
    int was_smart_child = 0;
 
+   evas_filter_free(obj);
    evas_object_map_set(obj, NULL);
    evas_object_grabs_cleanup(obj);
    evas_object_intercept_cleanup(obj);
index 04c0bcc..9d9b2d2 100644 (file)
@@ -400,10 +400,13 @@ typedef struct Evas_Filter_Info
 
 typedef Eina_Bool (*Evas_Software_Filter_Fn)(Evas_Filter_Info *, RGBA_Image *, RGBA_Image *);
 
-EAPI Evas_Software_Filter_Fn evas_filter_software_get(Evas_Filter_Info *info);
 int evas_filter_get_size(Evas_Filter_Info *info, int inw, int inh,
                      int *outw, int *outh, Eina_Bool inv);
 Eina_Bool evas_filter_always_alpha(Evas_Filter_Info *info);
+uint8_t *evas_filter_key_get(const Evas_Filter_Info *info, uint32_t *lenp);
+// expose for use in engines
+EAPI Evas_Software_Filter_Fn evas_filter_software_get(Evas_Filter_Info *info);
+void evas_filter_free(Evas_Object *o);
 
 struct _Evas_Object
 {
@@ -876,6 +879,7 @@ Eina_Bool evas_preload_thread_cancel(Evas_Preload_Pthread *thread);
 void _evas_walk(Evas *e);
 void _evas_unwalk(Evas *e);
 
+// expose for use in engines
 EAPI int _evas_module_engine_inherit(Evas_Func *funcs, char *name);
 
 void evas_render_invalidate(Evas *e);
@@ -883,7 +887,7 @@ void evas_render_object_recalc(Evas_Object *obj);
 
 Eina_Bool evas_map_inside_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y);
 Eina_Bool evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, Evas_Coord *mx, Evas_Coord *my, int grab);
-
+   
 /****************************************************************************/
 /*****************************************/
 /********************/