cedric pushed a commit to branch master.

http://git.enlightenment.org/tools/expedite.git/commit/?id=f8b38f6c24802fb895615c0fef14994f8083629e

commit f8b38f6c24802fb895615c0fef14994f8083629e
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Thu Mar 17 16:54:20 2016 -0700

    migrate to new broken data_get/set api.
---
 src/bin/image_data_argb.c                          | 18 ++--
 src/bin/image_data_argb_alpha.c                    | 19 +++--
 src/bin/image_data_ycbcr601pl.c                    | 31 ++++---
 ...mage_data_ycbcr601pl_map_nearest_solid_rotate.c | 18 ++--
 src/bin/image_data_ycbcr601pl_map_solid_rotate.c   | 18 ++--
 src/bin/image_data_ycbcr601pl_wide_stride.c        | 98 +++++++++++-----------
 6 files changed, 105 insertions(+), 97 deletions(-)

diff --git a/src/bin/image_data_argb.c b/src/bin/image_data_argb.c
index 9d1bca5..25666fc 100644
--- a/src/bin/image_data_argb.c
+++ b/src/bin/image_data_argb.c
@@ -22,18 +22,21 @@ static void _setup(void)
 {
    int i;
    Evas_Object *o;
+   void *pixels;
+
+   pixels = malloc(sizeof (int) * 640 * 480);
    for (i = 0; i < 1; i++)
      {
         o = eo_add(EVAS_IMAGE_CLASS, evas);
         o_images[i] = o;
-        evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
-        evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
-        efl_gfx_view_size_set(o, 640, 480);
-        evas_obj_image_alpha_set(o, 0);
+        efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+        efl_gfx_buffer_alpha_set(o, 0);
         efl_gfx_fill_set(o, 0, 0, 640, 480);
         efl_gfx_size_set(o, 640, 480);
         efl_gfx_visible_set(o, EINA_TRUE);
+        efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof 
(int), EFL_GFX_COLORSPACE_ARGB8888);
      }
+   free(pixels);
    done = 0;
 }
 
@@ -60,8 +63,7 @@ static void _loop(double t, int f)
         efl_gfx_position_set(o_images[i], x, y);
         efl_gfx_size_set(o_images[i], w, h);
         efl_gfx_fill_set(o_images[i], 0, 0, w, h);
-        data = evas_obj_image_data_get(o_images[i], 1);
-        st = evas_obj_image_stride_get(o_images[i]);
+        data = efl_gfx_buffer_get(o_images[i], 1, &w, &h, &st, NULL);
         st = st >> 2;
         p = data;
         for (y = 0; y < h; y++)
@@ -73,8 +75,8 @@ static void _loop(double t, int f)
                }
              p += (st - w);
           }
-        evas_obj_image_data_set(o_images[i], data);
-        evas_obj_image_data_update_add(o_images[i], 0, 0, w, h);
+        efl_gfx_buffer_set(o_images[i], data, w, h, st << 2, 
EFL_GFX_COLORSPACE_ARGB8888);
+        efl_gfx_buffer_update_add(o_images[i], 0, 0, w, h);
      }
    FPS_STD(NAME);
 }
diff --git a/src/bin/image_data_argb_alpha.c b/src/bin/image_data_argb_alpha.c
index 714e092..6eb8662 100644
--- a/src/bin/image_data_argb_alpha.c
+++ b/src/bin/image_data_argb_alpha.c
@@ -22,18 +22,21 @@ static void _setup(void)
 {
    int i;
    Evas_Object *o;
+   void *pixels;
+
+   pixels = malloc(sizeof (int) * 640 * 480);
    for (i = 0; i < 1; i++)
      {
         o = eo_add(EVAS_IMAGE_CLASS, evas);
         o_images[i] = o;
-        evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
-        evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
-        efl_gfx_view_size_set(o, 640, 480);
-        evas_obj_image_alpha_set(o, 1);
+        efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+        efl_gfx_buffer_alpha_set(o, 1);
         efl_gfx_fill_set(o, 0, 0, 640, 480);
         efl_gfx_size_set(o, 640, 480);
         efl_gfx_visible_set(o, EINA_TRUE);
+        efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof 
(int), EFL_GFX_COLORSPACE_ARGB8888);
      }
+   free(pixels);
    done = 0;
 }
 
