evas/image: implement efl.file loading and mmap getters to correctly handle skip_head

when this property is set, the mixin implementation of efl_file_load() is
never called, which means the internal loaded flag (and related data) is
not set, and so the values for these properties must instead be returned
directly from the image data

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11423
This commit is contained in:
Mike Blumenkrantz 2020-02-26 09:41:14 -05:00 committed by Marcel Hollerbach
parent 576229bf6a
commit bab8fcc442
4 changed files with 40 additions and 0 deletions

View File

@ -68,6 +68,24 @@ _evas_image_file_load(Eo *eo_obj, Evas_Image_Data *o)
return EINA_TRUE;
}
EOLIAN static Eina_Bool
_efl_canvas_image_efl_file_loaded_get(const Eo *eo_obj, void *_pd EINA_UNUSED)
{
Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
if (!o->skip_head)
return efl_file_loaded_get(efl_super(eo_obj, MY_CLASS));
return !!o->cur->f;
}
EOLIAN static const Eina_File *
_efl_canvas_image_efl_file_mmap_get(const Eo *eo_obj, void *_pd EINA_UNUSED)
{
Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
if (!o->skip_head)
return efl_file_mmap_get(efl_super(eo_obj, MY_CLASS));
return o->cur->f;
}
EOLIAN static Eina_Error
_efl_canvas_image_efl_file_load(Eo *eo_obj, void *_pd EINA_UNUSED)
{

View File

@ -16,6 +16,8 @@ class @beta Efl.Canvas.Image extends Efl.Canvas.Image_Internal implements
Efl.Gfx.Buffer.buffer_size { get; }
Efl.Gfx.Buffer.buffer_map;
Efl.Gfx.Buffer.buffer_unmap;
Efl.File.loaded { get; }
Efl.File.mmap { get; }
Efl.File.load;
Efl.File.unload;
Efl.Gfx.Frame_Controller.animated { get; }

View File

@ -14,6 +14,8 @@ _evas_image_class_initializer(Efl_Class *klass)
#endif
EFL_OPS_DEFINE(ops,
EFL_OBJECT_OP_FUNC(efl_file_loaded_get, _evas_image_efl_file_loaded_get),
EFL_OBJECT_OP_FUNC(efl_file_mmap_get, _evas_image_efl_file_mmap_get),
EFL_OBJECT_OP_FUNC(efl_file_load, _evas_image_efl_file_load),
EFL_OBJECT_OP_FUNC(efl_file_unload, _evas_image_efl_file_unload),
EVAS_IMAGE_EXTRA_OPS

View File

@ -1281,6 +1281,24 @@ evas_object_image_alpha_mask_set(Evas_Object *eo_obj EINA_UNUSED, Eina_Bool isma
EVAS_IMAGE_LEGACY_API(eo_obj);
}
EOLIAN static Eina_Bool
_evas_image_efl_file_loaded_get(const Eo *eo_obj, void *_pd EINA_UNUSED)
{
Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
if (!o->skip_head)
return efl_file_loaded_get(efl_super(eo_obj, EVAS_IMAGE_CLASS));
return !!o->cur->f;
}
EOLIAN static const Eina_File *
_evas_image_efl_file_mmap_get(const Eo *eo_obj, void *_pd EINA_UNUSED)
{
Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
if (!o->skip_head)
return efl_file_mmap_get(efl_super(eo_obj, EVAS_IMAGE_CLASS));
return o->cur->f;
}
EOLIAN static Eina_Error
_evas_image_efl_file_load(Eo *obj, void *pd EINA_UNUSED)
{