zmike pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=acee4e1db53e00e145d845fe99a86b4dffe753f6

commit acee4e1db53e00e145d845fe99a86b4dffe753f6
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Fri Feb 14 08:33:43 2020 -0500

    evas: restore codepath for loading images from files with skip_head set
    
    Summary:
    this was never handled during refactoring because it had already been
    removed from the tree by that point
    
    fix T8378
    Depends on D11339
    
    Reviewers: raster
    
    Reviewed By: raster
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T8378
    
    Differential Revision: https://phab.enlightenment.org/D11340
---
 src/lib/evas/canvas/efl_canvas_image.c   | 21 ++++++++++++++-------
 src/lib/evas/canvas/evas_image_legacy.c  |  8 ++++++--
 src/lib/evas/canvas/evas_image_private.h |  2 +-
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/lib/evas/canvas/efl_canvas_image.c 
b/src/lib/evas/canvas/efl_canvas_image.c
index 1bdd5329ec..679fbdca05 100644
--- a/src/lib/evas/canvas/efl_canvas_image.c
+++ b/src/lib/evas/canvas/efl_canvas_image.c
@@ -20,18 +20,18 @@ _evas_image_file_unload(Eo *eo_obj)
    o->load_error = EFL_GFX_IMAGE_LOAD_ERROR_NONE;
 }
 Eina_Bool
-_evas_image_file_load(Eo *eo_obj)
+_evas_image_file_load(Eo *eo_obj, Evas_Image_Data *o)
 {
    Evas_Object_Protected_Data *obj;
-   Evas_Image_Data *o = efl_data_scope_get(eo_obj, 
EFL_CANVAS_IMAGE_INTERNAL_CLASS);
    Evas_Image_Load_Opts lo;
    const Eina_File *f = efl_file_mmap_get(eo_obj);
    const char *key = efl_file_key_get(eo_obj);
    int load_error;
 
-   EINA_SAFETY_ON_NULL_RETURN_VAL(f, EINA_FALSE);
+   if (!o->skip_head)
+     EINA_SAFETY_ON_NULL_RETURN_VAL(f, EINA_FALSE);
 
-   if (o->cur->f == f)
+   if (f && (o->cur->f == f))
      {
         if ((!o->cur->key) && (!key))
           return EINA_TRUE;
@@ -42,7 +42,10 @@ _evas_image_file_load(Eo *eo_obj)
    obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
    evas_object_async_block(obj);
    _evas_image_init_set(f, key, eo_obj, obj, o, &lo);
-   o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &load_error, 
&lo);
+   if (f)
+     o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, 
&load_error, &lo);
+   else
+     o->engine_data = ENFN->image_load(ENC, efl_file_get(eo_obj), o->cur->key, 
&load_error, &lo);
    o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
    o->buffer_data_set = EINA_FALSE;
    _evas_image_done_set(eo_obj, obj, o);
@@ -56,9 +59,13 @@ EOLIAN static Eina_Error
 _efl_canvas_image_efl_file_load(Eo *eo_obj, void *_pd EINA_UNUSED)
 {
    if (efl_file_loaded_get(eo_obj)) return 0;
-   Eina_Error err = efl_file_load(efl_super(eo_obj, MY_CLASS));
+   Evas_Image_Data *o = efl_data_scope_get(eo_obj, 
EFL_CANVAS_IMAGE_INTERNAL_CLASS);
+   Eina_Error err = 0;
+
+   if (!o->skip_head)
+     err = efl_file_load(efl_super(eo_obj, MY_CLASS));
    if (err) return err;
-   if (_evas_image_file_load(eo_obj))
+   if (_evas_image_file_load(eo_obj, o))
      return 0;
    return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST;
 }
diff --git a/src/lib/evas/canvas/evas_image_legacy.c 
b/src/lib/evas/canvas/evas_image_legacy.c
index dca17462b9..4e66bf2070 100644
--- a/src/lib/evas/canvas/evas_image_legacy.c
+++ b/src/lib/evas/canvas/evas_image_legacy.c
@@ -1286,7 +1286,11 @@ _evas_image_efl_file_load(Eo *obj, void *pd EINA_UNUSED)
 {
    EVAS_IMAGE_API(obj, EINA_FALSE);
    if (efl_file_loaded_get(obj)) return 0;
-   Eina_Error err = efl_file_load(efl_super(obj, EVAS_IMAGE_CLASS));
+   Evas_Image_Data *o = efl_data_scope_get(obj, 
EFL_CANVAS_IMAGE_INTERNAL_CLASS);
+   Eina_Error err = 0;
+
+   if (!o->skip_head)
+     err = efl_file_load(efl_super(obj, EVAS_IMAGE_CLASS));
    if (err)
      {
         if (err == ENOENT)
@@ -1299,7 +1303,7 @@ _evas_image_efl_file_load(Eo *obj, void *pd EINA_UNUSED)
           _efl_canvas_image_load_error_set(obj, 
EFL_GFX_IMAGE_LOAD_ERROR_GENERIC);
         return err;
      }
-   if (_evas_image_file_load(obj))
+   if (_evas_image_file_load(obj, o))
      return 0;
    return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST;
 }
diff --git a/src/lib/evas/canvas/evas_image_private.h 
b/src/lib/evas/canvas/evas_image_private.h
index 6d18205d1f..310d91236b 100644
--- a/src/lib/evas/canvas/evas_image_private.h
+++ b/src/lib/evas/canvas/evas_image_private.h
@@ -168,7 +168,7 @@ void *_evas_image_pixels_get(Eo *eo_obj, 
Evas_Object_Protected_Data *obj, void *
 void _evas_image_fill_set(Eo *eo_obj, Evas_Image_Data *o, int x, int y, int w, 
int h);
 
 /* Efl.File */
-Eina_Bool _evas_image_file_load(Eo *eo_obj);
+Eina_Bool _evas_image_file_load(Eo *eo_obj, Evas_Image_Data *o);
 void _evas_image_file_unload(Eo *eo_obj);
 const Eina_File *_evas_image_mmap_get(const Eo *eo_obj);
 const char *_evas_image_key_get(const Eo *eo_obj);

-- 


Reply via email to