summaryrefslogtreecommitdiff
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
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
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface.c2
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface.eo2
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_tbm.c23
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_tbm.eo2
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_wayland.c23
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_wayland.eo2
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_x11.c26
-rw-r--r--src/lib/evas/canvas/efl_canvas_surface_x11.eo2
8 files changed, 43 insertions, 39 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_surface.c b/src/lib/evas/canvas/efl_canvas_surface.c
index a9993829b7..bc61a55815 100644
--- a/src/lib/evas/canvas/efl_canvas_surface.c
+++ b/src/lib/evas/canvas/efl_canvas_surface.c
@@ -1,6 +1,6 @@
1#include "efl_canvas_surface.h" 1#include "efl_canvas_surface.h"
2 2
3#define MY_CLASS EFL_CANVAS_SURFACE_MIXIN 3#define MY_CLASS EFL_CANVAS_SURFACE_CLASS
4 4
5EOLIAN static Eo * 5EOLIAN static Eo *
6_efl_canvas_surface_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Data *pd) 6_efl_canvas_surface_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Data *pd)
diff --git a/src/lib/evas/canvas/efl_canvas_surface.eo b/src/lib/evas/canvas/efl_canvas_surface.eo
index 5a113f333b..8946b20efa 100644
--- a/src/lib/evas/canvas/efl_canvas_surface.eo
+++ b/src/lib/evas/canvas/efl_canvas_surface.eo
@@ -1,4 +1,4 @@
1mixin Efl.Canvas.Surface (Efl.Interface, Efl.Canvas.Image_Internal) 1abstract Efl.Canvas.Surface (Efl.Canvas.Image_Internal)
2{ 2{
3 [[Native surfaces usually bound to an externally-managed buffer. 3 [[Native surfaces usually bound to an externally-managed buffer.
4 4
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
diff --git a/src/lib/evas/canvas/efl_canvas_surface_tbm.eo b/src/lib/evas/canvas/efl_canvas_surface_tbm.eo
index 89b255cb47..7a3a8ee56f 100644
--- a/src/lib/evas/canvas/efl_canvas_surface_tbm.eo
+++ b/src/lib/evas/canvas/efl_canvas_surface_tbm.eo
@@ -1,4 +1,4 @@
1class Efl.Canvas.Surface_Tbm (Efl.Object, Efl.Canvas.Surface) 1class Efl.Canvas.Surface_Tbm (Efl.Canvas.Surface)
2{ 2{
3 [[Native Tizen Buffer Manager surface for Efl canvas]] 3 [[Native Tizen Buffer Manager surface for Efl canvas]]
4 4
diff --git a/src/lib/evas/canvas/efl_canvas_surface_wayland.c b/src/lib/evas/canvas/efl_canvas_surface_wayland.c
index 8e4e476e6c..394a1000f0 100644
--- a/src/lib/evas/canvas/efl_canvas_surface_wayland.c
+++ b/src/lib/evas/canvas/efl_canvas_surface_wayland.c
@@ -4,13 +4,13 @@
4 4
5typedef struct _Efl_Canvas_Surface_Wayland_Data 5typedef struct _Efl_Canvas_Surface_Wayland_Data
6{ 6{
7 Efl_Canvas_Surface_Data *base;
8} Efl_Canvas_Surface_Wayland_Data; 7} Efl_Canvas_Surface_Wayland_Data;
9 8
10EOLIAN static Eo * 9EOLIAN static Eo *
11_efl_canvas_surface_wayland_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Wayland_Data *pd) 10_efl_canvas_surface_wayland_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Wayland_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_wayland_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_Wa
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_WL; 26 sd->surf.type = EVAS_NATIVE_SURFACE_WL;
27 return eo; 27 return eo;
28} 28}
29 29
30EOLIAN static void 30EOLIAN static void
31_efl_canvas_surface_wayland_efl_object_destructor(Eo *eo, Efl_Canvas_Surface_Wayland_Data *pd) 31_efl_canvas_surface_wayland_efl_object_destructor(Eo *eo, Efl_Canvas_Surface_Wayland_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_WL); 37 ENFN->image_native_shutdown(ENC, EVAS_NATIVE_SURFACE_WL);
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_wayland_efl_canvas_surface_native_buffer_set(Eo *eo, Efl_Canvas_Surface_Wayland_Data *pd, void *buffer) 42_efl_canvas_surface_wayland_efl_canvas_surface_native_buffer_set(Eo *eo, Efl_Canvas_Surface_Wayland_Data *pd EINA_UNUSED, void *buffer)
44{ 43{
45 pd->base->surf.data.wl.legacy_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.wl.legacy_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
diff --git a/src/lib/evas/canvas/efl_canvas_surface_wayland.eo b/src/lib/evas/canvas/efl_canvas_surface_wayland.eo
index e5e80140f7..e731898582 100644
--- a/src/lib/evas/canvas/efl_canvas_surface_wayland.eo
+++ b/src/lib/evas/canvas/efl_canvas_surface_wayland.eo
@@ -1,4 +1,4 @@
1class Efl.Canvas.Surface_Wayland (Efl.Object, Efl.Canvas.Surface) 1class Efl.Canvas.Surface_Wayland (Efl.Canvas.Surface)
2{ 2{
3 [[Native Wayland surface for Efl canvas]] 3 [[Native Wayland surface for Efl canvas]]
4 4
diff --git a/src/lib/evas/canvas/efl_canvas_surface_x11.c b/src/lib/evas/canvas/efl_canvas_surface_x11.c
index 5dc10ddbbe..5b7c8472b9 100644
--- a/src/lib/evas/canvas/efl_canvas_surface_x11.c
+++ b/src/lib/evas/canvas/efl_canvas_surface_x11.c
@@ -4,14 +4,14 @@
4 4
5typedef struct _Efl_Canvas_Surface_X11_Data 5typedef struct _Efl_Canvas_Surface_X11_Data
6{ 6{
7 Efl_Canvas_Surface_Data *base;
8 Efl_Canvas_Surface_X11_Pixmap px; 7 Efl_Canvas_Surface_X11_Pixmap px;
9} Efl_Canvas_Surface_X11_Data; 8} Efl_Canvas_Surface_X11_Data;
10 9
11EOLIAN static Eo * 10EOLIAN static Eo *
12_efl_canvas_surface_x11_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_X11_Data *pd) 11_efl_canvas_surface_x11_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_X11_Data *pd EINA_UNUSED)
13{ 12{
14 Evas_Object_Protected_Data *obj; 13 Evas_Object_Protected_Data *obj;
14 Efl_Canvas_Surface_Data *sd;
15 15
16 eo = efl_constructor(efl_super(eo, MY_CLASS)); 16 eo = efl_constructor(efl_super(eo, MY_CLASS));
17 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS); 17 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS);
@@ -23,36 +23,37 @@ _efl_canvas_surface_x11_efl_object_constructor(Eo *eo, Efl_Canvas_Surface_X11_Da
23 return NULL; 23 return NULL;
24 } 24 }
25 25
26 pd->base = efl_data_ref(eo, EFL_CANVAS_SURFACE_MIXIN); 26 sd = efl_data_scope_get(eo, EFL_CANVAS_SURFACE_CLASS);
27 pd->base->surf.version = EVAS_NATIVE_SURFACE_VERSION; 27 sd->surf.version = EVAS_NATIVE_SURFACE_VERSION;
28 pd->base->surf.type = EVAS_NATIVE_SURFACE_X11; 28 sd->surf.type = EVAS_NATIVE_SURFACE_X11;
29 return eo; 29 return eo;
30} 30}
31 31
32EOLIAN static void 32EOLIAN static void
33_efl_canvas_surface_x11_efl_object_destructor(Eo *eo, Efl_Canvas_Surface_X11_Data *pd) 33_efl_canvas_surface_x11_efl_object_destructor(Eo *eo, Efl_Canvas_Surface_X11_Data *pd EINA_UNUSED)
34{ 34{
35 Evas_Object_Protected_Data *obj; 35 Evas_Object_Protected_Data *obj;
36 36
37 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS); 37 obj = efl_data_scope_get(eo, EFL_CANVAS_OBJECT_CLASS);
38 38
39 ENFN->image_native_shutdown(ENC, EVAS_NATIVE_SURFACE_X11); 39 ENFN->image_native_shutdown(ENC, EVAS_NATIVE_SURFACE_X11);
40 efl_data_unref(eo, pd->base);
41 efl_destructor(eo); 40 efl_destructor(eo);
42} 41}
43 42
44EOLIAN static Eina_Bool 43EOLIAN static Eina_Bool
45_efl_canvas_surface_x11_pixmap_set(Eo *eo, Efl_Canvas_Surface_X11_Data *pd EINA_UNUSED, void *visual, unsigned long pixmap) 44_efl_canvas_surface_x11_pixmap_set(Eo *eo, Efl_Canvas_Surface_X11_Data *pd EINA_UNUSED, void *visual, unsigned long pixmap)
46{ 45{
46 Efl_Canvas_Surface_Data *sd = efl_data_scope_get(eo, EFL_CANVAS_SURFACE_CLASS);
47
47 pd->px.pixmap = pixmap; 48 pd->px.pixmap = pixmap;
48 pd->px.visual = visual; 49 pd->px.visual = visual;
49 if (!_evas_image_native_surface_set(eo, &pd->base->surf)) 50 if (!_evas_image_native_surface_set(eo, &sd->surf))
50 { 51 {
51 ERR("failed to set native buffer"); 52 ERR("failed to set native buffer");
52 pd->base->buffer = NULL; 53 sd->buffer = NULL;
53 return EINA_FALSE; 54 return EINA_FALSE;
54 } 55 }
55 pd->base->buffer = &pd->px; 56 sd->buffer = &pd->px;
56 return EINA_TRUE; 57 return EINA_TRUE;
57} 58}
58 59
@@ -67,18 +68,19 @@ EOLIAN static Eina_Bool
67_efl_canvas_surface_x11_efl_canvas_surface_native_buffer_set(Eo *eo, Efl_Canvas_Surface_X11_Data *pd, void *buffer) 68_efl_canvas_surface_x11_efl_canvas_surface_native_buffer_set(Eo *eo, Efl_Canvas_Surface_X11_Data *pd, void *buffer)
68{ 69{
69 Efl_Canvas_Surface_X11_Pixmap *px = buffer; 70 Efl_Canvas_Surface_X11_Pixmap *px = buffer;
71 Efl_Canvas_Surface_Data *sd = efl_data_scope_get(eo, EFL_CANVAS_SURFACE_CLASS);
70 72
71 if (px) 73 if (px)
72 { 74 {
73 pd->px.pixmap = px->pixmap; 75 pd->px.pixmap = px->pixmap;
74 pd->px.visual = px->visual; 76 pd->px.visual = px->visual;
75 pd->base->buffer = &pd->px; 77 sd->buffer = &pd->px;
76 } 78 }
77 else 79 else
78 { 80 {
79 pd->px.pixmap = 0L; 81 pd->px.pixmap = 0L;
80 pd->px.visual = NULL; 82 pd->px.visual = NULL;
81 pd->base->buffer = NULL; 83 sd->buffer = NULL;
82 } 84 }
83 return efl_canvas_surface_x11_pixmap_set(eo, pd->px.visual, pd->px.pixmap); 85 return efl_canvas_surface_x11_pixmap_set(eo, pd->px.visual, pd->px.pixmap);
84} 86}
diff --git a/src/lib/evas/canvas/efl_canvas_surface_x11.eo b/src/lib/evas/canvas/efl_canvas_surface_x11.eo
index 6f4744d123..22b3586497 100644
--- a/src/lib/evas/canvas/efl_canvas_surface_x11.eo
+++ b/src/lib/evas/canvas/efl_canvas_surface_x11.eo
@@ -5,7 +5,7 @@ struct Efl.Canvas.Surface_X11_Pixmap
5 pixmap: ulong; [[X11 Pixmap ID.]] 5 pixmap: ulong; [[X11 Pixmap ID.]]
6} 6}
7 7
8class Efl.Canvas.Surface_X11 (Efl.Object, Efl.Canvas.Surface) 8class Efl.Canvas.Surface_X11 (Efl.Canvas.Surface)
9{ 9{
10 [[Native X11 surface for Efl canvas]] 10 [[Native X11 surface for Efl canvas]]
11 11