2015-04-03 07:12:59 -07:00
|
|
|
#ifndef EVAS_VG_PRIVATE_H_
|
|
|
|
# define EVAS_VG_PRIVATE_H_
|
|
|
|
|
2015-04-03 07:22:58 -07:00
|
|
|
#include <Ector.h>
|
|
|
|
|
2016-05-11 05:13:27 -07:00
|
|
|
typedef struct _Efl_VG_Data Efl_VG_Data;
|
2015-04-03 07:30:59 -07:00
|
|
|
typedef struct _Efl_VG_Container_Data Efl_VG_Container_Data;
|
|
|
|
typedef struct _Efl_VG_Gradient_Data Efl_VG_Gradient_Data;
|
2015-06-16 07:28:19 -07:00
|
|
|
typedef struct _Efl_VG_Interpolation Efl_VG_Interpolation;
|
2015-04-03 07:22:58 -07:00
|
|
|
|
2016-05-05 07:31:54 -07:00
|
|
|
typedef struct _Evas_VG_Data Evas_VG_Data;
|
|
|
|
|
|
|
|
struct _Evas_VG_Data
|
|
|
|
{
|
|
|
|
void *engine_data;
|
|
|
|
Efl_VG *root;
|
|
|
|
|
|
|
|
Eina_Rectangle fill;
|
|
|
|
|
|
|
|
unsigned int width, height;
|
|
|
|
|
|
|
|
Eina_Array cleanup;
|
|
|
|
};
|
|
|
|
|
2016-05-11 05:13:27 -07:00
|
|
|
struct _Efl_VG_Data
|
2015-04-03 07:14:48 -07:00
|
|
|
{
|
2015-06-05 01:54:13 -07:00
|
|
|
const char *name;
|
|
|
|
|
2015-04-03 07:14:48 -07:00
|
|
|
Eina_Matrix3 *m;
|
2015-06-16 07:28:19 -07:00
|
|
|
Efl_VG_Interpolation *intp;
|
|
|
|
|
2015-04-03 07:30:59 -07:00
|
|
|
Efl_VG *mask;
|
2015-04-03 07:22:58 -07:00
|
|
|
Ector_Renderer *renderer;
|
2015-04-03 07:14:48 -07:00
|
|
|
|
2016-05-11 05:13:27 -07:00
|
|
|
void (*render_pre)(Eo *obj, Eina_Matrix3 *parent, Ector_Surface *s, void *data, Efl_VG_Data *nd);
|
2015-04-03 07:22:57 -07:00
|
|
|
void *data;
|
2015-04-03 07:14:48 -07:00
|
|
|
|
|
|
|
double x, y;
|
|
|
|
int r, g, b, a;
|
2016-05-19 01:55:06 -07:00
|
|
|
Efl_Gfx_Change_Flag flags;
|
2015-04-03 07:22:57 -07:00
|
|
|
|
|
|
|
Eina_Bool visibility : 1;
|
|
|
|
Eina_Bool changed : 1;
|
2015-04-03 07:14:48 -07:00
|
|
|
};
|
|
|
|
|
2015-04-03 07:30:59 -07:00
|
|
|
struct _Efl_VG_Container_Data
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
|
|
|
Eina_List *children;
|
2015-06-05 01:54:13 -07:00
|
|
|
|
|
|
|
Eina_Hash *names;
|
2015-04-03 07:12:59 -07:00
|
|
|
};
|
|
|
|
|
2015-04-03 07:30:59 -07:00
|
|
|
struct _Efl_VG_Gradient_Data
|
2015-04-03 07:22:58 -07:00
|
|
|
{
|
|
|
|
// FIXME: Later on we should deduplicate it somehow (Using Ector ?).
|
2015-04-03 07:23:16 -07:00
|
|
|
Efl_Gfx_Gradient_Stop *colors;
|
2015-04-03 07:22:58 -07:00
|
|
|
unsigned int colors_count;
|
|
|
|
|
2015-04-03 07:23:16 -07:00
|
|
|
Efl_Gfx_Gradient_Spread s;
|
2015-04-03 07:22:58 -07:00
|
|
|
};
|
|
|
|
|
2015-06-16 07:28:19 -07:00
|
|
|
struct _Efl_VG_Interpolation
|
|
|
|
{
|
|
|
|
Eina_Quaternion rotation;
|
|
|
|
Eina_Quaternion perspective;
|
|
|
|
Eina_Point_3D translation;
|
|
|
|
Eina_Point_3D scale;
|
|
|
|
Eina_Point_3D skew;
|
|
|
|
};
|
|
|
|
|
2016-05-11 05:13:27 -07:00
|
|
|
static inline Efl_VG_Data *
|
2015-04-03 07:30:59 -07:00
|
|
|
_evas_vg_render_pre(Efl_VG *child, Ector_Surface *s, Eina_Matrix3 *m)
|
2015-04-03 07:22:58 -07:00
|
|
|
{
|
2016-05-11 05:13:27 -07:00
|
|
|
Efl_VG_Data *child_nd = NULL;
|
2015-04-03 07:22:58 -07:00
|
|
|
|
|
|
|
// FIXME: Prevent infinite loop
|
2015-04-03 07:23:04 -07:00
|
|
|
if (child)
|
2016-08-15 06:44:41 -07:00
|
|
|
child_nd = efl_data_scope_get(child, EFL_VG_CLASS);
|
2015-04-03 07:23:04 -07:00
|
|
|
if (child_nd)
|
|
|
|
child_nd->render_pre(child, m, s, child_nd->data, child_nd);
|
|
|
|
|
|
|
|
return child_nd;
|
2015-04-03 07:22:58 -07:00
|
|
|
}
|
|
|
|
|
2015-04-03 07:30:42 -07:00
|
|
|
static inline void
|
2016-05-11 05:13:27 -07:00
|
|
|
_efl_vg_changed(Eo *obj)
|
2015-04-03 07:30:42 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_GFX_CHANGED, NULL);
|
2015-04-03 07:30:42 -07:00
|
|
|
}
|
|
|
|
|
2015-06-19 02:26:46 -07:00
|
|
|
static inline void *
|
|
|
|
_efl_vg_realloc(void *from, unsigned int sz)
|
|
|
|
{
|
|
|
|
void *result;
|
|
|
|
|
|
|
|
result = sz > 0 ? realloc(from, sz) : NULL;
|
|
|
|
if (!result) free(from);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_efl_vg_clean_object(Eo **obj)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
if (*obj) efl_unref(*obj);
|
2015-06-19 02:26:46 -07:00
|
|
|
*obj = NULL;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:31:29 -07:00
|
|
|
#define EFL_VG_COMPUTE_MATRIX(Current, Parent, Nd) \
|
|
|
|
Eina_Matrix3 *Current = Nd->m; \
|
2015-04-16 19:22:48 -07:00
|
|
|
Eina_Matrix3 _matrix_tmp; \
|
2015-04-03 07:31:29 -07:00
|
|
|
\
|
2015-04-03 07:23:03 -07:00
|
|
|
if (Parent) \
|
|
|
|
{ \
|
|
|
|
if (Current) \
|
|
|
|
{ \
|
|
|
|
eina_matrix3_compose(Parent, Current, &_matrix_tmp); \
|
|
|
|
Current = &_matrix_tmp; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
2015-04-16 19:22:48 -07:00
|
|
|
eina_matrix3_identity(&_matrix_tmp); \
|
|
|
|
eina_matrix3_translate(&_matrix_tmp, -(Nd->x), -(Nd->y)); \
|
|
|
|
eina_matrix3_compose(Parent, &_matrix_tmp, &_matrix_tmp); \
|
|
|
|
eina_matrix3_translate(&_matrix_tmp, (Nd->x), (Nd->y)); \
|
2015-04-03 07:31:29 -07:00
|
|
|
Current = &_matrix_tmp; \
|
2015-04-03 07:23:03 -07:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-03 07:12:59 -07:00
|
|
|
#endif
|