jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=caa999c5f9c9d118cee3e5b315ade9e93ad95f70

commit caa999c5f9c9d118cee3e5b315ade9e93ad95f70
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Tue Mar 29 14:59:50 2016 +0900

    examples: Fix evas_canvas3d_proxy (temporary solution)
    
    It was broken after all the changes in Evas.Image.
    Since buffer map/unmap is not fully completed (GL support is
    still to do), I added a quick #ifdef to switch between EO and
    Legacy APIs.
    
    Thanks @jackdanielz for the report.
---
 src/examples/evas/evas-3d-proxy.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/examples/evas/evas-3d-proxy.c 
b/src/examples/evas/evas-3d-proxy.c
index 06ff5bb..b634589 100644
--- a/src/examples/evas/evas-3d-proxy.c
+++ b/src/examples/evas/evas-3d-proxy.c
@@ -22,6 +22,9 @@
 #define  IMG_WIDTH       256
 #define  IMG_HEIGHT      256
 
+// TODO: remove this when map/unmap are fully supported (GL engine)
+#undef USE_EO_IMAGE
+
 typedef struct _Scene_Data
 {
    Eo *scene;
@@ -66,7 +69,7 @@ _animate_scene(void *data)
    static float angle = 0.0f;
    Scene_Data *scene = (Scene_Data *)data;
    unsigned int *pixels;
-   int i, j, stride;
+   int i, j, stride, length;
 
    angle += 0.5;
 
@@ -75,9 +78,15 @@ _animate_scene(void *data)
    /* Rotate */
    if (angle > 360.0) angle -= 360.0f;
 
-   //pixels = efl_gfx_buffer_get(source, EINA_TRUE, NULL, NULL, NULL, &stride, 
NULL, NULL, NULL, NULL, NULL, NULL);
+#ifdef USE_EO_IMAGE
+   pixels = efl_gfx_buffer_map(source, &length, 
EFL_GFX_BUFFER_ACCESS_MODE_WRITE, 0, 0, 0, 0,
+                               EFL_GFX_COLORSPACE_ARGB8888, &stride);
+   if (!pixels) return EINA_TRUE;
+#else
+   (void) length;
    pixels = evas_object_image_data_get(source, EINA_TRUE);
    stride = evas_object_image_stride_get(source);
+#endif
 
    for (i = 0; i < IMG_HEIGHT; i++)
      {
@@ -89,10 +98,13 @@ _animate_scene(void *data)
           }
      }
 
-   //efl_gfx_buffer_set(source, pixels, 0, 0, stride, 0, 0, 0, 0, 0, 0);
-   //evas_object_image_data_update_add(source, 0, 0, IMG_WIDTH, IMG_HEIGHT);
+#ifdef USE_EO_IMAGE
+   efl_gfx_buffer_unmap(source, pixels, length);
+   efl_gfx_buffer_update_add(source, 0, 0, IMG_WIDTH, IMG_HEIGHT);
+#else
    evas_object_image_data_set(source, pixels);
    evas_object_image_data_update_add(source, 0, 0, IMG_WIDTH, IMG_HEIGHT);
+#endif
 
    return EINA_TRUE;
 }
@@ -208,11 +220,19 @@ main(void)
    efl_gfx_visible_set(background, EINA_TRUE);
 
    /* Add a background image. */
-   source = evas_object_image_filled_add(evas);
-   efl_gfx_view_size_set(source, IMG_WIDTH, IMG_HEIGHT);
+#ifdef USE_EO_IMAGE
+   source = eo_add(EFL_CANVAS_IMAGE_CLASS, evas);
+   efl_gfx_buffer_data_set(source, NULL, WIDTH, HEIGHT, 0, 
EFL_GFX_COLORSPACE_ARGB8888);
    efl_gfx_position_set(source, (WIDTH / 2), (HEIGHT / 2));
    efl_gfx_size_set(source, (WIDTH / 2), (HEIGHT / 2));
    efl_gfx_visible_set(source, EINA_TRUE);
+#else
+   source = evas_object_image_filled_add(evas);
+   evas_object_image_size_set(source, IMG_WIDTH, IMG_HEIGHT);
+   evas_object_move(source, (WIDTH / 2), (HEIGHT / 2));
+   evas_object_resize(source, (WIDTH / 2), (HEIGHT / 2));
+   evas_object_show(source);
+#endif
 
    /* Add an image object for 3D scene rendering. */
    image = eo_add(EFL_CANVAS_SCENE3D_CLASS, evas);

-- 


Reply via email to