summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/evas/Evas_Common.h10
-rw-r--r--src/lib/evas/Evas_Eo.h26
-rw-r--r--src/lib/evas/Evas_Legacy.h3
-rw-r--r--src/lib/evas/canvas/evas_object_image.c53
-rw-r--r--src/lib/evas/canvas/evas_render.c68
5 files changed, 158 insertions, 2 deletions
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index 0c2d9b3655..007c0acf8f 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -486,6 +486,16 @@ struct _Evas_Video_Surface
486 void *data; 486 void *data;
487}; 487};
488 488
489typedef enum _Evas_Video_Surface_Caps
490{
491 EVAS_VIDEO_SURFACE_MOVE = 1,
492 EVAS_VIDEO_SURFACE_RESIZE = 2,
493 EVAS_VIDEO_SURFACE_CLIP = 4,
494 EVAS_VIDEO_SURFACE_BELOW = 8,
495 EVAS_VIDEO_SURFACE_STACKING_CHECK = 16,
496 EVAS_VIDEO_SURFACE_IGNORE_WINDOW = 32,
497} Evas_Video_Surface_Caps;
498
489#define EVAS_LAYER_MIN -32768 /**< bottom-most layer number */ 499#define EVAS_LAYER_MIN -32768 /**< bottom-most layer number */
490#define EVAS_LAYER_MAX 32767 /**< top-most layer number */ 500#define EVAS_LAYER_MAX 32767 /**< top-most layer number */
491 501
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 232483107b..63783c5b66 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -5592,6 +5592,8 @@ enum
5592 EVAS_OBJ_IMAGE_SUB_ID_COLORSPACE_GET, 5592 EVAS_OBJ_IMAGE_SUB_ID_COLORSPACE_GET,
5593 EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_SET, 5593 EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_SET,
5594 EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET, 5594 EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET,
5595 EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_SET,
5596 EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_GET,
5595 EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_SET, 5597 EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_SET,
5596 EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_GET, 5598 EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_GET,
5597 EVAS_OBJ_IMAGE_SUB_ID_SCALE_HINT_SET, 5599 EVAS_OBJ_IMAGE_SUB_ID_SCALE_HINT_SET,
@@ -6380,6 +6382,30 @@ enum
6380#define evas_obj_image_video_surface_get(surf) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET), EO_TYPECHECK(const Evas_Video_Surface **, surf) 6382#define evas_obj_image_video_surface_get(surf) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET), EO_TYPECHECK(const Evas_Video_Surface **, surf)
6381 6383
6382/** 6384/**
6385 * @def evas_obj_image_video_surface_caps_set
6386 * @since 1.8
6387 *
6388 * Set the video surface capabilities to a given image of the canvas
6389 *
6390 * @param[in] caps in
6391 *
6392 * @see evas_object_image_video_surface_caps_set
6393 */
6394#define evas_obj_image_video_surface_caps_set(caps) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_SET), EO_TYPECHECK(unsigned int, caps)
6395
6396/**
6397 * @def evas_obj_image_video_surface_caps_get
6398 * @since 1.8
6399 *
6400 * Get the video surface capabilities to a given image of the canvas
6401 *
6402 * @param[out] caps out
6403 *
6404 * @see evas_object_image_video_surface_caps_get
6405 */
6406#define evas_obj_image_video_surface_caps_get(caps) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_GET), EO_TYPECHECK(unsigned int *, caps)
6407
6408/**
6383 * @def evas_obj_image_native_surface_set 6409 * @def evas_obj_image_native_surface_set
6384 * @since 1.8 6410 * @since 1.8
6385 * 6411 *
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index 5294ce7909..ffb3bb821e 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -4738,6 +4738,9 @@ EAPI void evas_object_image_video_surface_set(Evas_Obje
4738 */ 4738 */
4739EAPI const Evas_Video_Surface *evas_object_image_video_surface_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 4739EAPI const Evas_Video_Surface *evas_object_image_video_surface_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
4740 4740
4741EAPI void evas_object_image_video_surface_caps_set(Evas_Object *obj, unsigned int caps) EINA_ARG_NONNULL(1);
4742EAPI unsigned int evas_object_image_video_surface_caps_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
4743
4741/** 4744/**
4742 * Set the scale hint of a given image of the canvas. 4745 * Set the scale hint of a given image of the canvas.
4743 * 4746 *
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index af76f53fc2..00c1cf6fa6 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -64,6 +64,7 @@ struct _Evas_Object_Image_Pixels
64 } func; 64 } func;
65 65
66 Evas_Video_Surface video; 66 Evas_Video_Surface video;
67 unsigned int video_caps;
67}; 68};
68 69
69struct _Evas_Object_Image_State 70struct _Evas_Object_Image_State
@@ -216,7 +217,7 @@ static const Evas_Object_Image_Load_Opts default_load_opts = {
216}; 217};
217 218
218static const Evas_Object_Image_Pixels default_pixels = { 219static const Evas_Object_Image_Pixels default_pixels = {
219 NULL, { NULL, NULL }, { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 220 NULL, { NULL, NULL }, { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, ~0x0
220}; 221};
221 222
222static const Evas_Object_Image_State default_state = { 223static const Evas_Object_Image_State default_state = {
@@ -2579,6 +2580,52 @@ _image_video_surface_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
2579} 2580}
2580 2581
2581EAPI void 2582EAPI void
2583evas_object_image_video_surface_caps_set(Evas_Object *eo_obj, unsigned int caps)
2584{
2585 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
2586 return;
2587 MAGIC_CHECK_END();
2588 eo_do(eo_obj, evas_obj_image_video_surface_caps_set(caps));
2589}
2590
2591static void
2592_image_video_surface_caps_set(Eo *eo_obj, void *_pd, va_list *list)
2593{
2594 unsigned int caps = va_arg(*list, unsigned int);
2595 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
2596 Evas_Object_Image *o = _pd;
2597
2598 _evas_object_image_cleanup(eo_obj, obj, o);
2599
2600 if (caps == o->pixels->video_caps)
2601 return;
2602
2603 EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
2604 pixi_write->video_caps = caps;
2605 EINA_COW_PIXEL_WRITE_END(o, pixi_write)
2606}
2607
2608EAPI unsigned int
2609evas_object_image_video_surface_caps_get(const Evas_Object *eo_obj)
2610{
2611 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
2612 return 0;
2613 MAGIC_CHECK_END();
2614 unsigned int caps = ~0x0;
2615 eo_do((Eo *)eo_obj, evas_obj_image_video_surface_caps_get(&caps));
2616 return caps;
2617}
2618
2619static void
2620_image_video_surface_caps_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
2621{
2622 unsigned int *caps = va_arg(*list, unsigned int *);
2623 const Evas_Object_Image *o = _pd;
2624
2625 *caps = (!o->video_surface ? 0 : o->pixels->video_caps);
2626}
2627
2628EAPI void
2582evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *surf) 2629evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *surf)
2583{ 2630{
2584 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); 2631 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
@@ -5359,6 +5406,8 @@ _class_constructor(Eo_Class *klass)
5359 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_COLORSPACE_GET), _image_colorspace_get), 5406 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_COLORSPACE_GET), _image_colorspace_get),
5360 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_SET), _image_video_surface_set), 5407 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_SET), _image_video_surface_set),
5361 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET), _image_video_surface_get), 5408 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET), _image_video_surface_get),
5409 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_SET), _image_video_surface_caps_set),
5410 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_GET), _image_video_surface_caps_get),
5362 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_SET), _image_native_surface_set), 5411 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_SET), _image_native_surface_set),
5363 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_GET), _image_native_surface_get), 5412 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_GET), _image_native_surface_get),
5364 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SCALE_HINT_SET), _image_scale_hint_set), 5413 EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SCALE_HINT_SET), _image_scale_hint_set),
@@ -5437,6 +5486,8 @@ static const Eo_Op_Description op_desc[] = {
5437 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_COLORSPACE_GET, "Get the colorspace of a given image of the canvas."), 5486 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_COLORSPACE_GET, "Get the colorspace of a given image of the canvas."),
5438 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_SET, "Set the video surface linked to a given image of the canvas."), 5487 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_SET, "Set the video surface linked to a given image of the canvas."),
5439 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET, "Get the video surface linekd to a given image of the canvas."), 5488 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_GET, "Get the video surface linekd to a given image of the canvas."),
5489 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_SET, "Set the surface capabilities (clip, resize, scale) of the video surface associated with this image."),
5490 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_VIDEO_SURFACE_CAPS_GET, "Get the surface capabilities (clip, resize, scale) of the video surface associated with this image."),
5440 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_SET, "Set the native surface of a given image of the canvas."), 5491 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_SET, "Set the native surface of a given image of the canvas."),
5441 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_GET, "Get the native surface of a given image of the canvas."), 5492 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_NATIVE_SURFACE_GET, "Get the native surface of a given image of the canvas."),
5442 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SCALE_HINT_SET, "Set the scale hint of a given image of the canvas."), 5493 EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SCALE_HINT_SET, "Set the scale hint of a given image of the canvas."),
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 49fbefefe8..e1b824fa37 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -810,6 +810,10 @@ _evas_render_can_use_overlay(Evas_Public_Data *e, Evas_Object *eo_obj)
810 Eina_Bool nooverlay; 810 Eina_Bool nooverlay;
811 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); 811 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
812 Evas_Object_Protected_Data *tmp = NULL; 812 Evas_Object_Protected_Data *tmp = NULL;
813 Evas_Coord imgw, imgh;
814 unsigned int caps;
815 Eina_Bool surface_below, stacking_check, object_above = EINA_FALSE;
816 Eina_Bool ignore_window;
813 817
814 video_parent = _evas_object_image_video_parent_get(eo_obj); 818 video_parent = _evas_object_image_video_parent_get(eo_obj);
815 819
@@ -832,6 +836,62 @@ _evas_render_can_use_overlay(Evas_Public_Data *e, Evas_Object *eo_obj)
832 (obj->cur->cache.clip.a != 255)) 836 (obj->cur->cache.clip.a != 255))
833 return EINA_FALSE; 837 return EINA_FALSE;
834 838
839 caps = evas_object_image_video_surface_caps_get(eo_obj);
840
841 /* check if surface is above the canvas */
842 surface_below = !!(caps & EVAS_VIDEO_SURFACE_BELOW);
843 if (!surface_below)
844 {
845 /* above canvas, must support resize and clipping */
846
847 /* check if video surface supports resize */
848 evas_object_image_size_get(eo_obj, &imgw, &imgh);
849 if ((obj->cur->geometry.w != imgw) ||
850 (obj->cur->geometry.h != imgh))
851 {
852 if (!(caps & EVAS_VIDEO_SURFACE_RESIZE))
853 return EINA_FALSE;
854 }
855 /* check if video surface supports clipping */
856 evas_object_image_size_get(eo_obj, &imgw, &imgh);
857 if ((obj->cur->cache.clip.x != obj->cur->geometry.x) ||
858 (obj->cur->cache.clip.y != obj->cur->geometry.y) ||
859 (obj->cur->cache.clip.w != obj->cur->geometry.w) ||
860 (obj->cur->cache.clip.h != obj->cur->geometry.h))
861 {
862 if (!(caps & EVAS_VIDEO_SURFACE_CLIP))
863 return EINA_FALSE;
864 }
865 }
866
867 /* check for window/surface/canvas limits */
868 ignore_window = !!(caps & EVAS_VIDEO_SURFACE_IGNORE_WINDOW);
869 if (!ignore_window)
870 {
871 Evas_Coord x1, x2, y1, y2;
872 Evas_Coord fx, fy, fw, fh;
873
874 fx = e->framespace.x;
875 fy = e->framespace.y;
876 fw = e->framespace.w;
877 fh = e->framespace.h;
878
879 x1 = obj->cur->geometry.x + fx;
880 y1 = obj->cur->geometry.y + fy;
881 x2 = obj->cur->geometry.x + obj->cur->geometry.w + fx;
882 y2 = obj->cur->geometry.y + obj->cur->geometry.h + fy;
883
884 if ((x1 < fx) || (y1 < fy) ||
885 (x2 > e->output.w - (fw - fx)) ||
886 (y2 > e->output.h - (fh - fy)))
887 return EINA_FALSE;
888 }
889
890 /* check if there are other objects above the video object? */
891 stacking_check = !!(caps & EVAS_VIDEO_SURFACE_STACKING_CHECK);
892 if (!stacking_check)
893 return EINA_TRUE;
894
835 /* Check presence of transparent object on top of the video object */ 895 /* Check presence of transparent object on top of the video object */
836 EINA_RECTANGLE_SET(&zone, 896 EINA_RECTANGLE_SET(&zone,
837 obj->cur->cache.clip.x, 897 obj->cur->cache.clip.x,
@@ -878,6 +938,12 @@ _evas_render_can_use_overlay(Evas_Public_Data *e, Evas_Object *eo_obj)
878 { 938 {
879 Eina_Bool included = EINA_FALSE; 939 Eina_Bool included = EINA_FALSE;
880 940
941 if (!surface_below)
942 {
943 object_above = EINA_TRUE;
944 break;
945 }
946
881 if (evas_object_is_opaque(eo_current, current) || 947 if (evas_object_is_opaque(eo_current, current) ||
882 ((current->func->has_opaque_rect) && 948 ((current->func->has_opaque_rect) &&
883 (current->func->has_opaque_rect(eo_current, current, current->private_data)))) 949 (current->func->has_opaque_rect(eo_current, current, current->private_data))))
@@ -990,7 +1056,7 @@ _evas_render_can_use_overlay(Evas_Public_Data *e, Evas_Object *eo_obj)
990 EINA_LIST_FREE(opaques, r) 1056 EINA_LIST_FREE(opaques, r)
991 eina_rectangle_free(r); 1057 eina_rectangle_free(r);
992 1058
993 if (nooverlay) 1059 if (nooverlay || object_above)
994 return EINA_FALSE; 1060 return EINA_FALSE;
995 1061
996 return EINA_TRUE; 1062 return EINA_TRUE;