forked from enlightenment/efl
evas: add basic support for video support.
SVN revision: 63758
This commit is contained in:
parent
da2fb1b6f5
commit
d724205a6e
|
@ -593,6 +593,7 @@ typedef struct _Evas_Modifier Evas_Modifier; /**< An opaque type containin
|
|||
typedef struct _Evas_Lock Evas_Lock; /**< An opaque type containing information on which lock keys are registered in an Evas canvas */
|
||||
typedef struct _Evas_Smart Evas_Smart; /**< An Evas Smart Object handle */
|
||||
typedef struct _Evas_Native_Surface Evas_Native_Surface; /**< A generic datatype for engine specific native surface information */
|
||||
typedef struct _Evas_Video_Surface Evas_Video_Surface; /**< A generic datatype for video specific surface information */
|
||||
typedef unsigned long long Evas_Modifier_Mask; /**< An Evas modifier mask type */
|
||||
|
||||
typedef int Evas_Coord;
|
||||
|
@ -732,6 +733,26 @@ struct _Evas_Native_Surface
|
|||
} data;
|
||||
};
|
||||
|
||||
/* magic version number to know what the video surf struct looks like */
|
||||
#define EVAS_VIDEO_SURFACE_VERSION 1
|
||||
|
||||
typedef void (*Evas_Video_Cb)(void *data, Evas_Object *obj, const Evas_Video_Surface *surface);
|
||||
typedef void (*Evas_Video_Coord_Cb)(void *data, Evas_Object *obj, const Evas_Video_Surface *surface, Evas_Coord a, Evas_Coord b);
|
||||
|
||||
struct _Evas_Video_Surface
|
||||
{
|
||||
int version;
|
||||
|
||||
Evas_Video_Coord_Cb move; /**< Move the video surface to this position */
|
||||
Evas_Video_Coord_Cb resize; /**< Resize the video surface to that size */
|
||||
Evas_Video_Cb show; /**< Show the video overlay surface */
|
||||
Evas_Video_Cb hide; /**< Hide the video overlay surface */
|
||||
Evas_Video_Cb update_pixels; /**< Please update the Evas_Object_Image pixels when called */
|
||||
|
||||
Evas_Object *parent;
|
||||
void *data;
|
||||
};
|
||||
|
||||
#define EVAS_LAYER_MIN -32768 /**< bottom-most layer number */
|
||||
#define EVAS_LAYER_MAX 32767 /**< top-most layer number */
|
||||
|
||||
|
@ -7020,6 +7041,28 @@ EAPI void evas_object_image_native_surface_set (Evas_Obj
|
|||
*/
|
||||
EAPI Evas_Native_Surface *evas_object_image_native_surface_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
|
||||
/**
|
||||
* Set the video surface linked to a given image of the canvas
|
||||
*
|
||||
* @param obj The given canvas pointer.
|
||||
* @param surf The new video surface.
|
||||
*
|
||||
* This function link a video surface to a given canvas image.
|
||||
*
|
||||
*/
|
||||
EAPI void evas_object_image_video_surface_set (Evas_Object *obj, Evas_Video_Surface *surf) EINA_ARG_NONNULL(1, 2);
|
||||
|
||||
/**
|
||||
* Get the video surface linekd to a given image of the canvas
|
||||
*
|
||||
* @param obj The given canvas pointer.
|
||||
* @return The video surface of the given canvas image.
|
||||
*
|
||||
* This function returns the video surface linked to a given canvas image.
|
||||
*
|
||||
*/
|
||||
EAPI const Evas_Video_Surface *evas_object_image_video_surface_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
|
||||
/**
|
||||
* Set the scale hint of a given image of the canvas.
|
||||
*
|
||||
|
|
|
@ -64,7 +64,9 @@ struct _Evas_Object_Image
|
|||
Evas_Object_Image_Pixels_Get_Cb get_pixels;
|
||||
void *get_pixels_data;
|
||||
} func;
|
||||
|
||||
|
||||
Evas_Video_Surface video;
|
||||
|
||||
const char *tmpf;
|
||||
int tmpf_fd;
|
||||
|
||||
|
@ -78,6 +80,10 @@ struct _Evas_Object_Image
|
|||
unsigned char filled : 1;
|
||||
unsigned char proxyrendering : 1;
|
||||
unsigned char preloading : 1;
|
||||
unsigned char video_rendering : 1;
|
||||
unsigned char video_surface : 1;
|
||||
unsigned char video_visible : 1;
|
||||
unsigned char created : 1;
|
||||
};
|
||||
|
||||
/* private methods for image objects */
|
||||
|
@ -141,6 +147,20 @@ static const Evas_Object_Func object_func =
|
|||
|
||||
EVAS_MEMPOOL(_mp_obj);
|
||||
|
||||
static void
|
||||
_evas_object_image_cleanup(Evas_Object *obj, Evas_Object_Image *o)
|
||||
{
|
||||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
}
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
if (o->cur.source) _proxy_unset(obj);
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
evas_object_image_add(Evas *e)
|
||||
{
|
||||
|
@ -398,16 +418,11 @@ evas_object_image_source_set(Evas_Object *obj, Evas_Object *src)
|
|||
if (src == obj) return EINA_FALSE;
|
||||
if (o->cur.source == src) return EINA_TRUE;
|
||||
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
/* Kill the image if any */
|
||||
if (o->cur.file || o->cur.key)
|
||||
evas_object_image_file_set(obj, NULL, NULL);
|
||||
|
||||
if (o->cur.source)
|
||||
{
|
||||
_proxy_unset(obj);
|
||||
}
|
||||
|
||||
if (src)
|
||||
{
|
||||
_proxy_set(obj, src);
|
||||
|
@ -708,20 +723,13 @@ evas_object_image_size_set(Evas_Object *obj, int w, int h)
|
|||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
}
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
if (w > 32768) return;
|
||||
if (h > 32768) return;
|
||||
if ((w == o->cur.image.w) &&
|
||||
(h == o->cur.image.h)) return;
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
o->cur.image.w = w;
|
||||
o->cur.image.h = h;
|
||||
if (o->engine_data)
|
||||
|
@ -732,7 +740,7 @@ evas_object_image_size_set(Evas_Object *obj, int w, int h)
|
|||
o->engine_data = obj->layer->evas->engine.func->image_new_from_copied_data
|
||||
(obj->layer->evas->engine.data.output, w, h, NULL, o->cur.has_alpha,
|
||||
o->cur.cspace);
|
||||
|
||||
|
||||
if (o->engine_data)
|
||||
{
|
||||
if (obj->layer->evas->engine.func->image_scale_hint_set)
|
||||
|
@ -859,19 +867,12 @@ evas_object_image_data_set(Evas_Object *obj, void *data)
|
|||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
}
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
if (o->engine_data)
|
||||
evas_common_pipe_op_image_flush(o->engine_data);
|
||||
#endif
|
||||
p_data = o->engine_data;
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
if (data)
|
||||
{
|
||||
if (o->engine_data)
|
||||
|
@ -1045,16 +1046,9 @@ evas_object_image_data_copy_set(Evas_Object *obj, void *data)
|
|||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
}
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
if ((o->cur.image.w <= 0) ||
|
||||
(o->cur.image.h <= 0)) return;
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
if (o->engine_data)
|
||||
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
|
@ -1327,16 +1321,8 @@ evas_object_image_pixels_import(Evas_Object *obj, Evas_Pixel_Import_Source *pixe
|
|||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return 0;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
}
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
if ((pixels->w != o->cur.image.w) || (pixels->h != o->cur.image.h)) return 0;
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
switch (pixels->format)
|
||||
{
|
||||
#if 0
|
||||
|
@ -1669,14 +1655,7 @@ evas_object_image_colorspace_set(Evas_Object *obj, Evas_Colorspace cspace)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
}
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
if ((Evas_Colorspace)o->cur.cspace != cspace)
|
||||
{
|
||||
|
@ -1707,6 +1686,72 @@ evas_object_image_colorspace_get(const Evas_Object *obj)
|
|||
return o->cur.cspace;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_video_surface_set(Evas_Object *obj, Evas_Video_Surface *surf)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
if (o->video_surface)
|
||||
{
|
||||
o->video_surface = 0;
|
||||
obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, obj);
|
||||
}
|
||||
|
||||
if (surf)
|
||||
{
|
||||
fprintf(stderr, "video surface ?\n");
|
||||
if (surf->version != EVAS_VIDEO_SURFACE_VERSION) return ;
|
||||
|
||||
if (!surf->update_pixels ||
|
||||
!surf->move ||
|
||||
!surf->resize ||
|
||||
!surf->hide ||
|
||||
!surf->show)
|
||||
return ;
|
||||
|
||||
o->created = EINA_TRUE;
|
||||
o->video_surface = 1;
|
||||
o->video = *surf;
|
||||
|
||||
fprintf(stderr, "yes\n");
|
||||
obj->layer->evas->video_objects = eina_list_append(obj->layer->evas->video_objects, obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
o->video_surface = 0;
|
||||
o->video.update_pixels = NULL;
|
||||
o->video.move = NULL;
|
||||
o->video.resize = NULL;
|
||||
o->video.hide = NULL;
|
||||
o->video.show = NULL;
|
||||
o->video.data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI const Evas_Video_Surface *
|
||||
evas_object_image_video_surface_get(const Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return NULL;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return NULL;
|
||||
MAGIC_CHECK_END();
|
||||
if (!o->video_surface) return NULL;
|
||||
return &o->video;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf)
|
||||
{
|
||||
|
@ -1719,15 +1764,7 @@ evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf
|
|||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
}
|
||||
if (o->tmpf) _cleanup_tmpf(obj);
|
||||
if (o->cur.source) _proxy_unset(obj);
|
||||
_evas_object_image_cleanup(obj, o);
|
||||
if (!obj->layer->evas->engine.func->image_native_set) return;
|
||||
if ((surf) &&
|
||||
((surf->version < 2) ||
|
||||
|
@ -2647,6 +2684,11 @@ evas_object_image_free(Evas_Object *obj)
|
|||
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
}
|
||||
if (o->video_surface)
|
||||
{
|
||||
o->video_surface = 0;
|
||||
obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, obj);
|
||||
}
|
||||
o->engine_data = NULL;
|
||||
o->magic = 0;
|
||||
EINA_LIST_FREE(o->pixel_updates, r)
|
||||
|
@ -2674,6 +2716,29 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
|
|||
return;
|
||||
}
|
||||
|
||||
/* We are displaying the overlay */
|
||||
if (o->video_visible)
|
||||
{
|
||||
fprintf(stderr, "overlay visible, make a hole\n");
|
||||
|
||||
/* Create a transparent rectangle */
|
||||
obj->layer->evas->engine.func->context_color_set(output,
|
||||
context,
|
||||
0, 0, 0, 0);
|
||||
obj->layer->evas->engine.func->context_multiplier_unset(output,
|
||||
context);
|
||||
obj->layer->evas->engine.func->context_render_op_set(output, context,
|
||||
EVAS_RENDER_COPY);
|
||||
obj->layer->evas->engine.func->rectangle_draw(output,
|
||||
context,
|
||||
surface,
|
||||
obj->cur.geometry.x + x,
|
||||
obj->cur.geometry.y + y,
|
||||
obj->cur.geometry.w,
|
||||
obj->cur.geometry.h);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
obj->layer->evas->engine.func->context_color_set(output,
|
||||
context,
|
||||
|
@ -3704,4 +3769,42 @@ _evas_object_image_preloading_check(Evas_Object *obj)
|
|||
(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
}
|
||||
|
||||
Evas_Object *
|
||||
_evas_object_image_video_parent_get(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o = (Evas_Object_Image *)(obj->object_data);
|
||||
|
||||
return o->video_surface ? o->video.parent : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_object_image_video_overlay_show(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o = (Evas_Object_Image *)(obj->object_data);
|
||||
|
||||
if (!o->video_visible || o->created)
|
||||
o->video.show(o->video.data, obj, &o->video);
|
||||
if (obj->cur.cache.clip.x != obj->prev.cache.clip.x ||
|
||||
obj->cur.cache.clip.y != obj->prev.cache.clip.y)
|
||||
o->video.move(o->video.data, obj, &o->video, obj->cur.cache.clip.x, obj->cur.cache.clip.y);
|
||||
if (obj->cur.cache.clip.w != obj->prev.cache.clip.w ||
|
||||
obj->cur.cache.clip.h != obj->prev.cache.clip.h)
|
||||
o->video.resize(o->video.data, obj, &o->video, obj->cur.cache.clip.w, obj->cur.cache.clip.h);
|
||||
o->video_visible = EINA_TRUE;
|
||||
o->created = EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_object_image_video_overlay_hide(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o = (Evas_Object_Image *)(obj->object_data);
|
||||
|
||||
if (o->video_visible || o->created)
|
||||
o->video.hide(o->video.data, obj, &o->video);
|
||||
if (evas_object_is_visible(obj))
|
||||
o->video.update_pixels(o->video.data, obj, &o->video);
|
||||
o->video_visible = EINA_FALSE;
|
||||
o->created = EINA_FALSE;
|
||||
}
|
||||
|
||||
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|
||||
|
|
|
@ -37,6 +37,7 @@ evas_object_free(Evas_Object *obj, int clean_layer)
|
|||
#if 0 // filtering disabled
|
||||
evas_filter_free(obj);
|
||||
#endif
|
||||
if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL);
|
||||
evas_object_map_set(obj, NULL);
|
||||
evas_object_grabs_cleanup(obj);
|
||||
evas_object_intercept_cleanup(obj);
|
||||
|
|
|
@ -646,6 +646,207 @@ pending_change(void *data, void *gdata __UNUSED__)
|
|||
}
|
||||
}
|
||||
*/
|
||||
static Eina_Bool
|
||||
_evas_render_can_use_overlay(Evas *e, Evas_Object *obj)
|
||||
{
|
||||
Eina_Rectangle *r;
|
||||
Evas_Object *tmp;
|
||||
Eina_List *alphas = NULL;
|
||||
Eina_List *opaques = NULL;
|
||||
Evas_Object *video_parent = NULL;
|
||||
Eina_Rectangle zone;
|
||||
Evas_Coord xc1, yc1, xc2, yc2;
|
||||
unsigned int i;
|
||||
Eina_Bool nooverlay;
|
||||
|
||||
/* fprintf(stderr, "object: %p\n", obj); */
|
||||
|
||||
video_parent = _evas_object_image_video_parent_get(obj);
|
||||
|
||||
/* Check if any one is the stack make this object mapped */
|
||||
tmp = obj;
|
||||
while (tmp && !_evas_render_has_map(tmp))
|
||||
tmp = tmp->smart.parent;
|
||||
|
||||
/* fprintf(stderr, "mapped ?\n"); */
|
||||
if (tmp && _evas_render_has_map(tmp)) return EINA_FALSE; /* we are mapped, we can't be an overlay */
|
||||
|
||||
/* fprintf(stderr, "visible ?\n"); */
|
||||
if (!evas_object_is_visible(obj)) return EINA_FALSE; /* no need to update the overlay if it's not visible */
|
||||
|
||||
/* fprintf(stderr, "recoloring ? %i, %i, %i, %i\n", */
|
||||
/* obj->cur.cache.clip.r, obj->cur.cache.clip.g, obj->cur.cache.clip.b, obj->cur.cache.clip.a); */
|
||||
/* If any recoloring of the surface is needed, n overlay to */
|
||||
if ((obj->cur.cache.clip.r != 255) ||
|
||||
(obj->cur.cache.clip.g != 255) ||
|
||||
(obj->cur.cache.clip.b != 255) ||
|
||||
(obj->cur.cache.clip.a != 255))
|
||||
return EINA_FALSE;
|
||||
|
||||
/* Check presence of transparent object on top of the video object */
|
||||
EINA_RECTANGLE_SET(&zone,
|
||||
obj->cur.cache.clip.x,
|
||||
obj->cur.cache.clip.y,
|
||||
obj->cur.cache.clip.w,
|
||||
obj->cur.cache.clip.h);
|
||||
|
||||
for (i = e->active_objects.count - 1; i > 0; i--)
|
||||
{
|
||||
Eina_Rectangle self;
|
||||
Eina_Rectangle *match;
|
||||
Evas_Object *current;
|
||||
Eina_List *l;
|
||||
int xm1, ym1, xm2, ym2;
|
||||
|
||||
current = eina_array_data_get(&e->active_objects, i);
|
||||
|
||||
/* Did we find the video object in the stack ? */
|
||||
if (current == video_parent || current == obj)
|
||||
break;
|
||||
|
||||
EINA_RECTANGLE_SET(&self,
|
||||
current->cur.cache.clip.x,
|
||||
current->cur.cache.clip.y,
|
||||
current->cur.cache.clip.w,
|
||||
current->cur.cache.clip.h);
|
||||
|
||||
/* This doesn't cover the area of the video object, so don't bother with that object */
|
||||
if (!eina_rectangles_intersect(&zone, &self))
|
||||
continue ;
|
||||
|
||||
xc1 = current->cur.cache.clip.x;
|
||||
yc1 = current->cur.cache.clip.y;
|
||||
xc2 = current->cur.cache.clip.x + current->cur.cache.clip.w;
|
||||
yc2 = current->cur.cache.clip.y + current->cur.cache.clip.h;
|
||||
|
||||
if (evas_object_is_visible(current) &&
|
||||
(!current->clip.clipees) &&
|
||||
(current->cur.visible) &&
|
||||
(!current->delete_me) &&
|
||||
(current->cur.cache.clip.visible) &&
|
||||
(!current->smart.smart))
|
||||
{
|
||||
Eina_Bool included = EINA_FALSE;
|
||||
|
||||
if (evas_object_is_opaque(current) ||
|
||||
((current->func->has_opaque_rect) &&
|
||||
(current->func->has_opaque_rect(current))))
|
||||
{
|
||||
/* The object is opaque */
|
||||
|
||||
/* Check if the opaque object is inside another opaque object */
|
||||
EINA_LIST_FOREACH(opaques, l, match)
|
||||
{
|
||||
xm1 = match->x;
|
||||
ym1 = match->y;
|
||||
xm2 = match->x + match->w;
|
||||
ym2 = match->y + match->h;
|
||||
|
||||
/* Both object are included */
|
||||
if (xc1 >= xm1 && yc1 >= ym1 && xc2 <= xm2 && yc2 <= ym2)
|
||||
{
|
||||
included = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not included yet */
|
||||
if (!included)
|
||||
{
|
||||
Eina_List *ln;
|
||||
Evas_Coord xn2, yn2;
|
||||
|
||||
r = eina_rectangle_new(current->cur.cache.clip.x, current->cur.cache.clip.y,
|
||||
current->cur.cache.clip.w, current->cur.cache.clip.h);
|
||||
|
||||
opaques = eina_list_append(opaques, r);
|
||||
|
||||
xn2 = r->x + r->w;
|
||||
yn2 = r->y + r->h;
|
||||
|
||||
/* Remove all the transparent object that are covered by the new opaque object */
|
||||
EINA_LIST_FOREACH_SAFE(alphas, l, ln, match)
|
||||
{
|
||||
xm1 = match->x;
|
||||
ym1 = match->y;
|
||||
xm2 = match->x + match->w;
|
||||
ym2 = match->y + match->h;
|
||||
|
||||
if (xm1 >= r->x && ym1 >= r->y && xm2 <= xn2 && ym2 <= yn2)
|
||||
{
|
||||
/* The new rectangle is over some transparent object,
|
||||
so remove the transparent object */
|
||||
alphas = eina_list_remove_list(alphas, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The object has some transparency */
|
||||
|
||||
/* Check if the transparent object is inside any other transparent object */
|
||||
EINA_LIST_FOREACH(alphas, l, match)
|
||||
{
|
||||
xm1 = match->x;
|
||||
ym1 = match->y;
|
||||
xm2 = match->x + match->w;
|
||||
ym2 = match->y + match->h;
|
||||
|
||||
/* Both object are included */
|
||||
if (xc1 >= xm1 && yc1 >= ym1 && xc2 <= xm2 && yc2 <= ym2)
|
||||
{
|
||||
included = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If not check if it is inside any opaque one */
|
||||
if (!included)
|
||||
{
|
||||
EINA_LIST_FOREACH(opaques, l, match)
|
||||
{
|
||||
xm1 = match->x;
|
||||
ym1 = match->y;
|
||||
xm2 = match->x + match->w;
|
||||
ym2 = match->y + match->h;
|
||||
|
||||
/* Both object are included */
|
||||
if (xc1 >= xm1 && yc1 >= ym1 && xc2 <= xm2 && yc2 <= ym2)
|
||||
{
|
||||
included = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* No inclusion at all, so add it */
|
||||
if (!included)
|
||||
{
|
||||
r = eina_rectangle_new(current->cur.cache.clip.x, current->cur.cache.clip.y,
|
||||
current->cur.cache.clip.w, current->cur.cache.clip.h);
|
||||
|
||||
alphas = eina_list_append(alphas, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is any pending transparent object, then no overlay */
|
||||
nooverlay = !!eina_list_count(alphas);
|
||||
|
||||
/* fprintf(stderr, "count : %i\n", eina_list_count(alphas)); */
|
||||
|
||||
EINA_LIST_FREE(alphas, r)
|
||||
eina_rectangle_free(r);
|
||||
EINA_LIST_FREE(opaques, r)
|
||||
eina_rectangle_free(r);
|
||||
|
||||
if (nooverlay)
|
||||
return EINA_FALSE;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
|
||||
|
@ -1074,6 +1275,7 @@ evas_render_updates_internal(Evas *e,
|
|||
unsigned char make_updates,
|
||||
unsigned char do_draw)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
Eina_List *updates = NULL;
|
||||
Eina_List *ll;
|
||||
void *surface;
|
||||
|
@ -1111,11 +1313,22 @@ evas_render_updates_internal(Evas *e,
|
|||
_evas_render_phase1_direct(e, &e->active_objects, &e->restack_objects,
|
||||
&e->delete_objects, &e->render_objects);
|
||||
|
||||
/* phase 1.5. check if the video should be inlined or stay in their overlay */
|
||||
alpha = e->engine.func->canvas_alpha_get(e->engine.data.output,
|
||||
e->engine.data.context);
|
||||
|
||||
EINA_LIST_FOREACH(e->video_objects, ll, obj)
|
||||
{
|
||||
/* we need the surface to be transparent to display the underlying overlay */
|
||||
if (alpha && _evas_render_can_use_overlay(e, obj))
|
||||
_evas_object_image_video_overlay_show(obj);
|
||||
else
|
||||
_evas_object_image_video_overlay_hide(obj);
|
||||
}
|
||||
|
||||
/* phase 2. force updates for restacks */
|
||||
for (i = 0; i < e->restack_objects.count; ++i)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = eina_array_data_get(&e->restack_objects, i);
|
||||
obj->func->render_pre(obj);
|
||||
_evas_render_prev_cur_clip_cache_add(e, obj);
|
||||
|
@ -1162,8 +1375,6 @@ evas_render_updates_internal(Evas *e,
|
|||
/* build obscure objects list of active objects that obscure */
|
||||
for (i = 0; i < e->active_objects.count; ++i)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = eina_array_data_get(&e->active_objects, i);
|
||||
if (UNLIKELY((evas_object_is_opaque(obj) ||
|
||||
((obj->func->has_opaque_rect) &&
|
||||
|
@ -1177,6 +1388,7 @@ evas_render_updates_internal(Evas *e,
|
|||
/* obscuring_objects = eina_list_append(obscuring_objects, obj); */
|
||||
eina_array_push(&e->obscuring_objects, obj);
|
||||
}
|
||||
|
||||
/* save this list */
|
||||
/* obscuring_objects_orig = obscuring_objects; */
|
||||
/* obscuring_objects = NULL; */
|
||||
|
@ -1185,8 +1397,6 @@ evas_render_updates_internal(Evas *e,
|
|||
{
|
||||
unsigned int offset = 0;
|
||||
|
||||
alpha = e->engine.func->canvas_alpha_get(e->engine.data.output,
|
||||
e->engine.data.context);
|
||||
while ((surface =
|
||||
e->engine.func->output_redraws_next_update_get
|
||||
(e->engine.data.output,
|
||||
|
@ -1210,8 +1420,6 @@ evas_render_updates_internal(Evas *e,
|
|||
/* build obscuring objects list (in order from bottom to top) */
|
||||
for (i = 0; i < e->obscuring_objects.count; ++i)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = (Evas_Object *)eina_array_data_get
|
||||
(&e->obscuring_objects, i);
|
||||
if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh))
|
||||
|
@ -1283,8 +1491,6 @@ evas_render_updates_internal(Evas *e,
|
|||
/* render all object that intersect with rect */
|
||||
for (i = 0; i < e->active_objects.count; ++i)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = eina_array_data_get(&e->active_objects, i);
|
||||
|
||||
/* if it's in our outpout rect and it doesn't clip anything */
|
||||
|
@ -1408,8 +1614,6 @@ evas_render_updates_internal(Evas *e,
|
|||
/* and do a post render pass */
|
||||
for (i = 0; i < e->active_objects.count; ++i)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = eina_array_data_get(&e->active_objects, i);
|
||||
obj->pre_render_done = 0;
|
||||
RD(" OBJ [%p] post... %i %i\n", obj, obj->changed, do_draw);
|
||||
|
@ -1451,8 +1655,6 @@ evas_render_updates_internal(Evas *e,
|
|||
|
||||
for (i = 0; i < e->render_objects.count; ++i)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = eina_array_data_get(&e->render_objects, i);
|
||||
obj->pre_render_done = 0;
|
||||
}
|
||||
|
@ -1460,8 +1662,6 @@ evas_render_updates_internal(Evas *e,
|
|||
/* delete all objects flagged for deletion now */
|
||||
for (i = 0; i < e->delete_objects.count; ++i)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
obj = eina_array_data_get(&e->delete_objects, i);
|
||||
evas_object_free(obj, 1);
|
||||
}
|
||||
|
|
|
@ -346,9 +346,10 @@ struct _Evas
|
|||
Eina_Array temporary_objects;
|
||||
Eina_Array calculate_objects;
|
||||
Eina_Array clip_changes;
|
||||
|
||||
|
||||
Eina_List *calc_list;
|
||||
Eina_List *calc_list_current;
|
||||
Eina_List *video_objects;
|
||||
|
||||
Eina_List *post_events; // free me on evas_free
|
||||
|
||||
|
@ -901,6 +902,9 @@ const Evas_Smart_Cb_Description *evas_smart_cb_description_find(const Evas_Smart
|
|||
Eina_Bool _evas_object_image_preloading_get(const Evas_Object *obj);
|
||||
void _evas_object_image_preloading_set(Evas_Object *obj, Eina_Bool preloading);
|
||||
void _evas_object_image_preloading_check(Evas_Object *obj);
|
||||
Evas_Object *_evas_object_image_video_parent_get(Evas_Object *obj);
|
||||
void _evas_object_image_video_overlay_show(Evas_Object *obj);
|
||||
void _evas_object_image_video_overlay_hide(Evas_Object *obj);
|
||||
void evas_object_smart_del(Evas_Object *obj);
|
||||
void evas_object_smart_cleanup(Evas_Object *obj);
|
||||
void evas_object_smart_member_raise(Evas_Object *member);
|
||||
|
|
Loading…
Reference in New Issue