@@ -53,6 +56,7 @@ static void _loop(double t, int f)
      {
         unsigned int *data, *p;
         int a, r, g, b;
+
         w = 640;
         h = 480;
         x = (win_w / 2) - (w / 2);
@@ -60,8 +64,7 @@ static void _loop(double t, int f)
         efl_gfx_position_set(o_images[i], x, y);
         efl_gfx_size_set(o_images[i], w, h);
         efl_gfx_fill_set(o_images[i], 0, 0, w, h);
-        data = evas_obj_image_data_get(o_images[i], 1);
-        st = evas_obj_image_stride_get(o_images[i]);
+        data = efl_gfx_buffer_get(o_images[i], 1, &w, &h, &st, NULL);
         st = st >> 2;
         p = data;
         for (y = 0; y < h; y++)
@@ -84,8 +87,8 @@ static void _loop(double t, int f)
                }
              p += (st - w);
           }
-        evas_obj_image_data_set(o_images[i], data);
-        evas_obj_image_data_update_add(o_images[i], 0, 0, w, h);
+        efl_gfx_buffer_set(o_images[i], data, w, h, st << 2, 
EFL_GFX_COLORSPACE_ARGB8888);
+        efl_gfx_buffer_update_add(o_images[i], 0, 0, w, h);
      }
    FPS_STD(NAME);
 }
diff --git a/src/bin/image_data_ycbcr601pl.c b/src/bin/image_data_ycbcr601pl.c
index 42a20a5..f28ef97 100644
--- a/src/bin/image_data_ycbcr601pl.c
+++ b/src/bin/image_data_ycbcr601pl.c
@@ -23,19 +23,20 @@ static void _setup(void)
 {
    int i, y;
    FILE *f;
-   unsigned char **data, **lp;
+   unsigned char *data, **lp;
    Evas_Object *o;
    for (i = 0; i < 1; i++)
      {
+        unsigned int length;
+
         o = eo_add(EVAS_IMAGE_CLASS, evas);
         o_images[i] = o;
-        evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
-        evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL);
-        efl_gfx_view_size_set(o, 640, 480);
-        evas_obj_image_alpha_set(o, 0);
+        efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+        efl_gfx_buffer_alpha_set(o, 0);
         efl_gfx_fill_set(o, 0, 0, 640, 480);
         efl_gfx_size_set(o, 640, 480);
         efl_gfx_visible_set(o, EINA_TRUE);
+        data = malloc(sizeof (void*) * (480 + 240 + 240));
         yp = malloc(640 * 480);
         up = malloc(320 * 240);
         vp = malloc(320 * 240);
@@ -47,8 +48,8 @@ static void _setup(void)
              fread(vp, 320 * 240, 1, f);
              fclose(f);
           }
-        data = evas_object_image_data_get(o_images[i], 1);
-        lp = data;
+        lp = (unsigned char**) data;
+
         for (y = 0; y < 480; y++)
           {
              *lp = yp + (y * 640);
@@ -64,7 +65,12 @@ static void _setup(void)
              *lp = vp + (y * 320);
              lp++;
           }
-        evas_obj_image_data_set(o_images[i], data);
+        efl_gfx_buffer_copy_set(o_images[i], data, 640, 480, 640 * sizeof 
(int), EVAS_COLORSPACE_YCBCR422P601_PL);
+        free(data);
+        // Not a real copy in fact...
+        /* free(yp); */
+        /* free(up); */
+        /* free(vp); */
      }
    done = 0;
 }
@@ -74,9 +80,10 @@ static void _cleanup(void)
 {
    int i;
    for (i = 0; i < 1; i++) eo_del(o_images[i]);
-   free(yp);
-   free(up);
-   free(vp);
+   // FIXME: the object is not destroyed anymore so we can't free the data
+   /* free(yp); */
+   /* free(up); */
+   /* free(vp); */
 }
 
 /* loop - do things */
@@ -93,7 +100,7 @@ static void _loop(double t, int f)
         efl_gfx_position_set(o_images[i], x, y);
         efl_gfx_size_set(o_images[i], w, h);
         efl_gfx_fill_set(o_images[i], 0, 0, w, h);
-        evas_obj_image_data_update_add(o_images[i], 0, 0, 640, 480);
+        efl_gfx_buffer_update_add(o_images[i], 0, 0, 640, 480);
      }
    FPS_STD(NAME);
 }
diff --git a/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c 
b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
index bc9840c..e132e77 100644
--- a/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
+++ b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
@@ -27,16 +27,17 @@ static void _setup(void)
    Evas_Object *o;
    for (i = 0; i < 1; i++)
      {
+        unsigned int length;
+
         o = eo_add(EVAS_IMAGE_CLASS, evas);
         o_images[i] = o;
-        evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
-        evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL);
-        efl_gfx_view_size_set(o, 640, 480);
-        evas_obj_image_alpha_set(o, 0);
+        efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+        efl_gfx_buffer_alpha_set(o, 0);
         efl_gfx_fill_set(o, 0, 0, 640, 480);
         efl_gfx_size_set(o, 640, 480);
         efl_image_smooth_scale_set(o, 0);
         efl_gfx_visible_set(o, EINA_TRUE);
+        data = malloc(sizeof (void*) * (480 + 240 + 240));
         yp = malloc(640 * 480);
         up = malloc(320 * 240);
         vp = malloc(320 * 240);
@@ -48,7 +49,6 @@ static void _setup(void)
              fread(vp, 320 * 240, 1, f);
              fclose(f);
           }
-        data = evas_object_image_data_get(o_images[i], 1);
         lp = data;
         for (y = 0; y < 480; y++)
           {
@@ -65,7 +65,7 @@ static void _setup(void)
              *lp = vp + (y * 320);
              lp++;
           }
-        evas_obj_image_data_set(o_images[i], data);
+        efl_gfx_buffer_set(o_images[i], data, 640, 480, 640 * sizeof (int), 
EVAS_COLORSPACE_YCBCR422P601_PL);
      }
    done = 0;
 }
@@ -75,9 +75,9 @@ static void _cleanup(void)
 {
    int i;
    for (i = 0; i < 1; i++) eo_del(o_images[i]);
-   free(yp);
-   free(up);
-   free(vp);
+   /* free(yp); */
+   /* free(up); */
+   /* free(vp); */
 }
 
 /* loop - do things */
diff --git a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c 
b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
index c6e60bc..28dd6c8 100644
--- a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
+++ b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
@@ -27,15 +27,16 @@ static void _setup(void)
    Evas_Object *o;
    for (i = 0; i < 1; i++)
      {
+        unsigned int length;
+
         o = eo_add(EVAS_IMAGE_CLASS, evas);
         o_images[i] = o;
-        evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
-        evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL);
-        efl_gfx_view_size_set(o, 640, 480);
-        evas_obj_image_alpha_set(o, 0);
+        efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+        efl_gfx_buffer_alpha_set(o, 0);
         efl_gfx_fill_set(o, 0, 0, 640, 480);
         efl_gfx_size_set(o, 640, 480);
         efl_gfx_visible_set(o, EINA_TRUE);
+        data = malloc(sizeof (void*) * (480 + 240 + 240));
         yp = malloc(640 * 480);
         up = malloc(320 * 240);
         vp = malloc(320 * 240);
@@ -47,7 +48,6 @@ static void _setup(void)
              fread(vp, 320 * 240, 1, f);
              fclose(f);
           }
-        data = evas_object_image_data_get(o_images[i], 1);
         lp = data;
         for (y = 0; y < 480; y++)
           {
@@ -64,7 +64,7 @@ static void _setup(void)
              *lp = vp + (y * 320);
              lp++;
           }
-        evas_obj_image_data_set(o_images[i], data);
+        efl_gfx_buffer_set(o_images[i], data, 640, 480, 640 * sizeof (int), 
EVAS_COLORSPACE_YCBCR422P601_PL);
      }
    done = 0;
 }
@@ -74,9 +74,9 @@ static void _cleanup(void)
 {
    int i;
    for (i = 0; i < 1; i++) eo_del(o_images[i]);
-   free(yp);
-   free(up);
-   free(vp);
+   /* free(yp); */
+   /* free(up); */
+   /* free(vp); */
 }
 
 /* loop - do things */
diff --git a/src/bin/image_data_ycbcr601pl_wide_stride.c 
b/src/bin/image_data_ycbcr601pl_wide_stride.c
index f6690b9..4599260 100644
--- a/src/bin/image_data_ycbcr601pl_wide_stride.c
+++ b/src/bin/image_data_ycbcr601pl_wide_stride.c
@@ -27,15 +27,16 @@ static void _setup(void)
    Evas_Object *o;
    for (i = 0; i < 1; i++)
      {
+        unsigned int length;
+
         o = eo_add(EVAS_IMAGE_CLASS, evas);
         o_images[i] = o;
-        evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
-        evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL);
-        efl_gfx_view_size_set(o, 320, 480);
-        evas_obj_image_alpha_set(o, 0);
+        efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+        efl_gfx_buffer_alpha_set(o, 0);
         efl_gfx_fill_set(o, 0, 0, 640, 480);
         efl_gfx_size_set(o, 640, 480);
         efl_gfx_visible_set(o, EINA_TRUE);
