summaryrefslogtreecommitdiff
path: root/src/lib/ector/gl/ector_renderer_gl_gradient_radial.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_radial.c
parent1adc3cd915f9bd55337e37fb782bd1c38080478c (diff)
ector: initial implementation of our own Ector GL backend.
Diffstat (limited to 'src/lib/ector/gl/ector_renderer_gl_gradient_radial.c')
-rw-r--r--src/lib/ector/gl/ector_renderer_gl_gradient_radial.c113
1 files changed, 113 insertions, 0 deletions
diff --git a/src/lib/ector/gl/ector_renderer_gl_gradient_radial.c b/src/lib/ector/gl/ector_renderer_gl_gradient_radial.c
new file mode 100644
index 0000000000..9d7d65c886
--- /dev/null
+++ b/src/lib/ector/gl/ector_renderer_gl_gradient_radial.c
@@ -0,0 +1,113 @@
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_Radial_Data Ector_Renderer_GL_Gradient_Radial_Data;
13struct _Ector_Renderer_GL_Gradient_Radial_Data
14{
15 Ector_Renderer_Generic_Gradient_Radial_Data *radial;
16 Ector_Renderer_Generic_Gradient_Data *gradient;
17 Ector_Renderer_Generic_Base_Data *base;
18};
19
20static Eina_Bool
21_ector_renderer_gl_gradient_radial_ector_renderer_generic_base_prepare(Eo *obj, Ector_Renderer_GL_Gradient_Radial_Data *pd)
22{
23 // FIXME: prepare something
24 (void) obj;
25 (void) pd;
26
27 return EINA_TRUE;
28}
29
30static Eina_Bool
31_ector_renderer_gl_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_GL_Gradient_Radial_Data *pd, Efl_Gfx_Render_Op op, Eina_Array *clips, unsigned int mul_col)
32{
33 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_RADIAL_CLASS,
34 ector_renderer_draw(op, clips, mul_col));
35
36 // FIXME: draw something !
37 (void) pd;
38
39 return EINA_TRUE;
40}
41
42static Eina_Bool
43_ector_renderer_gl_gradient_radial_ector_renderer_gl_base_fill(Eo *obj, Ector_Renderer_GL_Gradient_Radial_Data *pd, uint64_t flags, GLshort *vertex, unsigned int vertex_count, unsigned int mul_col)
44{
45 // FIXME: The idea here is to select the right shader and push the needed parameter for it
46 // along with the other value
47 (void) obj;
48 (void) pd;
49 (void) flags;
50 (void) vertex;
51 (void) vertex_count;
52 (void) mul_col;
53
54 return EINA_TRUE;
55}
56
57static void
58_ector_renderer_gl_gradient_radial_ector_renderer_generic_base_bounds_get(Eo *obj EINA_UNUSED,
59 Ector_Renderer_GL_Gradient_Radial_Data *pd,
60 Eina_Rectangle *r)
61{
62 EINA_RECTANGLE_SET(r,
63 pd->base->origin.x + pd->radial->radial.x - pd->radial->radius,
64 pd->base->origin.y + pd->radial->radial.y - pd->radial->radius,
65 pd->radial->radius * 2, pd->radial->radius * 2 );
66}
67
68static unsigned int
69_ector_renderer_gl_gradient_radial_ector_renderer_generic_base_crc_get(Eo *obj, Ector_Renderer_GL_Gradient_Radial_Data *pd)
70{
71 unsigned int crc;
72
73 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_RADIAL_CLASS,
74 crc = ector_renderer_crc_get());
75
76 crc = eina_crc((void*) pd->gradient->s, sizeof (Efl_Gfx_Gradient_Spread), crc, EINA_FALSE);
77 if (pd->gradient->colors_count)
78 crc = eina_crc((void*) pd->gradient->colors, sizeof (Efl_Gfx_Gradient_Stop) * pd->gradient->colors_count, crc, EINA_FALSE);
79 crc = eina_crc((void*) pd->radial, sizeof (Ector_Renderer_Generic_Gradient_Radial_Data), crc, EINA_FALSE);
80
81 return crc;
82}
83
84static Eo_Base *
85_ector_renderer_gl_gradient_radial_eo_base_constructor(Eo *obj, Ector_Renderer_GL_Gradient_Radial_Data *pd)
86{
87 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_RADIAL_CLASS, obj = eo_constructor());
88
89 if (!obj) return NULL;
90
91 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
92 pd->radial = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN, obj);
93 pd->gradient = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj);
94
95 return obj;
96}
97
98static void
99_ector_renderer_gl_gradient_radial_eo_base_destructor(Eo *obj, Ector_Renderer_GL_Gradient_Radial_Data *pd)
100{
101 eo_data_xunref(obj, pd->base, obj);
102 eo_data_xunref(obj, pd->radial, obj);
103 eo_data_xunref(obj, pd->gradient, obj);
104}
105
106static void
107_ector_renderer_gl_gradient_radial_efl_gfx_gradient_base_stop_set(Eo *obj, Ector_Renderer_GL_Gradient_Radial_Data *pd EINA_UNUSED, const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
108{
109 eo_do_super(obj, ECTOR_RENDERER_GL_GRADIENT_RADIAL_CLASS,
110 efl_gfx_gradient_stop_set(colors, length));
111}
112
113#include "ector_renderer_gl_gradient_radial.eo.c"