summaryrefslogtreecommitdiff
path: root/src/lib/ector/gl/ector_renderer_gl_gradient_linear.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-11-12 15:52:21 -0800
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 15:43:44 +0900
commit116fe3c65cd541b85623820605e237c4076024f2 (patch)
tree3eb399112740116ea2b3d1dbe75d42a3532d3dae /src/lib/ector/gl/ector_renderer_gl_gradient_linear.c
parent1adc3cd915f9bd55337e37fb782bd1c38080478c (diff)
ector: initial implementation of our own Ector GL backend.
Diffstat (limited to 'src/lib/ector/gl/ector_renderer_gl_gradient_linear.c')
-rw-r--r--src/lib/ector/gl/ector_renderer_gl_gradient_linear.c115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/lib/ector/gl/ector_renderer_gl_gradient_linear.c b/src/lib/ector/gl/ector_renderer_gl_gradient_linear.c
new file mode 100644
index 0000000000..6920ac1ad1
--- /dev/null
+++ b/src/lib/ector/gl/ector_renderer_gl_gradient_linear.c
@@ -0,0 +1,115 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include <Ector.h>
7
8#include "gl/Ector_GL.h"
9#include "ector_private.h"
10#include "ector_gl_private.h"
11
12typedef struct _Ector_Renderer_GL_Gradient_Linear_Data Ector_Renderer_GL_Gradient_Linear_Data;
13struct _Ector_Renderer_GL_Gradient_Linear_Data
14{
15 Ector_Renderer_Generic_Gradient_Linear_Data *linear;
16 Ector_Renderer_Generic_Gradient_Data *gradient;
17 Ector_Renderer_Generic_Base_Data *base;
18};
19
20static Eina_Bool
21_ector_renderer_gl_gradient_linear_ector_renderer_generic_base_prepare(Eo *obj,
22 Ector_Renderer_GL_Gradient_Linear_Data *pd)
23{
24 // FIXME: prepare something
25 (void) obj;
26 (void) pd;
27
28 return EINA_TRUE;
29}
30
31static Eina_Bool
32_ector_renderer_gl_gradient_linear_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd, Efl_Gfx_Render_Op op, Eina_Array *clips, unsigned int mul_col)
33{
34 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS,
35 ector_renderer_draw(op, clips, mul_col));
36
37 // FIXME: draw something !
38 (void) pd;
39
40 return EINA_TRUE;
41}
42
43static void
44_ector_renderer_gl_gradient_linear_ector_renderer_generic_base_bounds_get(Eo *obj EINA_UNUSED,
45 Ector_Renderer_GL_Gradient_Linear_Data *pd,
46 Eina_Rectangle *r)
47{
48 EINA_RECTANGLE_SET(r,
49 pd->base->origin.x + pd->linear->start.x,
50 pd->base->origin.y + pd->linear->start.y,
51 pd->linear->end.x - pd->linear->start.x,
52 pd->linear->end.y - pd->linear->start.y);
53}
54
55static Eina_Bool
56_ector_renderer_gl_gradient_linear_ector_renderer_gl_base_fill(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd, uint64_t flags, GLshort *vertex, unsigned int vertex_count, unsigned int mul_col)
57{
58 // FIXME: The idea here is to select the right shader and push the needed parameter for it
59 // along with the other value
60 (void) obj;
61 (void) pd;
62 (void) flags;
63 (void) vertex;
64 (void) vertex_count;
65 (void) mul_col;
66
67 return EINA_TRUE;
68}
69
70static Eo_Base *
71_ector_renderer_gl_gradient_linear_eo_base_constructor(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd)
72{
73 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS, obj = eo_constructor());
74
75 if (!obj) return NULL;
76
77 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
78 pd->linear = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN, obj);
79 pd->gradient = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj);
80
81 return obj;
82}
83
84static void
85_ector_renderer_gl_gradient_linear_eo_base_destructor(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd)
86{
87 eo_data_xunref(obj, pd->base, obj);
88 eo_data_xunref(obj, pd->linear, obj);
89 eo_data_xunref(obj, pd->gradient, obj);
90}
91
92static void
93_ector_renderer_gl_gradient_linear_efl_gfx_gradient_base_stop_set(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd EINA_UNUSED, const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
94{
95 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS,
96 efl_gfx_gradient_stop_set(colors, length));
97}
98
99static unsigned int
100_ector_renderer_gl_gradient_linear_ector_renderer_generic_base_crc_get(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd)
101{
102 unsigned int crc;
103
104 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS,
105 crc = ector_renderer_crc_get());
106
107 crc = eina_crc((void*) pd->gradient->s, sizeof (Efl_Gfx_Gradient_Spread), crc, EINA_FALSE);
108 if (pd->gradient->colors_count)
109 crc = eina_crc((void*) pd->gradient->colors, sizeof (Efl_Gfx_Gradient_Stop) * pd->gradient->colors_count, crc, EINA_FALSE);
110 crc = eina_crc((void*) pd->linear, sizeof (Ector_Renderer_Generic_Gradient_Linear_Data), crc, EINA_FALSE);
111
112 return crc;
113}
114
115#include "ector_renderer_gl_gradient_linear.eo.c"