Add new API to get status of premultiplied alpha. 25/19525/1 tizen submit/tizen/20140430.020032
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 14 Apr 2014 11:48:36 +0000 (20:48 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 14 Apr 2014 11:48:36 +0000 (20:48 +0900)
Change-Id: I48d473b2745de10e4a4d5188a0b773b435e3cc51

include/livebox.h
packaging/liblivebox.spec
src/livebox.c
src/virtual_window.c

index 0e556fc..4baf9f5 100644 (file)
@@ -748,6 +748,18 @@ extern int livebox_freeze_scroller(const char *pkgname, const char *id);
 extern int livebox_release_scroller(const char *pkgname, const char *id);
 
 /*!
+ * \brief Get the configuration status of premultiplied alpha.
+ * \details
+ *     If the system uses the premultiplied alpha for content,
+ *     This function will returns 1.
+ * \remarks This function only works with the inhouse provider.
+ * \return status of premultiplied alpha.
+ * \retval 1 Content rendered with premultiplied alpha.
+ * \retval 0 Content doesn't rendered with premultiplied alpha.
+ */
+extern int livebox_conf_premultiplied_alpha(void);
+
+/*!
  * \}
  */
 
index 69ba9ed..90592d4 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: liblivebox
 Summary: Livebox development library
-Version: 0.7.2
+Version: 0.7.3
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index 6c5e32d..312a67f 100644 (file)
 
 #define FILE_SCHEMA    "file://"
 
+/* Must has to sync'd with data-provider-slave */
+struct conf {
+       int width;
+       int height;
+
+       int base_width;
+       int base_height;
+       double minimum_period;
+
+       struct {
+               char *script;
+               char *abi;
+               char *pd_group;
+               double period;
+       } default_conf;
+
+       struct {
+               char *name;
+               char *secured;
+               char *abi;
+       } launch_key;
+
+       double default_packet_time;
+
+       char *empty_content;
+       char *empty_title;
+
+       char *default_content;
+       char *default_title;
+
+       unsigned long minimum_space;
+
+       char *replace_tag;
+
+       double slave_ttl;
+       double slave_activate_time;
+       double slave_relaunch_time;
+       int slave_relaunch_count;
+
+       int max_log_line;
+       int max_log_file;
+
+       unsigned long sqlite_flush_max;
+
+       struct {
+               char *conf;
+               char *image;
+               char *script;
+               char *root;
+               char *script_port;
+               char *slave_log;
+               char *reader;
+               char *always;
+               char *db;
+               char *module;
+               char *input;
+       } path;
+
+       int max_size_type;
+
+       int slave_max_load;
+
+       double ping_time;
+
+       int use_sw_backend;
+       char *provider_method;
+       int debug_mode;
+       int overwrite_content;
+       int com_core_thread;
+       int use_xmonitor;
+       int premultiplied;
+};
+
 /*!
  * \brief This function is defined by the data-provider-slave
  */
@@ -46,11 +119,13 @@ static struct info {
        int (*request_update_by_id)(const char *uri);
        int (*trigger_update_monitor)(const char *id, int is_pd);
        int (*update_extra_info)(const char *id, const char *content, const char *title, const char *icon, const char *name);
+       struct conf *conf;
 } s_info = {
        .find_pkgname = NULL,
        .request_update_by_id = NULL,
        .trigger_update_monitor = NULL,
        .update_extra_info = NULL,
+       .conf = NULL,
 };
 
 struct block {
@@ -810,6 +885,21 @@ PUBLIC int livebox_request_update(const char *filename)
        return ret;
 }
 
+PUBLIC int livebox_conf_premultiplied_alpha(void)
+{
+       if (!s_info.conf) {
+               s_info.conf = dlsym(RTLD_DEFAULT, "g_conf");
+               if (!s_info.conf) {
+                       ErrPrint("g_conf is not found\n");
+                       return 1;
+               }
+
+               DbgPrint("Premultiplied alpha: %d\n", s_info.conf->premultiplied);
+       }
+
+       return s_info.conf->premultiplied;
+}
+
 PUBLIC unsigned long livebox_pixmap_id(struct livebox_buffer *handle)
 {
        return provider_buffer_pixmap_id(handle);
index f7858ec..d554c10 100644 (file)
@@ -418,6 +418,14 @@ static void pre_render_cb(void *data, Evas *e, void *event_info)
                return;
        }
 
+       if (livebox_conf_premultiplied_alpha()) {
+               Evas_Coord w;
+               Evas_Coord h;
+
+               ecore_evas_geometry_get(info->ee, NULL, NULL, &w, &h);
+               evas_damage_rectangle_add(e, 0, 0, w, h);
+       }
+
        if (info->is_hw) {
                livebox_buffer_pre_render(info->handle);
        }
@@ -431,6 +439,21 @@ static void post_render_cb(void *data, Evas *e, void *event_info)
                return;
        }
 
+       if (livebox_conf_premultiplied_alpha()) {
+               void *canvas;
+               int x, y, w, h;
+
+               // Get a pointer of a buffer of the virtual canvas
+               canvas = (void *)ecore_evas_buffer_pixels_get(info->ee);
+               if (!canvas) {
+                       ErrPrint("Failed to get pixel canvas\n");
+                       return;
+               }
+
+               ecore_evas_geometry_get(info->ee, &x, &y, &w, &h);
+               evas_data_argb_unpremul(canvas, w * h);
+       }
+
        if (info->is_hw) {
                livebox_buffer_post_render(info->handle);
        } else {