Manage the damaged region.
authorSung-jae Park <nicesj.park@samsung.com>
Sun, 28 Sep 2014 12:29:45 +0000 (21:29 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Sun, 28 Sep 2014 12:29:45 +0000 (21:29 +0900)
Currently, flush entire area.
There is no code for manipulating the damaged region from post-render callback.
We have to build the damaged region manipulator.

[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I6a3a3e751c4c6aab5b7ecf1e437d730835243213

src/dynamicbox.c

index f0e6bd9..ff0ae66 100644 (file)
@@ -172,13 +172,13 @@ static struct info {
        int is_slave;
        union _updated {
                struct _slave {
-                       int (*dbox)(const char *pkgname, const char *id, int w, int h);
-                       int (*gbar)(const char *pkgname, const char *id, const char *descfile);
+                       int (*dbox)(const char *pkgname, const char *id, int x, int y, int w, int h);
+                       int (*gbar)(const char *pkgname, const char *id, const char *descfile, int x, int y, int w, int h);
                } slave;
 
                struct _app {
-                       int (*dbox)(const char *id, int w, int h);
-                       int (*gbar)(const char *id);
+                       int (*dbox)(const char *id, int x, int y, int w, int h);
+                       int (*gbar)(const char *id, int x, int y, int w, int h);
                } app;
        } updated;
 
@@ -192,7 +192,7 @@ static struct info {
        .conf = NULL,
 };
 
-static int send_dbox_updated(const char *pkgname, const char *id, int w, int h)
+static int send_dbox_updated(const char *pkgname, const char *id, int x, int y, int w, int h)
 {
        int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
 
@@ -214,17 +214,23 @@ static int send_dbox_updated(const char *pkgname, const char *id, int w, int h)
        }
 
        if (s_info.is_slave == 0) {
-               ret = s_info.updated.app.dbox(id, w, h);
+               ret = s_info.updated.app.dbox(id, x, y, w, h);
        } else if (s_info.is_slave == 1) {
-               ret = s_info.updated.slave.dbox(pkgname, id, w, h);
+               ret = s_info.updated.slave.dbox(pkgname, id, x, y, w, h);
        } else {
-               ret = dynamicbox_provider_send_updated(pkgname, id, w, h);
+               dynamicbox_damage_region_t region = {
+                       .x = x,
+                       .y = y,
+                       .w = w,
+                       .h = h,
+               };
+               ret = dynamicbox_provider_send_updated(pkgname, id, &region);
        }
 
        return ret;
 }
 
-static int send_gbar_updated(const char *pkgname, const char *id, const char *descfile)
+static int send_gbar_updated(const char *pkgname, const char *id, const char *descfile, int x, int y, int w, int h)
 {
        int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
 
@@ -246,11 +252,17 @@ static int send_gbar_updated(const char *pkgname, const char *id, const char *de
        }
 
        if (s_info.is_slave == 0) {
-               ret = s_info.updated.app.gbar(id);
+               ret = s_info.updated.app.gbar(id, x, y, w, h);
        } else if (s_info.is_slave == 1) {
-               ret = s_info.updated.slave.gbar(pkgname, id, descfile);
+               ret = s_info.updated.slave.gbar(pkgname, id, descfile, x, y, w, h);
        } else {
-               ret = dynamicbox_provider_send_desc_updated(pkgname, id, descfile);
+               dynamicbox_damage_region_t region = {
+                       .x = x,
+                       .y = y,
+                       .w = w,
+                       .h = h,
+               };
+               ret = dynamicbox_provider_send_desc_updated(pkgname, id, descfile, &region);
        }
 
        return ret;
@@ -918,6 +930,9 @@ PUBLIC int dynamicbox_sync_buffer(dynamicbox_buffer_h handle)
        struct dynamicbox_buffer_data *user_data;
        const char *pkgname;
        const char *id;
+       int w;
+       int h;
+       int pixel_size;
 
        if (!handle) {
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
@@ -948,20 +963,22 @@ PUBLIC int dynamicbox_sync_buffer(dynamicbox_buffer_h handle)
 
        (void)dynamicbox_provider_buffer_sync(handle);
 
+       if (dynamicbox_provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0) {
+               ErrPrint("Failed to get size (%s)\n", id);
+       }
+
+       /**
+        * @todo
+        * manipulate the damaged region, so send update event only for the damaged region.
+        * to make more efficient updates
+        */
+
        if (user_data->is_gbar == 1) {
-               if (send_gbar_updated(pkgname, id, NULL) < 0) {
+               if (send_gbar_updated(pkgname, id, NULL, 0, 0, w, h) < 0) {
                        ErrPrint("Failed to send PD updated (%s)\n", id);
                }
        } else {
-               int w;
-               int h;
-               int pixel_size;
-
-               if (dynamicbox_provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0) {
-                       ErrPrint("Failed to get size (%s)\n", id);
-               }
-
-               if (send_dbox_updated(pkgname, id, w, h) < 0) {
+               if (send_dbox_updated(pkgname, id, 0, 0, w, h) < 0) {
                        ErrPrint("Failed to send updated (%s)\n", id);
                }
        }
@@ -1067,6 +1084,9 @@ PUBLIC int dynamicbox_buffer_post_render(dynamicbox_buffer_h handle)
        const char *pkgname;
        const char *id;
        struct dynamicbox_buffer_data *user_data;
+       int w;
+       int h;
+       int pixel_size;
 
        if (!handle) {
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
@@ -1099,20 +1119,22 @@ PUBLIC int dynamicbox_buffer_post_render(dynamicbox_buffer_h handle)
                return ret;
        }
 
+       if (dynamicbox_provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0) {
+               ErrPrint("Failed to get size (%s)\n", id);
+       }
+
+       /**
+        * @todo
+        * manipulate the damaged region, so send update event only for the damaged region.
+        * to make more efficient updates
+        */
+
        if (user_data->is_gbar == 1) {
-               if (send_gbar_updated(pkgname, id, NULL) < 0) {
+               if (send_gbar_updated(pkgname, id, NULL, 0, 0, w, h) < 0) {
                        ErrPrint("Failed to send PD updated (%s)\n", id);
                }
        } else {
-               int w;
-               int h;
-               int pixel_size;
-
-               if (dynamicbox_provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0) {
-                       ErrPrint("Failed to get size (%s)\n", id);
-               }
-
-               if (send_dbox_updated(pkgname, id, w, h) < 0) {
+               if (send_dbox_updated(pkgname, id, 0, 0, w, h) < 0) {
                        ErrPrint("Failed to send updated (%s)\n", id);
                }
        }