summaryrefslogtreecommitdiff
path: root/src/lib/ector/ector_private.h
blob: 013b1de9be4124475d552c6c5877385a9e3335da (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#ifndef ECTOR_PRIVATE_H_
#define ECTOR_PRIVATE_H_

#include "Ector.h"

#include "ector_gl_internal.h"

/*
 * variable and macros used for the eina_log module
 */
extern int _ector_log_dom_global;

/*
 * Macros that are used everywhere
 *
 * the first four macros are the general macros for the lib
 */
#ifdef ECTOR_DEFAULT_LOG_COLOR
# undef ECTOR_DEFAULT_LOG_COLOR
#endif /* ifdef ECTOR_DEFAULT_LOG_COLOR */
#define ECTOR_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
#ifdef ERR
# undef ERR
#endif /* ifdef ERR */
#define ERR(...)  EINA_LOG_DOM_ERR(_ector_log_dom_global, __VA_ARGS__)
#ifdef DBG
# undef DBG
#endif /* ifdef DBG */
#define DBG(...)  EINA_LOG_DOM_DBG(_ector_log_dom_global, __VA_ARGS__)
#ifdef INF
# undef INF
#endif /* ifdef INF */
#define INF(...)  EINA_LOG_DOM_INFO(_ector_log_dom_global, __VA_ARGS__)
#ifdef WRN
# undef WRN
#endif /* ifdef WRN */
#define WRN(...)  EINA_LOG_DOM_WARN(_ector_log_dom_global, __VA_ARGS__)
#ifdef CRI
# undef CRI
#endif /* ifdef CRI */
#define CRI(...) EINA_LOG_DOM_CRIT(_ector_log_dom_global, __VA_ARGS__)

/* The following macro are internal to Ector only at this stage */

static inline Eo *
_eo_refplace(Eo **d, const Eo *s)
{
   Eo *tmp = *d;
   *d = eo_ref(s);
   if (tmp) eo_unref(tmp);
   return *d;
}

static inline Eo *
_eo_xrefplace(Eo **d, Eo *s, const Eo *ref_obj)
{
   Eo *tmp = *d;
   *d = eo_xref(s, ref_obj);
   if (tmp) eo_xunref(tmp, ref_obj);
   return *d;
}

typedef struct _Ector_Renderer_Generic_Base_Data Ector_Renderer_Generic_Base_Data;
typedef struct _Ector_Renderer_Generic_Gradient_Data Ector_Renderer_Generic_Gradient_Data;
typedef struct _Ector_Renderer_Generic_Gradient_Linear_Data Ector_Renderer_Generic_Gradient_Linear_Data;
typedef struct _Ector_Renderer_Generic_Gradient_Radial_Data Ector_Renderer_Generic_Gradient_Radial_Data;
typedef struct _Ector_Renderer_Generic_Shape_Data Ector_Renderer_Generic_Shape_Data;
typedef struct _Ector_Renderer_Generic_Buffer_Data Ector_Renderer_Generic_Buffer_Data;

struct _Ector_Renderer_Generic_Base_Data
{
   Ector_Generic_Surface *surface;
   Eina_Matrix3 *m;

   struct {
      double x;
      double y;
   } origin;

   struct {
      int r, g, b, a;
   } color;

   Ector_Renderer *mask;

   Ector_Quality q;
   Eina_Bool visibility : 1;
   Eina_Bool finalized : 1;
};

struct _Ector_Renderer_Generic_Gradient_Data
{
   Efl_Gfx_Gradient_Stop *colors;
   unsigned int colors_count;

   Efl_Gfx_Gradient_Spread s;
};

struct _Ector_Renderer_Generic_Gradient_Linear_Data
{
   struct {
      double x, y;
   } start, end;
};

struct _Ector_Renderer_Generic_Gradient_Radial_Data
{
   struct {
      double x, y;
   } radial, focal;
   double radius;
};

struct _Ector_Renderer_Generic_Shape_Data
{
   Ector_Renderer *fill;
   struct {
      Ector_Renderer *fill;
      Ector_Renderer *marker;
   } stroke;
};

struct _Ector_Renderer_Generic_Buffer_Data
{
   Ector_Buffer *eo_buffer;
   struct {
      Efl_Gfx_Fill_Spread spread;
      int x, y, w, h;
   } fill;
};

static inline unsigned int
_renderer_crc_get(Eo *obj, unsigned int crc)
{
   unsigned int id;

   id = ector_renderer_crc_get(obj);
   crc = eina_crc((void*) &id, sizeof (id), crc, EINA_FALSE);
   return crc;
}

#include "ector_buffer.h"

#endif