summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_canvas_surface_tbm.c
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2018-12-18 11:17:12 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2018-12-18 11:17:12 +0900
commit7a5589b14a97ccd2db1511f38e368f07236f31e2 (patch)
treec108692fc3f615b465ef4c36431cc462a11110e4 /src/lib/evas/canvas/efl_canvas_surface_tbm.c
parent4a4d32b60df31e25f2ad406c19324592fc69669a (diff)
efl_canvas_surface: change mixin to abstract
Summary: If Efl.Canvas.Surface is changed from mixin to abstract, then its sub classes do not need to inherit from Efl.Object to be a class. Moreover, Efl.Canvas.Surface's data can be derived to its sub classes easily. Reviewers: jpeg, segfaultxavi, woohyun, Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7411
Diffstat (limited to 'src/lib/evas/canvas/efl_canvas_surface_tbm.c')
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_tbm.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_surface_tbm.c b/src/lib/evas/canvas/efl_canvas_surface_tbm.c
index 33ed98e2bf..a0524e48e9 100644
--- a/src/lib/evas/canvas/efl_canvas_surface_tbm.c
+++ b/src/lib/evas/canvas/efl_canvas_surface_tbm.c
@@ -4,13 +4,13 @@
4 4
5typedef struct _Efl_Canvas_Surface_Tbm_Data 5typedef struct _Efl_Canvas_Surface_Tbm_Data
6{ 6{
7 Efl_Canvas_Surface_Data *base;
8} Efl_Canvas_Surface_Tbm_Data; 7} Efl_Canvas_Surface_Tbm_Data;
9 8
10EOLIAN static Eo * 9EOLIAN static Eo *
11_efl_canvas_surface_tbm_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Tbm_Data *pd) 10_efl_canvas_surface_tbm_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Tbm_Data *pd EINA_UNUSED)
12{ 11{
13 Evas_Object_Protected_Data *obj; 12 Evas_Object_Protected_Data *obj;
13 Efl_Canvas_Surface_Data *sd;
14 14
15 eo = efl_constructor(efl_super(eo, MY_CLASS)); 15 eo = efl_constructor(efl_super(eo, MY_CLASS));
16 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS); 16 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS);
@@ -22,34 +22,35 @@ _efl_canvas_surface_tbm_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Tbm_Da
22 return NULL; 22 return NULL;
23 } 23 }
24 24
25 pd->base = efl_data_ref(eo, EFL_CANVAS_SURFACE_MIXIN); 25 sd = efl_data_scope_get(eo, EFL_CANVAS_SURFACE_CLASS);
26 pd->base->surf.type = EVAS_NATIVE_SURFACE_TBM; 26 sd->surf.type = EVAS_NATIVE_SURFACE_TBM;
27 return eo; 27 return eo;
28} 28}
29 29
30EOLIAN static void 30EOLIAN static void
31_efl_canvas_surface_tbm_efl_object_destructor(Eo *eo, Efl_Canvas_Surface_Tbm_Data *pd) 31_efl_canvas_surface_tbm_efl_object_destructor(Eo *eo, Efl_Canvas_Surface_Tbm_Data *pd EINA_UNUSED)
32{ 32{
33 Evas_Object_Protected_Data *obj; 33 Evas_Object_Protected_Data *obj;
34 34
35 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS); 35 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS);
36 36
37 ENFN->image_native_shutdown(ENC, EVAS_NATIVE_SURFACE_TBM); 37 ENFN->image_native_shutdown(ENC, EVAS_NATIVE_SURFACE_TBM);
38 efl_data_unref(eo, pd->base);
39 efl_destructor(eo); 38 efl_destructor(eo);
40} 39}
41 40
42EOLIAN static Eina_Bool 41EOLIAN static Eina_Bool
43_efl_canvas_surface_tbm_efl_canvas_surface_native_buffer_set(Eo *eo, Efl_Canvas_Surface_Tbm_Data *pd, void *buffer) 42_efl_canvas_surface_tbm_efl_canvas_surface_native_buffer_set(Eo *eo, Efl_Canvas_Surface_Tbm_Data *pd EINA_UNUSED, void *buffer)
44{ 43{
45 pd->base->surf.data.tbm.buffer = buffer; 44 Efl_Canvas_Surface_Data *sd = efl_data_scope_get(eo, EFL_CANVAS_SURFACE_CLASS);
46 if (!_evas_image_native_surface_set(eo, &pd->base->surf)) 45
46 sd->surf.data.tbm.buffer = buffer;
47 if (!_evas_image_native_surface_set(eo, &sd->surf))
47 { 48 {
48 ERR("failed to set native buffer"); 49 ERR("failed to set native buffer");
49 pd->base->buffer = NULL; 50 sd->buffer = NULL;
50 return EINA_FALSE; 51 return EINA_FALSE;
51 } 52 }
52 pd->base->buffer = buffer; 53 sd->buffer = buffer;
53 return EINA_TRUE; 54 return EINA_TRUE;
54} 55}
55 56