ector: add stop implementation.
authorCedric BAIL <cedric@osg.samsung.com>
Fri, 3 Apr 2015 14:21:49 +0000 (16:21 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 3 Apr 2015 14:21:49 +0000 (16:21 +0200)
src/lib/ector/ector_renderer_gradient.c
src/lib/evas/canvas/evas_vg_gradient.c

index 610fb93..d54f365 100644 (file)
 typedef struct _Ector_Renderer_Generic_Gradient_Data 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
@@ -18,6 +22,15 @@ _ector_renderer_gradient_efl_graphics_gradient_stop_set(Eo *obj,
                                                         const Efl_Graphics_Gradient_Stop *colors,
                                                         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
@@ -26,6 +39,8 @@ _ector_renderer_gradient_efl_graphics_gradient_stop_get(Eo *obj,
                                                         const Efl_Graphics_Gradient_Stop **colors,
                                                         unsigned int *length)
 {
+   if (colors) *colors = pd->colors;
+   if (length) *length = pd->colors_count;
 }
 
 void
@@ -33,12 +48,14 @@ _ector_renderer_gradient_efl_graphics_gradient_spread_set(Eo *obj,
                                                           Ector_Renderer_Generic_Gradient_Data *pd,
                                                           Efl_Graphics_Gradient_Spread s)
 {
+   pd->s = s;
 }
 
 Efl_Graphics_Gradient_Spread
 _ector_renderer_gradient_efl_graphics_gradient_spread_get(Eo *obj,
                                                           Ector_Renderer_Generic_Gradient_Data *pd)
 {
+   return pd->s;
 }
 
 
index 72bddf7..28ed579 100644 (file)
@@ -6,7 +6,7 @@
 typedef struct _Evas_VG_Gradient_Data 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;
    unsigned int colors_count;