ector: update cairo enum definitions and fix gradient spread issue.
authorSubhransu Mohanty <sub.mohanty@samsung.com>
Fri, 3 Apr 2015 14:38:19 +0000 (16:38 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 3 Apr 2015 14:38:19 +0000 (16:38 +0200)
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/ector/cairo/ector_cairo_private.h
src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
src/lib/ector/cairo/ector_renderer_cairo_shape.c

index 486f9addd89f8fd68884e571339febd822d7387a..b5782ffafc9f365796cb8f336fbc844c8f7e5401 100644 (file)
@@ -30,6 +30,29 @@ struct _Ector_Renderer_Cairo_Base_Data
    cairo_matrix_t *m;
 };
 
+typedef enum _cairo_extend {
+    CAIRO_EXTEND_NONE,
+    CAIRO_EXTEND_REPEAT,
+    CAIRO_EXTEND_REFLECT,
+    CAIRO_EXTEND_PAD
+} cairo_extend_t;
+
+static inline cairo_extend_t
+_ector_cairo_extent_get(Efl_Gfx_Gradient_Spread s)
+{
+   switch (s)
+     {
+       case EFL_GFX_GRADIENT_SPREAD_PAD:
+          return CAIRO_EXTEND_PAD;
+       case EFL_GFX_GRADIENT_SPREAD_REFLECT:
+          return CAIRO_EXTEND_REFLECT;
+       case EFL_GFX_GRADIENT_SPREAD_REPEAT:
+          return CAIRO_EXTEND_REPEAT;
+       default:
+          return CAIRO_EXTEND_NONE;
+     }
+}
+
 #define CHECK_CAIRO(Parent) (!(Parent && Parent->cairo))
 
 #define USE(Obj, Sym, Error)                            \
index 4fb05ceae9066b8f24aa5b2f5235f3d29a375683..15b4e42c313393b434a39c620eb1d4605b2e89f9 100644 (file)
@@ -20,7 +20,6 @@ static void (*cairo_pattern_add_color_stop_rgba)(cairo_pattern_t *pattern, doubl
                                                  double red, double green, double blue, double alpha) = NULL;
 static void (*cairo_pattern_destroy)(cairo_pattern_t *pattern) = NULL;
 
-typedef enum _cairo_extend_t{cairo_extend}cairo_extend_t;
 static void (*cairo_pattern_set_extend)(cairo_pattern_t *pattern, cairo_extend_t extend) = NULL;
 
 typedef struct _Ector_Renderer_Cairo_Gradient_Linear_Data Ector_Renderer_Cairo_Gradient_Linear_Data;
@@ -63,7 +62,7 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_prepare(Eo *ob
      }
 
    USE(obj, cairo_pattern_set_extend, EINA_FALSE);
-   cairo_pattern_set_extend(pd->pat, gd->s);
+   cairo_pattern_set_extend(pd->pat, _ector_cairo_extent_get(gd->s));
 
    if (!pd->parent)
      {
index f3332c76db465737ac28049b9d683d35146e23e0..34a6d707f5662630f0e05bf6c6fc1eecdb1cc2d1 100644 (file)
@@ -23,7 +23,6 @@ static void (*cairo_pattern_add_color_stop_rgba)(cairo_pattern_t *pattern, doubl
                                                  double red, double green, double blue, double alpha) = NULL;
 static void (*cairo_pattern_destroy)(cairo_pattern_t *pattern) = NULL;
 
-typedef enum _cairo_extend_t{cairo_extend}cairo_extend_t;
 static void (*cairo_pattern_set_extend)(cairo_pattern_t *pattern, cairo_extend_t extend) = NULL;
 
 // FIXME: as long as it is not possible to directly access the parent structure
@@ -68,7 +67,7 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_prepare(Eo *ob
      }
 
    USE(obj, cairo_pattern_set_extend, EINA_FALSE);
-   cairo_pattern_set_extend(pd->pat, gd->s);
+   cairo_pattern_set_extend(pd->pat, _ector_cairo_extent_get(gd->s));
 
    if (!pd->parent)
      {
index 523bd7ed5770abd04f12254794dbc937394d903d..de6aa6d18424b0f92cd5019a093be2d0c1946a87 100644 (file)
 
 typedef struct _cairo_path_t cairo_path_t;
 
+typedef enum _cairo_line_cap {
+  CAIRO_LINE_CAP_BUTT,
+  CAIRO_LINE_CAP_ROUND,
+  CAIRO_LINE_CAP_SQUARE
+} cairo_line_cap_t;
+
+typedef enum _cairo_line_join {
+  CAIRO_LINE_JOIN_MITER,
+  CAIRO_LINE_JOIN_ROUND,
+  CAIRO_LINE_JOIN_BEVEL
+} cairo_line_join_t;
+
 static void (*cairo_move_to)(cairo_t *cr, double x, double y) = NULL;
 static void (*cairo_line_to)(cairo_t *cr, double x, double y) = NULL;
 static void (*cairo_curve_to)(cairo_t *cr,
@@ -36,8 +48,6 @@ static void (*cairo_path_destroy)(cairo_path_t *path) = NULL;
 static void (*cairo_new_path)(cairo_t *cr) = NULL;
 static void (*cairo_append_path)(cairo_t *cr, const cairo_path_t *path) = NULL;
 
-typedef enum _cairo_line_cap_t{lie_cap}cairo_line_cap_t;
-typedef enum _cairo_line_join_t{line_join}cairo_line_join_t;
 static void (*cairo_set_line_width)(cairo_t *cr, double width) = NULL;
 static void (*cairo_set_line_cap)(cairo_t *cr, cairo_line_cap_t line_cap) = NULL;
 static void (*cairo_set_line_join)(cairo_t *cr, cairo_line_join_t line_join) = NULL;