summaryrefslogtreecommitdiff
path: root/src/lib/ector/gl/ector_renderer_gl_gradient_linear.c
blob: 5bff84437e2c6c5277455c803b318bd1ff67c85e (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
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <Eina.h>
#include <Ector.h>

#include "gl/Ector_GL.h"
#include "ector_private.h"
#include "ector_gl_private.h"

typedef struct _Ector_Renderer_GL_Gradient_Linear_Data Ector_Renderer_GL_Gradient_Linear_Data;
struct _Ector_Renderer_GL_Gradient_Linear_Data
{
   Ector_Renderer_Generic_Gradient_Linear_Data *linear;
   Ector_Renderer_Generic_Gradient_Data *gradient;
   Ector_Renderer_Generic_Base_Data *base;
};

static Eina_Bool
_ector_renderer_gl_gradient_linear_ector_renderer_generic_base_prepare(Eo *obj,
                                                                       Ector_Renderer_GL_Gradient_Linear_Data *pd)
{
   // FIXME: prepare something
   (void) obj;
   (void) pd;

   return EINA_TRUE;
}

static Eina_Bool
_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)
{
   ector_renderer_draw(eo_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS), op, clips, mul_col);

   // FIXME: draw something !
   (void) pd;

   return EINA_TRUE;
}

static void
_ector_renderer_gl_gradient_linear_ector_renderer_generic_base_bounds_get(Eo *obj EINA_UNUSED,
                                                                          Ector_Renderer_GL_Gradient_Linear_Data *pd,
                                                                          Eina_Rectangle *r)
{
   EINA_RECTANGLE_SET(r,
                      pd->base->origin.x + pd->linear->start.x,
                      pd->base->origin.y + pd->linear->start.y,
                      pd->linear->end.x - pd->linear->start.x,
                      pd->linear->end.y - pd->linear->start.y);
}

static Eina_Bool
_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)
{
   // FIXME: The idea here is to select the right shader and push the needed parameter for it
   // along with the other value
   (void) obj;
   (void) pd;
   (void) flags;
   (void) vertex;
   (void) vertex_count;
   (void) mul_col;

   return EINA_TRUE;
}

static Eo_Base *
_ector_renderer_gl_gradient_linear_eo_base_constructor(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd)
{
   obj = eo_constructor(eo_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS));

   if (!obj) return NULL;

   pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
   pd->linear = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN, obj);
   pd->gradient = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj);

   return obj;
}

static void
_ector_renderer_gl_gradient_linear_eo_base_destructor(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd)
{
   eo_data_xunref(obj, pd->base, obj);
   eo_data_xunref(obj, pd->linear, obj);
   eo_data_xunref(obj, pd->gradient, obj);
}

static void
_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)
{
   efl_gfx_gradient_stop_set(eo_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS), colors, length);
}

static unsigned int
_ector_renderer_gl_gradient_linear_ector_renderer_generic_base_crc_get(Eo *obj, Ector_Renderer_GL_Gradient_Linear_Data *pd)
{
   unsigned int crc;

   crc = ector_renderer_crc_get(eo_super(obj, ECTOR_RENDERER_GL_GRADIENT_LINEAR_CLASS));

   crc = eina_crc((void*) pd->gradient->s, sizeof (Efl_Gfx_Gradient_Spread), crc, EINA_FALSE);
   if (pd->gradient->colors_count)
     crc = eina_crc((void*) pd->gradient->colors, sizeof (Efl_Gfx_Gradient_Stop) * pd->gradient->colors_count, crc, EINA_FALSE);
   crc = eina_crc((void*) pd->linear, sizeof (Ector_Renderer_Generic_Gradient_Linear_Data), crc, EINA_FALSE);

   return crc;
}

#include "ector_renderer_gl_gradient_linear.eo.c"