forked from enlightenment/efl
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.
This commit is contained in:
parent
d5b0b1e683
commit
488854af2b
|
@ -133,19 +133,19 @@ interface Efl.Gfx.Buffer ()
|
||||||
be negative.
|
be negative.
|
||||||
]]
|
]]
|
||||||
params {
|
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,
|
@in mode: Efl.Gfx.Buffer.Access_Mode; [[Specifies whether to map for read-only,
|
||||||
write-only or read-write access (OR combinaison of flags).]]
|
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 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 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 w: int @optional; [[If 0, defaults to the buffer width.]]
|
||||||
@in h: uint @optional; [[If 0, defaults to the buffer height.]]
|
@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,
|
@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.
|
map should try to convert the data into a new buffer.
|
||||||
argb8888 by default.]]
|
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 {
|
buffer_unmap {
|
||||||
[[Unmap a region of this buffer, and update the internal data if needed.
|
[[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.
|
EFL will update the internal image if the map had write access.
|
||||||
]]
|
]]
|
||||||
params {
|
params {
|
||||||
@in data: ubyte*; [[Data pointer returned by a previous call to map]]
|
@in data: void*; [[Data pointer returned by a previous call to map]]
|
||||||
@in length: uint; [[Must be the same as returned by map.]]
|
@in length: int; [[Must be the same as returned by map.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EINA_INLIST;
|
EINA_INLIST;
|
||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
unsigned int size; // in bytes
|
int size; // in bytes
|
||||||
} Map_Data;
|
} Map_Data;
|
||||||
|
|
||||||
typedef struct {
|
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);
|
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,
|
_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,
|
Efl_Gfx_Buffer_Access_Mode mode,
|
||||||
int x, int y, unsigned int w, unsigned int h,
|
int x, int y, int w, int h,
|
||||||
Efl_Gfx_Colorspace cspace, unsigned int *stride)
|
Efl_Gfx_Colorspace cspace, int *stride)
|
||||||
{
|
{
|
||||||
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
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);
|
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;
|
Map_Data *map = NULL;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
@ -852,7 +852,7 @@ end:
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_image_efl_gfx_buffer_buffer_unmap(Eo *eo_obj, Efl_Canvas_Image_Data *pd,
|
_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_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);
|
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
||||||
|
|
|
@ -835,11 +835,10 @@ struct _RGBA_Pipe_Thread_Info
|
||||||
|
|
||||||
struct _RGBA_Image_Data_Map {
|
struct _RGBA_Image_Data_Map {
|
||||||
EINA_INLIST;
|
EINA_INLIST;
|
||||||
unsigned char *ptr;
|
unsigned char *ptr, *baseptr;
|
||||||
unsigned int size, stride; // in bytes
|
int size, stride; // in bytes
|
||||||
int rx, ry, rw, rh; // actual map region
|
int rx, ry, rw, rh; // actual map region
|
||||||
unsigned char *baseptr;
|
int plane;
|
||||||
unsigned char plane;
|
|
||||||
Evas_Colorspace cspace;
|
Evas_Colorspace cspace;
|
||||||
Eina_Bool allocated; // ptr is malloc() for cow or cspace conv
|
Eina_Bool allocated; // ptr is malloc() for cow or cspace conv
|
||||||
Efl_Gfx_Buffer_Access_Mode mode;
|
Efl_Gfx_Buffer_Access_Mode mode;
|
||||||
|
|
|
@ -1361,8 +1361,8 @@ struct _Evas_Func
|
||||||
Evas_Colorspace (*image_file_colorspace_get)(void *data, void *image);
|
Evas_Colorspace (*image_file_colorspace_get)(void *data, void *image);
|
||||||
Eina_Bool (*image_can_region_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_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, unsigned int length);
|
void *(*image_data_unmap) (void *data, void *image, void *map, int length);
|
||||||
|
|
||||||
int (*image_native_init) (void *data, Evas_Native_Surface_Type type);
|
int (*image_native_init) (void *data, Evas_Native_Surface_Type type);
|
||||||
void (*image_native_shutdown) (void *data, Evas_Native_Surface_Type type);
|
void (*image_native_shutdown) (void *data, Evas_Native_Surface_Type type);
|
||||||
|
|
|
@ -1439,7 +1439,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
eng_image_data_map(void *engdata EINA_UNUSED, void **image,
|
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,
|
int x, int y, int w, int h,
|
||||||
Evas_Colorspace cspace, Efl_Gfx_Buffer_Access_Mode mode)
|
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 *
|
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_Data_Map *map;
|
||||||
RGBA_Image *im = image;
|
RGBA_Image *im = image;
|
||||||
|
|
Loading…
Reference in New Issue