hermet pushed a commit to branch master.

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

commit 50f3648391c1fc6045bf29168e7ff9d9f65cbdf4
Author: Shinwoo Kim <[email protected]>
Date:   Tue Feb 4 12:06:37 2020 +0900

    evas proxy: make it work for File_Save.save
    
    Summary:
    File_Save.save does not work for proxy object from following commit.
    
       c53f152 evas: Make save() work on snapshots
    
    Test Plan:
    1. Add an image object and set source object.
    evas_object_image_source_set(obj, source);
    
    2. Save the object as a file when you need.
    evas_object_image_save(obj, "./file_name.png", NULL, NULL);
    
    Reviewers: cedric, Hermet, jsuya
    
    Reviewed By: Hermet
    
    Subscribers: zmike, subodh6129, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D10629
---
 src/lib/evas/canvas/evas_object_image.c |  2 ++
 src/tests/evas/evas_test_image.c        | 45 +++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/src/lib/evas/canvas/evas_object_image.c 
b/src/lib/evas/canvas/evas_object_image.c
index fa3a4a8462..ab4d5e6f4c 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -2301,6 +2301,8 @@ _evas_image_pixels_get(Eo *eo_obj, 
Evas_Object_Protected_Data *obj,
 
    if (filtered && o->has_filter)
      pixels = evas_filter_output_buffer_get(eo_obj);
+   else
+     needs_post_render = EINA_FALSE;
 
    if (!pixels && o->cur->source)
      {
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index bfc581992a..3f39b270e5 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -1117,6 +1117,50 @@ EFL_START_TEST(evas_object_image_9patch)
 }
 EFL_END_TEST
 
+EFL_START_TEST(evas_object_image_save_from_proxy)
+{
+   Evas *e;
+   Evas_Object *obj, *proxy, *ref;
+   int w, h, r_w, r_h;
+   const uint32_t *d, *r_d;
+   const char *img_path, *img_path2;
+   Eina_Bool ret;
+
+   e = _setup_evas();
+   img_path = TESTS_IMG_DIR "/Pic1.png";
+   img_path2 = TESTS_IMG_DIR "/Pic1_saved.png";
+
+   obj = evas_object_image_add(e);
+   proxy = evas_object_image_add(e);
+   ref = evas_object_image_add(e);
+
+   evas_object_image_file_set(obj, img_path, NULL);
+   fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
+   evas_object_image_size_get(obj, &w, &h);
+   d = evas_object_image_data_get(obj, EINA_FALSE);
+
+   evas_object_image_source_set(proxy, obj);
+   ret = evas_object_image_save(proxy, img_path2, NULL, NULL);
+   fail_if(!ret);
+
+   evas_object_image_file_set(ref, img_path2, NULL);
+   fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
+   evas_object_image_size_get(ref, &r_w, &r_h);
+   r_d = evas_object_image_data_get(ref, EINA_FALSE);
+
+   fail_if(w != r_w || h != r_h);
+   fail_if(memcmp(d, r_d, w * h * 4));
+
+   evas_object_del(proxy);
+   evas_object_del(obj);
+   evas_object_del(ref);
+
+   remove(img_path2);
+
+   evas_free(e);
+}
+EFL_END_TEST
+
 void evas_test_image_object(TCase *tc)
 {
    tcase_add_test(tc, evas_object_image_api);
@@ -1143,6 +1187,7 @@ void evas_test_image_object(TCase *tc)
    tcase_add_test(tc, evas_object_image_partially_load_orientation);
    tcase_add_test(tc, evas_object_image_cached_data_comparision);
    tcase_add_test(tc, evas_object_image_9patch);
+   tcase_add_test(tc, evas_object_image_save_from_proxy);
 }
 
 

-- 


Reply via email to