+        data = malloc(sizeof (unsigned char*) * (480 + 240 + 240));
         yp = malloc(640 * 480);
         up = malloc(320 * 240);
         vp = malloc(320 * 240);
@@ -47,28 +48,24 @@ static void _setup(void)
              fread(vp, 320 * 240, 1, f);
              fclose(f);
           }
-        data = evas_object_image_data_get(o_images[i], 1);
-        if (data)
+        lp = data;
+        for (y = 0; y < 480; y++)
+          {
+             *lp = yp + (y * 640);
+             lp++;
+          }
+        for (y = 0; y < 240; y++)
           {
-             lp = data;
-             for (y = 0; y < 480; y++)
-               {
-                  *lp = yp + (y * 640);
-                  lp++;
-               }
-             for (y = 0; y < 240; y++)
-               {
-                  *lp = up + (y * 320);
-                  lp++;
-               }
-             for (y = 0; y < 240; y++)
-               {
-                  *lp = vp + (y * 320);
-                  lp++;
-               }
-             evas_obj_image_data_set(o_images[i], data);
-             evas_obj_image_data_update_add(o_images[i], 0, 0, 320, 480);
+             *lp = up + (y * 320);
+             lp++;
           }
+        for (y = 0; y < 240; y++)
+          {
+             *lp = vp + (y * 320);
+             lp++;
+          }
+        efl_gfx_buffer_set(o_images[i], data, 640, 480, 640 * sizeof (int), 
EVAS_COLORSPACE_YCBCR422P601_PL);
+        efl_gfx_buffer_update_add(o_images[i], 0, 0, 320, 480);
      }
    done = 0;
 }
@@ -78,9 +75,9 @@ static void _cleanup(void)
 {
    int i;
    for (i = 0; i < 1; i++) eo_del(o_images[i]);
-   free(yp);
-   free(up);
-   free(vp);
+   /* free(yp); */
+   /* free(up); */
+   /* free(vp); */
 }
 
 /* loop - do things */
@@ -90,7 +87,8 @@ static void _loop(double t, int f)
    Evas_Coord x, y, w, h;
    for (i = 0; i < 1; i++)
      {
-       unsigned char **data, **lp;
+        unsigned char **data, **lp;
+        int stride;
 
         w = 640;
        h = 480;
@@ -106,29 +104,27 @@ static void _loop(double t, int f)
 
        w &= ~0x1;
 
-       efl_gfx_view_size_set(o_images[i], w, 480);
-       data = evas_object_image_data_get(o_images[i], 1);
-       if (data)
-         {
-            lp = data;
-            for (y = 0; y < 480; y++)
-              {
-                 *lp = yp + (y * 640);
-                 lp++;
-              }
-            for (y = 0; y < 240; y++)
-              {
-                 *lp = up + (y * 320);
-                 lp++;
-              }
-            for (y = 0; y < 240; y++)
-              {
-                 *lp = vp + (y * 320);
-                 lp++;
-              }
-             evas_obj_image_data_set(o_images[i], data);
-             evas_obj_image_data_update_add(o_images[i], 0, 0, w, 480);
-         }
+        data = malloc(sizeof (void*) * (480 + 240 + 240));
+        lp = data;
+        for (y = 0; y < 480; y++)
+          {
+             *lp = yp + (y * 640);
+             lp++;
+          }
+        for (y = 0; y < 240; y++)
+          {
+             *lp = up + (y * 320);
+             lp++;
+          }
+        for (y = 0; y < 240; y++)
+          {
+             *lp = vp + (y * 320);
+             lp++;
+          }
+
+        efl_gfx_buffer_copy_set(o_images[i], data, w, 480, w * sizeof (int), 
EVAS_COLORSPACE_YCBCR422P601_PL);
+        efl_gfx_buffer_update_add(o_images[i], 0, 0, w, 480);
+        free(data);
      }
    FPS_STD(NAME);
 }

-- 


Reply via email to