ector: don't use parent relationship to get access to the surface for freetype backend.
authorCedric BAIL <cedric@osg.samsung.com>
Tue, 17 Nov 2015 00:20:22 +0000 (01:20 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Thu, 19 Nov 2015 13:52:10 +0000 (14:52 +0100)
src/lib/ector/software/ector_renderer_software_gradient_linear.c
src/lib/ector/software/ector_renderer_software_gradient_radial.c
src/lib/ector/software/ector_renderer_software_shape.c
src/lib/ector/software/ector_software_surface.c

index f0ab0c5..da59688 100644 (file)
@@ -15,11 +15,10 @@ _ector_renderer_software_gradient_linear_ector_renderer_generic_base_prepare(Eo
 {
    if (!pd->surface)
      {
-        Eo *parent;
+        Ector_Renderer_Generic_Base_Data *base;
 
-        eo_do(obj, parent = eo_parent_get());
-        if (!parent) return EINA_FALSE;
-        pd->surface = eo_data_xref(parent, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
+        base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
+        pd->surface = eo_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
      }
 
    update_color_table(pd);
@@ -63,27 +62,29 @@ _ector_renderer_software_gradient_linear_ector_renderer_software_base_fill(Eo *o
    return EINA_TRUE;
 }
 
-Eo *
+static Eo *
 _ector_renderer_software_gradient_linear_eo_base_constructor(Eo *obj,
                                                              Ector_Renderer_Software_Gradient_Data *pd)
 {
    obj = eo_do_super_ret(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS, obj, eo_constructor());
+   if (!obj) return NULL;
+
    pd->gd  = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj);
    pd->gld = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN, obj);
 
    return obj;
 }
 
-void
+static void
 _ector_renderer_software_gradient_linear_eo_base_destructor(Eo *obj,
                                                             Ector_Renderer_Software_Gradient_Data *pd)
 {
-   Eo *parent;
+   Ector_Renderer_Generic_Base_Data *base;
 
    destroy_color_table(pd);
 
-   eo_do(obj, parent = eo_parent_get());
-   eo_data_xunref(parent, pd->surface, obj);
+   base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
+   eo_data_xunref(base->surface, pd->surface, obj);
 
    eo_data_xunref(obj, pd->gd, obj);
    eo_data_xunref(obj, pd->gld, obj);
index a732935..2c77b96 100644 (file)
@@ -14,11 +14,10 @@ _ector_renderer_software_gradient_radial_ector_renderer_generic_base_prepare(Eo
 {
    if (!pd->surface)
      {
-        Eo *parent;
+        Ector_Renderer_Generic_Base_Data *base;
 
-        eo_do(obj, parent = eo_parent_get());
-        if (!parent) return EINA_FALSE;
-        pd->surface = eo_data_xref(parent, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
+        base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
+        pd->surface = eo_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
      }
 
    update_color_table(pd);
@@ -88,12 +87,12 @@ void
 _ector_renderer_software_gradient_radial_eo_base_destructor(Eo *obj,
                                                             Ector_Renderer_Software_Gradient_Data *pd)
 {
-   Eo *parent;
+   Ector_Renderer_Generic_Base_Data *base;
 
    destroy_color_table(pd);
 
-   eo_do(obj, parent = eo_parent_get());
-   eo_data_xunref(parent, pd->surface, obj);
+   base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
+   eo_data_xunref(base->surface, pd->surface, obj);
 
    eo_data_xunref(obj, pd->gd, obj);
    eo_data_xunref(obj, pd->gld, obj);
index acbc5fa..0cbc9ee 100644 (file)
@@ -578,12 +578,12 @@ _ector_renderer_software_shape_ector_renderer_generic_base_prepare(Eo *obj,
    // shouldn't that be moved to the software base object
    if (!pd->surface)
      {
-        Eo *parent;
-        eo_do(obj, parent = eo_parent_get());
-        if (!parent) return EINA_FALSE;
-        pd->surface = eo_data_xref(parent, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
-        if (!pd->surface) return EINA_FALSE;
+        Ector_Renderer_Generic_Base_Data *base;
+
+        base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
+        pd->surface = eo_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
      }
+
    return EINA_TRUE;
 }
 
@@ -693,10 +693,12 @@ _ector_renderer_software_shape_path_changed(void *data, Eo *obj EINA_UNUSED,
    return EINA_TRUE;
 }
 
-Eo *
+static Eo *
 _ector_renderer_software_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd)
 {
-   obj = eo_do_super_ret(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, obj, eo_constructor());
+   eo_do_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, obj = eo_constructor());
+   if (!obj) return NULL;
+
    pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj);
    pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
    eo_do(obj,
@@ -705,10 +707,11 @@ _ector_renderer_software_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Softw
    return obj;
 }
 
-void
+static void
 _ector_renderer_software_shape_eo_base_destructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd)
 {
-   Eo *parent;
+   Ector_Renderer_Generic_Base_Data *base;
+
    //FIXME, As base class  destructor can't call destructor of mixin class.
    // call explicit API to free shape data.
    eo_do(obj, efl_gfx_shape_reset());
@@ -716,8 +719,8 @@ _ector_renderer_software_shape_eo_base_destructor(Eo *obj, Ector_Renderer_Softwa
    if (pd->shape_data) ector_software_rasterizer_destroy_rle_data(pd->shape_data);
    if (pd->outline_data) ector_software_rasterizer_destroy_rle_data(pd->outline_data);
 
-   eo_do(obj, parent = eo_parent_get());
-   eo_data_xunref(parent, pd->surface, obj);
+   base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
+   eo_data_xunref(base->surface, pd->surface, obj);
 
    eo_data_xunref(obj, pd->shape, obj);
    eo_data_xunref(obj, pd->base, obj);
index 0391150..0422920 100644 (file)
@@ -19,11 +19,14 @@ _ector_software_surface_ector_generic_surface_renderer_factory_new(Eo *obj,
                                                                    const Eo_Class *type)
 {
    if (type == ECTOR_RENDERER_GENERIC_SHAPE_MIXIN)
-     return eo_add(ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, obj);
+     return eo_add(ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, NULL,
+                   ector_renderer_surface_set(obj));
    else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN)
-     return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS, obj);
+     return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS, NULL,
+                   ector_renderer_surface_set(obj));
    else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN)
-     return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS, obj);
+     return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS, NULL,
+                   ector_renderer_surface_set(obj));
    ERR("Couldn't find class for type: %s\n", eo_class_name_get(type));
    return NULL;
 }