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
This commit is contained in:
Shinwoo Kim 2020-02-04 12:06:37 +09:00 committed by Hermet Park
parent 02245a2494
commit 50f3648391
2 changed files with 47 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);
}