summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-05-19 11:41:27 +0100
committerTom Hacohen <tom@stosb.com>2015-05-20 13:03:24 +0100
commit6efbfe227aaaa24eda7bcb7df916d4daf0a74400 (patch)
treec96e166b7348c5e825aca2d4af084675172e0cec /src/lib/ector
parente7ed0bfcedcea87f8645107a8a0775f67227d7c1 (diff)
Eo: Add a return value to eo_constructor().
From now on, constructors should return a value, usually the object being worked on, or NULL (if the constructor failed). This can also be used for implementing singletons, by just always returning the same object from the constructor. This is one of the final steps towards stabilizing Eo. @feature
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/cairo/ector_cairo_surface.c6
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_base.c8
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_shape.c6
-rw-r--r--src/lib/ector/software/ector_renderer_software_gradient_linear.c6
-rw-r--r--src/lib/ector/software/ector_renderer_software_gradient_radial.c6
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.c6
-rw-r--r--src/lib/ector/software/ector_software_surface.c6
7 files changed, 29 insertions, 15 deletions
diff --git a/src/lib/ector/cairo/ector_cairo_surface.c b/src/lib/ector/cairo/ector_cairo_surface.c
index 377fbbd0ca..10fef6560e 100644
--- a/src/lib/ector/cairo/ector_cairo_surface.c
+++ b/src/lib/ector/cairo/ector_cairo_surface.c
@@ -121,14 +121,16 @@ _ector_cairo_surface_ector_generic_surface_reference_point_set(Eo *obj EINA_UNUS
121 pd->current.y = y; 121 pd->current.y = y;
122} 122}
123 123
124static void 124static Eo *
125_ector_cairo_surface_eo_base_constructor(Eo *obj, 125_ector_cairo_surface_eo_base_constructor(Eo *obj,
126 Ector_Cairo_Surface_Data *pd) 126 Ector_Cairo_Surface_Data *pd)
127{ 127{
128 eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, eo_constructor()); 128 obj = eo_do_super_ret(obj, ECTOR_CAIRO_SURFACE_CLASS, obj, eo_constructor());
129 _cairo_count++; 129 _cairo_count++;
130 130
131 _ector_cairo_surface_context_set(obj, pd, NULL); 131 _ector_cairo_surface_context_set(obj, pd, NULL);
132
133 return obj;
132} 134}
133 135
134static void 136static void
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_base.c b/src/lib/ector/cairo/ector_renderer_cairo_base.c
index 1580b4e597..5bf0f88e58 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_base.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_base.c
@@ -190,16 +190,18 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
190 return EINA_TRUE; 190 return EINA_TRUE;
191} 191}
192 192
193static void 193static Eo *
194_ector_renderer_cairo_base_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Base_Data *pd EINA_UNUSED) 194_ector_renderer_cairo_base_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Base_Data *pd EINA_UNUSED)
195{ 195{
196 eo_do_super(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, eo_constructor()); 196 obj = eo_do_super_ret(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, obj, eo_constructor());
197 197
198 pd->generic = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj); 198 pd->generic = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
199 199
200 USE(obj, cairo_matrix_init_identity, ); 200 USE(obj, cairo_matrix_init_identity, NULL);
201 201
202 cairo_matrix_init_identity(&identity); 202 cairo_matrix_init_identity(&identity);
203
204 return obj;
203} 205}
204 206
205static void 207static void
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
index 2b79e8bb15..b3923e97e2 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
@@ -244,15 +244,17 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_bounds_get(Eo *obj,
244 r->y += bd->generic->origin.y; 244 r->y += bd->generic->origin.y;
245} 245}
246 246
247void 247Eo *
248_ector_renderer_cairo_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd) 248_ector_renderer_cairo_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd)
249{ 249{
250 eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, eo_constructor()); 250 obj = eo_do_super_ret(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj, eo_constructor());
251 pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj); 251 pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj);
252 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj); 252 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
253 253
254 eo_do(obj, 254 eo_do(obj,
255 eo_event_callback_add(EFL_GFX_PATH_CHANGED, _ector_renderer_cairo_shape_path_changed, pd)); 255 eo_event_callback_add(EFL_GFX_PATH_CHANGED, _ector_renderer_cairo_shape_path_changed, pd));
256
257 return obj;
256} 258}
257 259
258void 260void
diff --git a/src/lib/ector/software/ector_renderer_software_gradient_linear.c b/src/lib/ector/software/ector_renderer_software_gradient_linear.c
index a6e32b008b..f2ca832cdc 100644
--- a/src/lib/ector/software/ector_renderer_software_gradient_linear.c
+++ b/src/lib/ector/software/ector_renderer_software_gradient_linear.c
@@ -71,13 +71,15 @@ _ector_renderer_software_gradient_linear_ector_renderer_software_base_fill(Eo *o
71 return EINA_TRUE; 71 return EINA_TRUE;
72} 72}
73 73
74void 74Eo *
75_ector_renderer_software_gradient_linear_eo_base_constructor(Eo *obj, 75_ector_renderer_software_gradient_linear_eo_base_constructor(Eo *obj,
76 Ector_Renderer_Software_Gradient_Data *pd) 76 Ector_Renderer_Software_Gradient_Data *pd)
77{ 77{
78 eo_do_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS, eo_constructor()); 78 obj = eo_do_super_ret(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS, obj, eo_constructor());
79 pd->gd = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj); 79 pd->gd = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj);
80 pd->gld = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN, obj); 80 pd->gld = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN, obj);
81
82 return obj;
81} 83}
82 84
83void 85void
diff --git a/src/lib/ector/software/ector_renderer_software_gradient_radial.c b/src/lib/ector/software/ector_renderer_software_gradient_radial.c
index a05b4874f4..5b63f957be 100644
--- a/src/lib/ector/software/ector_renderer_software_gradient_radial.c
+++ b/src/lib/ector/software/ector_renderer_software_gradient_radial.c
@@ -79,13 +79,15 @@ _ector_renderer_software_gradient_radial_ector_renderer_software_base_fill(Eo *o
79 return EINA_TRUE; 79 return EINA_TRUE;
80} 80}
81 81
82void 82Eo *
83_ector_renderer_software_gradient_radial_eo_base_constructor(Eo *obj, 83_ector_renderer_software_gradient_radial_eo_base_constructor(Eo *obj,
84 Ector_Renderer_Software_Gradient_Data *pd) 84 Ector_Renderer_Software_Gradient_Data *pd)
85{ 85{
86 eo_do_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS, eo_constructor()); 86 obj = eo_do_super_ret(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS, obj, eo_constructor());
87 pd->gd = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj); 87 pd->gd = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN, obj);
88 pd->gld = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN, obj); 88 pd->gld = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN, obj);
89
90 return obj;
89} 91}
90 92
91void 93void
diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c
index 2e4fbea5aa..a91b80eb3b 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.c
+++ b/src/lib/ector/software/ector_renderer_software_shape.c
@@ -362,14 +362,16 @@ _ector_renderer_software_shape_path_changed(void *data, Eo *obj EINA_UNUSED, con
362 return EINA_TRUE; 362 return EINA_TRUE;
363} 363}
364 364
365void 365Eo *
366_ector_renderer_software_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd) 366_ector_renderer_software_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd)
367{ 367{
368 eo_do_super(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, eo_constructor()); 368 obj = eo_do_super_ret(obj, ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, obj, eo_constructor());
369 pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj); 369 pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj);
370 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj); 370 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
371 eo_do(obj, 371 eo_do(obj,
372 eo_event_callback_add(EFL_GFX_PATH_CHANGED, _ector_renderer_software_shape_path_changed, pd)); 372 eo_event_callback_add(EFL_GFX_PATH_CHANGED, _ector_renderer_software_shape_path_changed, pd));
373
374 return obj;
373} 375}
374 376
375void 377void
diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c
index 02d93c39df..a5583028e6 100644
--- a/src/lib/ector/software/ector_software_surface.c
+++ b/src/lib/ector/software/ector_software_surface.c
@@ -65,17 +65,19 @@ _ector_software_surface_surface_get(Eo *obj EINA_UNUSED,
65 *height = pd->software->fill_data.raster_buffer.height; 65 *height = pd->software->fill_data.raster_buffer.height;
66} 66}
67 67
68static void 68static Eo *
69_ector_software_surface_eo_base_constructor(Eo *obj, 69_ector_software_surface_eo_base_constructor(Eo *obj,
70 Ector_Software_Surface_Data *pd EINA_UNUSED) 70 Ector_Software_Surface_Data *pd EINA_UNUSED)
71{ 71{
72 eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_constructor()); 72 obj = eo_do_super_ret(obj, ECTOR_SOFTWARE_SURFACE_CLASS, obj, eo_constructor());
73 if(_software_count == 0) 73 if(_software_count == 0)
74 { 74 {
75 pd->software = (Software_Rasterizer *) calloc(1, sizeof(Software_Rasterizer)); 75 pd->software = (Software_Rasterizer *) calloc(1, sizeof(Software_Rasterizer));
76 ector_software_rasterizer_init(pd->software); 76 ector_software_rasterizer_init(pd->software);
77 } 77 }
78 _software_count++; 78 _software_count++;
79
80 return obj;
79} 81}
80 82
81static void 83static void