ector: add stop implementation.

This commit is contained in:
Cedric BAIL 2015-04-03 16:21:49 +02:00
parent 75728e7fff
commit c5d085999a
2 changed files with 18 additions and 1 deletions

View File

@ -10,6 +10,10 @@
typedef struct _Ector_Renderer_Generic_Gradient_Data Ector_Renderer_Generic_Gradient_Data; typedef struct _Ector_Renderer_Generic_Gradient_Data Ector_Renderer_Generic_Gradient_Data;
struct _Ector_Renderer_Generic_Gradient_Data struct _Ector_Renderer_Generic_Gradient_Data
{ {
Efl_Graphics_Gradient_Stop *colors;
unsigned int colors_count;
Efl_Graphics_Gradient_Spread s;
}; };
void void
@ -18,6 +22,15 @@ _ector_renderer_gradient_efl_graphics_gradient_stop_set(Eo *obj,
const Efl_Graphics_Gradient_Stop *colors, const Efl_Graphics_Gradient_Stop *colors,
unsigned int length) unsigned int length)
{ {
pd->colors = realloc(pd->colors, length * sizeof(Efl_Graphics_Gradient_Stop));
if (!pd->colors)
{
pd->colors_count = 0;
return ;
}
memcpy(pd->colors, colors, length * sizeof(Efl_Graphics_Gradient_Stop));
pd->colors_count = length;
} }
void void
@ -26,6 +39,8 @@ _ector_renderer_gradient_efl_graphics_gradient_stop_get(Eo *obj,
const Efl_Graphics_Gradient_Stop **colors, const Efl_Graphics_Gradient_Stop **colors,
unsigned int *length) unsigned int *length)
{ {
if (colors) *colors = pd->colors;
if (length) *length = pd->colors_count;
} }
void void
@ -33,12 +48,14 @@ _ector_renderer_gradient_efl_graphics_gradient_spread_set(Eo *obj,
Ector_Renderer_Generic_Gradient_Data *pd, Ector_Renderer_Generic_Gradient_Data *pd,
Efl_Graphics_Gradient_Spread s) Efl_Graphics_Gradient_Spread s)
{ {
pd->s = s;
} }
Efl_Graphics_Gradient_Spread Efl_Graphics_Gradient_Spread
_ector_renderer_gradient_efl_graphics_gradient_spread_get(Eo *obj, _ector_renderer_gradient_efl_graphics_gradient_spread_get(Eo *obj,
Ector_Renderer_Generic_Gradient_Data *pd) Ector_Renderer_Generic_Gradient_Data *pd)
{ {
return pd->s;
} }

View File

@ -6,7 +6,7 @@
typedef struct _Evas_VG_Gradient_Data Evas_VG_Gradient_Data; typedef struct _Evas_VG_Gradient_Data Evas_VG_Gradient_Data;
struct _Evas_VG_Gradient_Data struct _Evas_VG_Gradient_Data
{ {
// FIXME: Later on we should deduplicate it somehow. // FIXME: Later on we should deduplicate it somehow (Using Ector ?).
Efl_Graphics_Gradient_Stop *colors; Efl_Graphics_Gradient_Stop *colors;
unsigned int colors_count; unsigned int colors_count;