summaryrefslogtreecommitdiff
path: root/src/lib/emotion
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-06 23:03:30 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 09:57:05 +0900
commita73e4c7c80cc149e5b3eb5211060010b1626b462 (patch)
tree5e30fc46f8f367581aa718cef96181330ea8b4ae /src/lib/emotion
parentd971ca2fb83faf5d6ddcbbb1f64a0ebaf69e8007 (diff)
emotion: Make it a clipped smart object
This reduces code. And probably adds new bugs.
Diffstat (limited to 'src/lib/emotion')
-rw-r--r--src/lib/emotion/efl_canvas_video.eo3
-rw-r--r--src/lib/emotion/emotion_smart.c74
2 files changed, 9 insertions, 68 deletions
diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo
index 201b94a..f425b0b 100644
--- a/src/lib/emotion/efl_canvas_video.eo
+++ b/src/lib/emotion/efl_canvas_video.eo
@@ -53,11 +53,8 @@ class Efl.Canvas.Video (Efl.Canvas.Group, Efl.File, Efl.Player, Efl.Image, Efl.I
53 } 53 }
54 implements { 54 implements {
55 Efl.Object.constructor; 55 Efl.Object.constructor;
56 Efl.Gfx.color { set; }
57 Efl.Gfx.visible { set; }
58 Efl.Gfx.position { set; } 56 Efl.Gfx.position { set; }
59 Efl.Gfx.size { set; } 57 Efl.Gfx.size { set; }
60 Efl.Canvas.Object.clip { set; }
61 Efl.File.file { get; set; } 58 Efl.File.file { get; set; }
62 Efl.Player.play { get; set; } 59 Efl.Player.play { get; set; }
63 Efl.Player.position { get; set; } 60 Efl.Player.position { get; set; }
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index 064ca23..009e38f 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -237,7 +237,7 @@ emotion_object_add(Evas *evas)
237EOLIAN static Eo * 237EOLIAN static Eo *
238_efl_canvas_video_efl_object_constructor(Eo *obj, Efl_Canvas_Video_Data *pd EINA_UNUSED) 238_efl_canvas_video_efl_object_constructor(Eo *obj, Efl_Canvas_Video_Data *pd EINA_UNUSED)
239{ 239{
240 efl_canvas_group_clipped_set(obj, EINA_FALSE); 240 efl_canvas_group_clipped_set(obj, EINA_TRUE);
241 obj = efl_constructor(efl_super(obj, MY_CLASS)); 241 obj = efl_constructor(efl_super(obj, MY_CLASS));
242 efl_canvas_object_type_set(obj, E_OBJ_NAME); 242 efl_canvas_object_type_set(obj, E_OBJ_NAME);
243 243
@@ -465,13 +465,11 @@ _emotion_aspect_borders_apply(Evas_Object *obj, Efl_Canvas_Video_Data *sd, int w
465 Evas_Object *old_clipper; 465 Evas_Object *old_clipper;
466 sd->crop.clipper = evas_object_rectangle_add 466 sd->crop.clipper = evas_object_rectangle_add
467 (evas_object_evas_get(obj)); 467 (evas_object_evas_get(obj));
468 evas_object_color_set(sd->crop.clipper, 255, 255, 255, 255);
469 evas_object_smart_member_add(sd->crop.clipper, obj); 468 evas_object_smart_member_add(sd->crop.clipper, obj);
470 old_clipper = evas_object_clip_get(sd->obj); 469 old_clipper = evas_object_clip_get(sd->obj);
471 evas_object_clip_set(sd->obj, sd->crop.clipper); 470 evas_object_clip_set(sd->obj, sd->crop.clipper);
472 evas_object_clip_set(sd->crop.clipper, old_clipper); 471 evas_object_clip_set(sd->crop.clipper, old_clipper);
473 if (evas_object_visible_get(sd->obj)) 472 evas_object_show(sd->crop.clipper);
474 evas_object_show(sd->crop.clipper);
475 } 473 }
476 } 474 }
477 _clipper_position_size_update(obj, x, y, w, h, iw, ih); 475 _clipper_position_size_update(obj, x, y, w, h, iw, ih);
@@ -603,13 +601,7 @@ emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a)
603 Efl_Canvas_Video_Data *sd; 601 Efl_Canvas_Video_Data *sd;
604 602
605 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 603 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
606
607 evas_object_color_set(sd->bg, r, g, b, a); 604 evas_object_color_set(sd->bg, r, g, b, a);
608
609 if (!evas_object_visible_get(obj)) return;
610
611 if (a > 0) evas_object_show(sd->bg);
612 else evas_object_hide(sd->bg);
613} 605}
614 606
615EAPI void 607EAPI void
@@ -1905,6 +1897,8 @@ _efl_canvas_video_efl_canvas_group_group_add(Evas_Object *obj, Efl_Canvas_Video_
1905 /* TODO: remove legacy: emotion used to have no init, call automatically */ 1897 /* TODO: remove legacy: emotion used to have no init, call automatically */
1906 emotion_init(); 1898 emotion_init();
1907 1899
1900 efl_canvas_group_add(efl_super(obj, MY_CLASS));
1901
1908 sd->state = EMOTION_WAKEUP; 1902 sd->state = EMOTION_WAKEUP;
1909 sd->obj = evas_object_image_add(evas_object_evas_get(obj)); 1903 sd->obj = evas_object_image_add(evas_object_evas_get(obj));
1910 sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj)); 1904 sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj));
@@ -1927,6 +1921,8 @@ _efl_canvas_video_efl_canvas_group_group_add(Evas_Object *obj, Efl_Canvas_Video_
1927 *pixel = 0xff000000; 1921 *pixel = 0xff000000;
1928 evas_object_image_data_set(obj, pixel); 1922 evas_object_image_data_set(obj, pixel);
1929 } 1923 }
1924 evas_object_show(sd->obj);
1925 evas_object_show(sd->bg);
1930 1926
1931 xattr = calloc(1, sizeof(*xattr)); 1927 xattr = calloc(1, sizeof(*xattr));
1932 EINA_REFCOUNT_INIT(xattr); 1928 EINA_REFCOUNT_INIT(xattr);
@@ -1943,21 +1939,15 @@ _efl_canvas_video_efl_canvas_group_group_del(Evas_Object *obj EINA_UNUSED, Efl_C
1943 emotion_engine_instance_del(sd->engine_instance); 1939 emotion_engine_instance_del(sd->engine_instance);
1944 } 1940 }
1945 sd->engine_instance = NULL; 1941 sd->engine_instance = NULL;
1946 if (sd->obj) evas_object_del(sd->obj);
1947 sd->obj = NULL;
1948 if (sd->crop.clipper) evas_object_del(sd->crop.clipper);
1949 sd->crop.clipper = NULL;
1950 if (sd->bg) evas_object_del(sd->bg);
1951 sd->bg = NULL;
1952 if (sd->file) eina_stringshare_del(sd->file);
1953 sd->file = NULL;
1954 if (sd->job) ecore_job_del(sd->job); 1942 if (sd->job) ecore_job_del(sd->job);
1955 sd->job = NULL; 1943 sd->job = NULL;
1956 if (sd->anim) ecore_animator_del(sd->anim); 1944 if (sd->anim) ecore_animator_del(sd->anim);
1957 sd->anim = NULL; 1945 sd->anim = NULL;
1946 eina_stringshare_del(sd->file);
1958 eina_stringshare_del(sd->progress.info); 1947 eina_stringshare_del(sd->progress.info);
1959 sd->progress.info = NULL;
1960 eina_stringshare_del(sd->ref.file); 1948 eina_stringshare_del(sd->ref.file);
1949 sd->file = NULL;
1950 sd->progress.info = NULL;
1961 sd->ref.file = NULL; 1951 sd->ref.file = NULL;
1962 _xattr_data_unref(sd->xattr); 1952 _xattr_data_unref(sd->xattr);
1963 efl_canvas_group_del(efl_super(obj, MY_CLASS)); 1953 efl_canvas_group_del(efl_super(obj, MY_CLASS));
@@ -1975,7 +1965,6 @@ _efl_canvas_video_efl_gfx_position_set(Evas_Object *obj, Efl_Canvas_Video_Data *
1975 efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); 1965 efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y);
1976 1966
1977 _clipper_position_size_update(obj, x, y, w, h, sd->video.w, sd->video.h); 1967 _clipper_position_size_update(obj, x, y, w, h, sd->video.w, sd->video.h);
1978 evas_object_move(sd->bg, x, y);
1979} 1968}
1980 1969
1981EOLIAN static void 1970EOLIAN static void
@@ -1990,51 +1979,6 @@ _efl_canvas_video_efl_gfx_size_set(Evas_Object *obj, Efl_Canvas_Video_Data *sd,
1990 evas_object_resize(sd->bg, w, h); 1979 evas_object_resize(sd->bg, w, h);
1991} 1980}
1992 1981
1993EOLIAN static void
1994_efl_canvas_video_efl_gfx_visible_set(Evas_Object *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Bool vis)
1995{
1996 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
1997 return;
1998
1999 efl_gfx_visible_set(efl_super(obj, MY_CLASS), vis);
2000 efl_gfx_visible_set(sd->obj, vis);
2001 efl_gfx_visible_set(sd->crop.clipper, vis);
2002
2003 if (vis)
2004 {
2005 int a;
2006
2007 evas_object_color_get(sd->bg, NULL, NULL, NULL, &a);
2008 if (a > 0) efl_gfx_visible_set(sd->bg, EINA_TRUE);
2009 }
2010 else
2011 efl_gfx_visible_set(sd->bg, EINA_FALSE);
2012}
2013
2014EOLIAN static void
2015_efl_canvas_video_efl_gfx_color_set(Evas_Object *obj, Efl_Canvas_Video_Data *sd, int r, int g, int b, int a)
2016{
2017 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_COLOR_SET, 0, r, g, b, a))
2018 return;
2019
2020 efl_gfx_color_set(efl_super(obj, MY_CLASS), r, g, b, a);
2021 evas_object_color_set(sd->obj, r, g, b, a);
2022 evas_object_color_set(sd->crop.clipper, r, g, b, a);
2023}
2024
2025EOLIAN static void
2026_efl_canvas_video_efl_canvas_object_clip_set(Evas_Object *obj, Efl_Canvas_Video_Data *sd, Evas_Object *clip)
2027{
2028 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
2029 return;
2030
2031 efl_canvas_object_clip_set(efl_super(obj, MY_CLASS), clip);
2032
2033 if (sd->crop.clipper) evas_object_clip_set(sd->crop.clipper, clip);
2034 else evas_object_clip_set(sd->obj, clip);
2035 evas_object_clip_set(sd->bg, clip);
2036}
2037
2038/* Internal EO APIs and hidden overrides */ 1982/* Internal EO APIs and hidden overrides */
2039 1983
2040#define EFL_CANVAS_VIDEO_EXTRA_OPS \ 1984#define EFL_CANVAS_VIDEO_EXTRA_OPS \