aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_vg_private.h
blob: 1c7d516615300b135090236a3a886e0f10b5ae85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef EVAS_VG_PRIVATE_H_
# define EVAS_VG_PRIVATE_H_

#include <Ector.h>

typedef struct _Evas_VG_Node_Data Evas_VG_Node_Data;
typedef struct _Evas_VG_Container_Data Evas_VG_Container_Data;
typedef struct _Evas_VG_Gradient_Data Evas_VG_Gradient_Data;

struct _Evas_VG_Node_Data
{
   Eina_Matrix3 *m;
   Evas_VG_Node *mask;
   Ector_Renderer *renderer;

   void (*render_pre)(Eo *obj, Eina_Matrix3 *parent, Ector_Surface *s, void *data, Evas_VG_Node_Data *nd);
   void *data;

   double x, y;
   int r, g, b, a;

   Eina_Bool visibility : 1;
   Eina_Bool changed : 1;
};

struct _Evas_VG_Container_Data
{
   Eina_List *children;
};

struct _Evas_VG_Gradient_Data
{
   // FIXME: Later on we should deduplicate it somehow (Using Ector ?).
   Efl_Gfx_Gradient_Stop *colors;
   unsigned int colors_count;

   Efl_Gfx_Gradient_Spread s;
};

static inline Evas_VG_Node_Data *
_evas_vg_render_pre(Evas_VG_Node *child, Ector_Surface *s, Eina_Matrix3 *m)
{
   Evas_VG_Node_Data *child_nd = NULL;

   // FIXME: Prevent infinite loop
   if (child)
     child_nd = eo_data_scope_get(child, EVAS_VG_NODE_CLASS);
   if (child_nd)
     child_nd->render_pre(child, m, s, child_nd->data, child_nd);

   return child_nd;
}

static inline void
_evas_vg_node_changed(Eo *obj)
{
   eo_do(obj, eo_event_callback_call(EFL_GFX_CHANGED, NULL));
}

#define EVAS_VG_COMPUTE_MATRIX(Current, Parent, Nd)              \
  Eina_Matrix3 *Current = Nd->m;                                 \
  Eina_Matrix3 _matrix_tmp;                                      \
                                                                 \
  if (Parent)                                                           \
    {                                                                   \
       if (Current)                                                     \
         {                                                              \
            eina_matrix3_compose(Parent, Current, &_matrix_tmp);        \
            Current = &_matrix_tmp;                                     \
         }                                                              \
       else                                                             \
         {                                                              \
            Current = Parent;                                           \
         }                                                              \
    }


#endif