jpeg pushed a commit to branch master.

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

commit 488854af2bbae2e18624fec235599de6e191a812
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Wed Mar 23 18:14:37 2016 +0900

    Efl.Gfx.Buffer: Switch to void* data and signed ints
    
    1. unsigned char* as a return type was not even compatible
       with the default colorspace (ARGB: 32 bits).
    
    2. Change all unsigned to int for... uh... simplicity
       unsigned is more correct than int for things like width,
       size or stride, but in fact having both ints (x,y) and unsigned
       ints makes the code more complex.
       This is a matter of personal taste.
---
 src/lib/efl/interfaces/efl_gfx_buffer.eo                | 14 +++++++-------
 src/lib/evas/canvas/efl_canvas_image.c                  | 14 +++++++-------
 src/lib/evas/include/evas_common_private.h              |  7 +++----
 src/lib/evas/include/evas_private.h                     |  4 ++--
 src/modules/evas/engines/software_generic/evas_engine.c |  4 ++--
 5 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/src/lib/efl/interfaces/efl_gfx_buffer.eo 
b/src/lib/efl/interfaces/efl_gfx_buffer.eo
index 7585393..2492792 100644
--- a/src/lib/efl/interfaces/efl_gfx_buffer.eo
+++ b/src/lib/efl/interfaces/efl_gfx_buffer.eo
@@ -133,19 +133,19 @@ interface Efl.Gfx.Buffer ()
            be negative.
          ]]
          params {
-            @out length: uint @nonull; [[Accessible buffer size in bytes, 
should not be $null.]]
+            @out length: int @nonull; [[Accessible buffer size in bytes, 
should not be $null.]]
             @in mode: Efl.Gfx.Buffer.Access_Mode; [[Specifies whether to map 
for read-only,
                                                     write-only or read-write 
access (OR combinaison of flags).]]
             @in x: int @optional;  [[X position of the top-left pixel to map, 
defaults to 0.]]
             @in y: int @optional;  [[Y position of the top-left pixel to map, 
defaults to 0.]]
-            @in w: uint @optional; [[If 0, defaults to the buffer width.]]
-            @in h: uint @optional; [[If 0, defaults to the buffer height.]]
+            @in w: int @optional; [[If 0, defaults to the buffer width.]]
+            @in h: int @optional; [[If 0, defaults to the buffer height.]]
             @in cspace: Efl.Gfx.Colorspace @optional; [[Requested colorspace. 
If differen from the internal cspace,
                                                         map should try to 
convert the data into a new buffer.
                                                         argb8888 by default.]]
-            @out stride: uint @optional; [[Returns the length in bytes of a 
mapped line]]
+            @out stride: int @optional; [[Returns the length in bytes of a 
mapped line]]
          }
-         return: ubyte* @warn_unused; [[Pointer to the top-left pixel data. 
Returns $null in case of failure]]
+         return: void* @warn_unused; [[Pointer to the top-left pixel data. 
Returns $null in case of failure]]
       }
       buffer_unmap {
          [[Unmap a region of this buffer, and update the internal data if 
needed.
@@ -153,8 +153,8 @@ interface Efl.Gfx.Buffer ()
            EFL will update the internal image if the map had write access.
          ]]
          params {
-            @in data: ubyte*; [[Data pointer returned by a previous call to 
map]]
-            @in length: uint; [[Must be the same as returned by map.]]
+            @in data: void*; [[Data pointer returned by a previous call to 
map]]
+            @in length: int; [[Must be the same as returned by map.]]
          }
       }
 
diff --git a/src/lib/evas/canvas/efl_canvas_image.c 
b/src/lib/evas/canvas/efl_canvas_image.c
index 2dac517..5a65050 100644
--- a/src/lib/evas/canvas/efl_canvas_image.c
+++ b/src/lib/evas/canvas/efl_canvas_image.c
@@ -7,7 +7,7 @@
 typedef struct {
    EINA_INLIST;
    unsigned char *ptr;
-   unsigned int   size; // in bytes
+   int size; // in bytes
 } Map_Data;
 
 typedef struct {
@@ -803,16 +803,16 @@ _efl_canvas_image_efl_gfx_buffer_buffer_data_get(Eo 
*eo_obj, Efl_Canvas_Image_Da
    return ENFN->image_data_direct(ENDT, o->engine_data, NULL);
 }
 
-EOLIAN static unsigned char *
+EOLIAN static void *
 _efl_canvas_image_efl_gfx_buffer_buffer_map(Eo *eo_obj, Efl_Canvas_Image_Data 
*pd,
-                                            unsigned int *length,
+                                            int *length,
                                             Efl_Gfx_Buffer_Access_Mode mode,
-                                            int x, int y, unsigned int w, 
unsigned int h,
-                                            Efl_Gfx_Colorspace cspace, 
unsigned int *stride)
+                                            int x, int y, int w, int h,
+                                            Efl_Gfx_Colorspace cspace, int 
*stride)
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
    Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
