Add premultipled color control conf.
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 23 Dec 2013 15:30:00 +0000 (00:30 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 23 Dec 2013 15:30:00 +0000 (00:30 +0900)
Change-Id: If49a426b00593382a7b0c06ad78020831a8055f4

data/private.conf.ini
include/conf.h
packaging/data-provider-master.spec
src/conf.c
src/fb.c

index 7f08d10..8777521 100644 (file)
@@ -32,3 +32,4 @@ com_core_thread=true
 use_xmonitor=false
 input=/dev/input/event2
 pd_request_timeout=5.0
+premultiplied=1
index 7b276ef..7c42f09 100755 (executable)
@@ -85,6 +85,7 @@ struct conf {
        int overwrite_content;
        int com_core_thread;
        int use_xmonitor;
+       int premultiplied;
 
        double scale_width_factor;
        double scale_height_factor;
@@ -161,6 +162,8 @@ extern void conf_init(void);
 
 #define SLAVE_MAX_LOAD         g_conf.slave_max_load
 #define DEFAULT_PING_TIME      g_conf.ping_time
+#define PREMULTIPLIED_COLOR    g_conf.premultiplied
+
 #define PAUSED_FILE            "/tmp/.live.paused"
 
 #define MAX_ABI                256
index cb1c51a..2bbb60d 100755 (executable)
@@ -1,6 +1,6 @@
 Name: data-provider-master
 Summary: Master service provider for liveboxes
-Version: 0.31.0
+Version: 0.31.1
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index 82bffb4..15db696 100644 (file)
@@ -69,6 +69,7 @@ static const int CONF_DEFAULT_DEBUG_MODE = 0;
 static const int CONF_DEFAULT_OVERWRITE_CONTENT = 0;
 static const int CONF_DEFAULT_COM_CORE_THREAD = 1;
 static const int CONF_DEFAULT_USE_XMONITOR = 0;
+static const int CONF_DEFAULT_PREMULTIPLIED = 1;
 static const double CONF_DEFAULT_SCALE_WIDTH_FACTOR = 1.0f;
 static const double CONF_DEFAULT_SCALE_HEIGHT_FACTOR = 1.0f;
 static const double CONF_DEFAULT_PD_REQUEST_TIMEOUT = 5.0f;
@@ -340,6 +341,15 @@ static void slave_max_loader(char *buffer)
        }
 }
 
+static void premultiplied_handler(char *buffer)
+{
+       if (sscanf(buffer, "%d", &g_conf.premultiplied) != 1) {
+               ErrPrint("Failed to parse the premultiplied color\n");
+       }
+
+       DbgPrint("Premultiplied: %d\n", g_conf.premultiplied);
+}
+
 static void pd_request_timeout_handler(char *buffer)
 {
        if (sscanf(buffer, "%lf", &g_conf.pd_request_timeout) != 1) {
@@ -375,6 +385,7 @@ HAPI void conf_init(void)
        g_conf.scale_width_factor = CONF_DEFAULT_SCALE_WIDTH_FACTOR;
        g_conf.scale_height_factor = CONF_DEFAULT_SCALE_HEIGHT_FACTOR;
        g_conf.pd_request_timeout = CONF_DEFAULT_PD_REQUEST_TIMEOUT;
+       g_conf.premultiplied = CONF_DEFAULT_PREMULTIPLIED;
        g_conf.default_conf.script = (char *)CONF_DEFAULT_SCRIPT_TYPE;
        g_conf.default_conf.abi = (char *)CONF_DEFAULT_ABI;
        g_conf.default_conf.pd_group = (char *)CONF_DEFAULT_PD_GROUP;
@@ -568,6 +579,10 @@ HAPI int conf_loader(void)
                        .handler = pd_request_timeout_handler,
                },
                {
+                       .name = "premultiplied",
+                       .handler = premultiplied_handler,
+               },
+               {
                        .name = NULL,
                        .handler = NULL,
                },
@@ -773,6 +788,7 @@ HAPI void conf_reset(void)
        g_conf.scale_width_factor = CONF_DEFAULT_SCALE_WIDTH_FACTOR;
        g_conf.scale_height_factor = CONF_DEFAULT_SCALE_HEIGHT_FACTOR;
        g_conf.pd_request_timeout = CONF_DEFAULT_PD_REQUEST_TIMEOUT;
+       g_conf.premultiplied = CONF_DEFAULT_PREMULTIPLIED;
 
        if (g_conf.default_conf.script != CONF_DEFAULT_SCRIPT_TYPE) {
                DbgFree(g_conf.default_conf.script);
index ef46718..ffd8b5c 100644 (file)
--- a/src/fb.c
+++ b/src/fb.c
@@ -99,36 +99,44 @@ HAPI struct fb_info *fb_create(struct inst_info *inst, int w, int h, enum buffer
 static void sw_render_pre_cb(void *data, Evas *e, void *event_info)
 {
        struct fb_info *info = data;
-       int w;
-       int h;
 
-       buffer_handler_get_size(info->buffer, &w, &h);
-       evas_damage_rectangle_add(e, 0, 0, w, h);
        buffer_handler_lock(info->buffer);
+
+       if (PREMULTIPLIED_COLOR) {
+               int w;
+               int h;
+
+               buffer_handler_get_size(info->buffer, &w, &h);
+               evas_damage_rectangle_add(e, 0, 0, w, h);
+       }
 }
 
 static void sw_render_post_cb(void *data, Evas *e, void *event_info)
 {
-        void *canvas;
-        Ecore_Evas *internal_ee;
-       int x, y, w, h;
        struct fb_info *info = data;
 
-        internal_ee = ecore_evas_ecore_evas_get(e);
-        if (!internal_ee) {
-               ErrPrint("Failed to get ecore evas\n");
-                return;
-        }
-
-        // Get a pointer of a buffer of the virtual canvas
-        canvas = (void*)ecore_evas_buffer_pixels_get(internal_ee);
-        if (!canvas) {
-               ErrPrint("Failed to get pixel canvas\n");
-                return;
-        }
-
-       ecore_evas_geometry_get(internal_ee, &x, &y, &w, &h);
-       evas_data_argb_unpremul(canvas, w * h);
+       if (PREMULTIPLIED_COLOR) {
+               void *canvas;
+               Ecore_Evas *internal_ee;
+               int x, y, w, h;
+
+               internal_ee = ecore_evas_ecore_evas_get(e);
+               if (!internal_ee) {
+                       ErrPrint("Failed to get ecore evas\n");
+                       return;
+               }
+
+               // Get a pointer of a buffer of the virtual canvas
+               canvas = (void*)ecore_evas_buffer_pixels_get(internal_ee);
+               if (!canvas) {
+                       ErrPrint("Failed to get pixel canvas\n");
+                       return;
+               }
+
+               ecore_evas_geometry_get(internal_ee, &x, &y, &w, &h);
+               evas_data_argb_unpremul(canvas, w * h);
+       }
+
        buffer_handler_unlock(info->buffer);
 }