Evas filters: Create specific log domain
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 3 Jun 2015 10:59:11 +0000 (19:59 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 25 Jun 2015 05:36:08 +0000 (14:36 +0900)
This will improve the debug output of evas and specifically
allow setting "evas_filter" log level to a higher or lower
value depending on what you are debugging :)

src/lib/evas/canvas/evas_main.c
src/lib/evas/filters/evas_filter.c
src/lib/evas/filters/evas_filter_blur.c
src/lib/evas/filters/evas_filter_bump.c
src/lib/evas/filters/evas_filter_parser.c
src/lib/evas/filters/evas_filter_private.h
src/lib/evas/include/evas_private.h

index 1935d40..cdbbde8 100644 (file)
@@ -62,6 +62,7 @@ evas_init(void)
    }
 #endif
    _evas_preload_thread_init();
+   evas_filter_init();
 
    evas_thread_init();
 
@@ -119,6 +120,12 @@ evas_shutdown(void)
    evas_object_image_load_opts_cow = NULL;
    evas_object_image_state_cow = NULL;
 
+   evas_filter_shutdown();
+   eina_cow_del(evas_object_filter_cow);
+   eina_cow_del(evas_object_mask_cow);
+   evas_object_filter_cow = NULL;
+   evas_object_mask_cow = NULL;
+
    evas_thread_shutdown();
    _evas_preload_thread_shutdown();
    evas_async_events_shutdown();
index dd9fdc5..1e369f0 100644 (file)
  */
 
 #include "evas_filter.h"
-#include "evas_private.h"
-#include "evas_filter_private.h"
 
 #ifdef EVAS_CSERVE2
 # include "evas_cs2_private.h"
 #endif
 
+#include "evas_filter_private.h"
+
 #define _assert(a) if (!(a)) CRI("Failed on %s", #a);
 
 static void _buffer_free(Evas_Filter_Buffer *fb);
@@ -1984,3 +1984,24 @@ evas_filter_run(Evas_Filter_Context *ctx)
      ctx->post_run.cb(ctx, ctx->post_run.data, ret);
    return ret;
 }
+
+
+/* Logging */
+
+static int init_cnt = 0;
+int _evas_filter_log_dom = 0;
+
+void
+evas_filter_init()
+{
+   if ((init_cnt++) > 0) return;
+   _evas_filter_log_dom = eina_log_domain_register("evas_filter", EVAS_FILTER_LOG_COLOR);
+}
+
+void
+evas_filter_shutdown()
+{
+   if ((--init_cnt) > 0) return;
+   eina_log_domain_unregister(_evas_filter_log_dom);
+   _evas_filter_log_dom = 0;
+}
index 7af357f..06fb31e 100644 (file)
@@ -1,9 +1,9 @@
-#include "evas_filter.h"
-#include "evas_filter_private.h"
-
 #include <math.h>
 #include <time.h>
 
+#include "evas_filter.h"
+#include "evas_filter_private.h"
+
 static int
 _box_blur_auto_radius(int *radii, int r)
 {
index 2d42e6e..60a9798 100644 (file)
@@ -1,10 +1,9 @@
 /* Simple bump map algorithms for the software engine */
 
-#include "evas_filter_private.h"
-#include "evas_blend_private.h"
-
 #include <math.h>
 
+#include "evas_filter_private.h"
+#include "evas_blend_private.h"
 
 #ifdef CLAMP
 # undef CLAMP
index 294cd1e..c5f409d 100644 (file)
@@ -1,10 +1,11 @@
-#include "evas_filter_private.h"
 #include <stdarg.h>
 
 #include <lua.h>
 #include <lualib.h>
 #include <lauxlib.h>
 
+#include "evas_filter_private.h"
+
 #if LUA_VERSION_NUM == 502
 # define LUA52 1
 #endif
index 9e49aa2..002b2da 100644 (file)
@@ -4,6 +4,31 @@
 #include "evas_filter.h"
 #include "evas_private.h"
 
+/* logging variables */
+extern int _evas_filter_log_dom;
+#define EVAS_FILTER_LOG_COLOR EINA_COLOR_LIGHTBLUE
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_evas_filter_log_dom, __VA_ARGS__)
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_evas_filter_log_dom, __VA_ARGS__)
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_evas_filter_log_dom, __VA_ARGS__)
+#ifdef CRI
+# undef CRI
+#endif
+#define CRI(...) EINA_LOG_DOM_CRIT(_evas_filter_log_dom, __VA_ARGS__)
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_evas_filter_log_dom, __VA_ARGS__)
+
 // This is a potential optimization.
 #define DIV_USING_BITSHIFT 1
 
index 474e3ca..163ed0e 100644 (file)
@@ -1771,6 +1771,10 @@ void _evas_canvas3d_eet_file_init(void);
 void _evas_canvas3d_eet_descriptor_shutdown(void);
 void _evas_canvas3d_eet_file_free(void);
 
+/* Filters */
+void evas_filter_init(void);
+void evas_filter_shutdown(void);
+
 /* Temporary save/load functions */
 void evas_common_load_model_from_file(Evas_Canvas3D_Mesh *model, const char *file);
 void evas_common_load_model_from_eina_file(Evas_Canvas3D_Mesh *model, const Eina_File *file);