-   unsigned int len = 0, str = 0;
+   int len = 0, str = 0;
    Map_Data *map = NULL;
    void *data;
 
@@ -852,7 +852,7 @@ end:
 
 EOLIAN static void
 _efl_canvas_image_efl_gfx_buffer_buffer_unmap(Eo *eo_obj, 
Efl_Canvas_Image_Data *pd,
-                                              unsigned char *data, unsigned 
int length)
+                                              void *data, int length)
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, 
EVAS_OBJECT_CLASS);
    Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
diff --git a/src/lib/evas/include/evas_common_private.h 
b/src/lib/evas/include/evas_common_private.h
index 600a645..e649626 100644
--- a/src/lib/evas/include/evas_common_private.h
+++ b/src/lib/evas/include/evas_common_private.h
@@ -835,11 +835,10 @@ struct _RGBA_Pipe_Thread_Info
 
 struct _RGBA_Image_Data_Map {
    EINA_INLIST;
-   unsigned char  *ptr;
-   unsigned int    size, stride; // in bytes
+   unsigned char  *ptr, *baseptr;
+   int             size, stride; // in bytes
    int             rx, ry, rw, rh; // actual map region
-   unsigned char  *baseptr;
-   unsigned char   plane;
+   int             plane;
    Evas_Colorspace cspace;
    Eina_Bool       allocated; // ptr is malloc() for cow or cspace conv
    Efl_Gfx_Buffer_Access_Mode mode;
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index b9f2ce3..9c82ad3 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1361,8 +1361,8 @@ struct _Evas_Func
    Evas_Colorspace (*image_file_colorspace_get)(void *data, void *image);
    Eina_Bool (*image_can_region_get)       (void *data, void *image);
 
-   void *(*image_data_map)                 (void *data, void **image, unsigned 
int *length, unsigned int *stride, int x, int y, int w, int h, Evas_Colorspace 
cspace, Efl_Gfx_Buffer_Access_Mode mode);
-   void *(*image_data_unmap)               (void *data, void *image, void 
*map, unsigned int length);
+   void *(*image_data_map)                 (void *data, void **image, int 
*length, int *stride, int x, int y, int w, int h, Evas_Colorspace cspace, 
Efl_Gfx_Buffer_Access_Mode mode);
+   void *(*image_data_unmap)               (void *data, void *image, void 
*map, int length);
 
    int (*image_native_init)                (void *data, 
Evas_Native_Surface_Type type);
    void (*image_native_shutdown)           (void *data, 
Evas_Native_Surface_Type type);
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c 
b/src/modules/evas/engines/software_generic/evas_engine.c
index 5d97782..35bdf2a 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -1439,7 +1439,7 @@ eng_image_data_put(void *data, void *image, DATA32 
*image_data)
 
 static void *
 eng_image_data_map(void *engdata EINA_UNUSED, void **image,
-                   unsigned int *length, unsigned int *stride,
+                   int *length, int *stride,
                    int x, int y, int w, int h,
                    Evas_Colorspace cspace, Efl_Gfx_Buffer_Access_Mode mode)
 {
@@ -1666,7 +1666,7 @@ _image_data_commit(RGBA_Image *im, RGBA_Image_Data_Map 
*map)
 }
 
 static void *
-eng_image_data_unmap(void *engdata EINA_UNUSED, void *image, void *memory, 
unsigned int length)
+eng_image_data_unmap(void *engdata EINA_UNUSED, void *image, void *memory, int 
length)
 {
    RGBA_Image_Data_Map *map;
    RGBA_Image *im = image;

-- 


Reply via email to