forked from enlightenment/efl
parent
777410eac2
commit
c766fe91db
|
@ -84,6 +84,7 @@ typedef enum _Evas_Colorspace
|
|||
EVAS_COLORSPACE_RGB565_A5P /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */
|
||||
} Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
|
||||
|
||||
typedef struct _Evas_Array Evas_Array; /**< A generic vector */
|
||||
typedef struct _Evas_List Evas_List; /**< A generic linked list node handle */
|
||||
typedef struct _Evas_Rectangle Evas_Rectangle; /**< A generic rectangle handle */
|
||||
typedef struct _Evas_Coord_Rectangle Evas_Coord_Rectangle; /**< A generic rectangle handle */
|
||||
|
@ -104,6 +105,14 @@ typedef int Evas_Font_Size;
|
|||
typedef int Evas_Angle;
|
||||
typedef unsigned char Evas_Bool;
|
||||
|
||||
struct _Evas_Array /** An array of data */
|
||||
{
|
||||
void **data; /**< Pointer to a vector of pointer to payload */
|
||||
unsigned int total; /**< Total number of slot in the vector */
|
||||
unsigned int count; /**< Number of activ slot in the vector */
|
||||
unsigned int step; /**< How much must we grow the vector When it is full */
|
||||
};
|
||||
|
||||
struct _Evas_List /** A linked list node */
|
||||
{
|
||||
void *data; /**< Pointer to list element payload */
|
||||
|
@ -417,6 +426,14 @@ extern "C" {
|
|||
EAPI Evas_List *evas_list_sort (Evas_List *list, int size, int(*func)(void*,void*));
|
||||
EAPI int evas_list_alloc_error (void);
|
||||
|
||||
EAPI Evas_Array *evas_array_new (unsigned int step);
|
||||
EAPI void evas_array_setup (Evas_Array *array, unsigned int step);
|
||||
EAPI void evas_array_free (Evas_Array *array);
|
||||
EAPI void evas_array_append (Evas_Array *array, void *data);
|
||||
EAPI void *evas_array_get (Evas_Array *array, unsigned int index);
|
||||
EAPI void evas_array_clean (Evas_Array *array);
|
||||
EAPI void evas_array_flush (Evas_Array *array);
|
||||
|
||||
/* FIXME: add:
|
||||
* api to add find, del members by data, size not just string and also
|
||||
* provide hash generation functions settable by the app
|
||||
|
|
|
@ -13,6 +13,7 @@ noinst_LTLIBRARIES = libevas_data.la
|
|||
libevas_data_la_SOURCES = \
|
||||
evas_hash.c \
|
||||
evas_list.c \
|
||||
evas_array.c \
|
||||
evas_object_list.c \
|
||||
evas_stringshare.c
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_private.h"
|
||||
|
||||
Evas_Bool
|
||||
_evas_array_grow(Evas_Array *array)
|
||||
{
|
||||
void **tmp;
|
||||
unsigned int total;
|
||||
|
||||
total = array->total + array->step;
|
||||
tmp = realloc(array->data, sizeof (void*) * total);
|
||||
if (!tmp) return 0;
|
||||
|
||||
array->total = total;
|
||||
array->data = tmp;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_array_append(Evas_Array *array, void *data)
|
||||
{
|
||||
_evas_array_append(array, data);
|
||||
}
|
||||
|
||||
EAPI void*
|
||||
evas_array_get(Evas_Array *array, unsigned int index)
|
||||
{
|
||||
return _evas_array_get(array, index);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_array_clean(Evas_Array *array)
|
||||
{
|
||||
array->count = 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_array_setup(Evas_Array *array, unsigned int step)
|
||||
{
|
||||
array->step = step;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_array_flush(Evas_Array *array)
|
||||
{
|
||||
array->count = 0;
|
||||
array->total = 0;
|
||||
|
||||
if (array->data) free(array->data);
|
||||
array->data = NULL;
|
||||
}
|
||||
|
||||
EAPI Evas_Array*
|
||||
evas_array_new(unsigned int step)
|
||||
{
|
||||
Evas_Array *array;
|
||||
|
||||
array = malloc(sizeof (Evas_Array));
|
||||
if (!array) return NULL;
|
||||
|
||||
array->data = NULL;
|
||||
array->total = 0;
|
||||
array->count = 0;
|
||||
array->step = step;
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_array_free(Evas_Array *array)
|
||||
{
|
||||
evas_array_flush(array);
|
||||
free(array);
|
||||
}
|
|
@ -158,4 +158,19 @@ evas_object_clip_recalc(Evas_Object *obj)
|
|||
obj->cur.cache.clip.dirty = 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_evas_array_append(Evas_Array *array, void *data)
|
||||
{
|
||||
if (UNLIKELY(array->count + array->step > array->total))
|
||||
if (!_evas_array_grow(array)) return ;
|
||||
|
||||
array->data[array->count++] = data;
|
||||
}
|
||||
|
||||
static inline void*
|
||||
_evas_array_get(Evas_Array *array, unsigned int index)
|
||||
{
|
||||
return array->data[index];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -339,6 +339,12 @@ struct _Evas
|
|||
int info_magic;
|
||||
} engine;
|
||||
|
||||
Evas_Array delete_objects;
|
||||
Evas_Array active_objects;
|
||||
Evas_Array restack_objects;
|
||||
Evas_Array render_objects;
|
||||
Evas_Array pending_objects;
|
||||
|
||||
int delete_grabs;
|
||||
int walking_grabs;
|
||||
Evas_List *grabs;
|
||||
|
@ -466,6 +472,9 @@ struct _Evas_Object
|
|||
Evas_Bool repeat_events : 1;
|
||||
Evas_Bool restack : 1;
|
||||
Evas_Bool changed : 1;
|
||||
Evas_Bool is_active : 1;
|
||||
Evas_Bool render_pre : 1;
|
||||
Evas_Bool rect_del : 1;
|
||||
Evas_Bool mouse_in : 1;
|
||||
Evas_Bool pre_render_done : 1;
|
||||
Evas_Bool intercepted : 1;
|
||||
|
@ -813,10 +822,16 @@ void _evas_unwalk(Evas *e);
|
|||
|
||||
EAPI int _evas_module_engine_inherit(Evas_Func *funcs, char *name);
|
||||
|
||||
void evas_render_invalidate(Evas *e);
|
||||
void evas_render_object_recalc(Evas_Object *obj);
|
||||
|
||||
Evas_Bool _evas_array_grow(Evas_Array *array);
|
||||
|
||||
#define EVAS_API_OVERRIDE(func, api, prefix) \
|
||||
(api)->func = prefix##func
|
||||
|
||||
#include "evas_inline.x"
|
||||
|
||||
#define EVAS_API_OVERRIDE(func, api, prefix) \
|
||||
(api)->func = prefix##func
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue