diff options
author | Shinwoo Kim <cinoo.kim@samsung.com> | 2020-02-04 12:06:37 +0900 |
---|---|---|
committer | Hermet Park <hermetpark@gmail.com> | 2020-02-04 12:06:38 +0900 |
commit | 50f3648391c1fc6045bf29168e7ff9d9f65cbdf4 (patch) | |
tree | e1f6e4bfe5200d11a583edeeb866be14f7e40f02 | |
parent | 02245a2494ea27e14cd6390f00c0989ed568663f (diff) |
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
-rw-r--r-- | src/lib/evas/canvas/evas_object_image.c | 2 | ||||
-rw-r--r-- | src/tests/evas/evas_test_image.c | 45 |
2 files changed, 47 insertions, 0 deletions
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, | |||
2301 | 2301 | ||
2302 | if (filtered && o->has_filter) | 2302 | if (filtered && o->has_filter) |
2303 | pixels = evas_filter_output_buffer_get(eo_obj); | 2303 | pixels = evas_filter_output_buffer_get(eo_obj); |
2304 | else | ||
2305 | needs_post_render = EINA_FALSE; | ||
2304 | 2306 | ||
2305 | if (!pixels && o->cur->source) | 2307 | if (!pixels && o->cur->source) |
2306 | { | 2308 | { |
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) | |||
1117 | } | 1117 | } |
1118 | EFL_END_TEST | 1118 | EFL_END_TEST |
1119 | 1119 | ||
1120 | EFL_START_TEST(evas_object_image_save_from_proxy) | ||
1121 | { | ||
1122 | Evas *e; | ||
1123 | Evas_Object *obj, *proxy, *ref; | ||
1124 | int w, h, r_w, r_h; | ||
1125 | const uint32_t *d, *r_d; | ||
1126 | const char *img_path, *img_path2; | ||
1127 | Eina_Bool ret; | ||
1128 | |||
1129 | e = _setup_evas(); | ||
1130 | img_path = TESTS_IMG_DIR "/Pic1.png"; | ||
1131 | img_path2 = TESTS_IMG_DIR "/Pic1_saved.png"; | ||
1132 | |||
1133 | obj = evas_object_image_add(e); | ||
1134 | proxy = evas_object_image_add(e); | ||
1135 | ref = evas_object_image_add(e); | ||
1136 | |||
1137 | evas_object_image_file_set(obj, img_path, NULL); | ||
1138 | fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE); | ||
1139 | evas_object_image_size_get(obj, &w, &h); | ||
1140 | d = evas_object_image_data_get(obj, EINA_FALSE); | ||
1141 | |||
1142 | evas_object_image_source_set(proxy, obj); | ||
1143 | ret = evas_object_image_save(proxy, img_path2, NULL, NULL); | ||
1144 | fail_if(!ret); | ||
1145 | |||
1146 | evas_object_image_file_set(ref, img_path2, NULL); | ||
1147 | fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE); | ||
1148 | evas_object_image_size_get(ref, &r_w, &r_h); | ||
1149 | r_d = evas_object_image_data_get(ref, EINA_FALSE); | ||
1150 | |||
1151 | fail_if(w != r_w || h != r_h); | ||
1152 | fail_if(memcmp(d, r_d, w * h * 4)); | ||
1153 | |||
1154 | evas_object_del(proxy); | ||
1155 | evas_object_del(obj); | ||
1156 | evas_object_del(ref); | ||
1157 | |||
1158 | remove(img_path2); | ||
1159 | |||
1160 | evas_free(e); | ||
1161 | } | ||
1162 | EFL_END_TEST | ||
1163 | |||
1120 | void evas_test_image_object(TCase *tc) | 1164 | void evas_test_image_object(TCase *tc) |
1121 | { | 1165 | { |
1122 | tcase_add_test(tc, evas_object_image_api); | 1166 | tcase_add_test(tc, evas_object_image_api); |
@@ -1143,6 +1187,7 @@ void evas_test_image_object(TCase *tc) | |||
1143 | tcase_add_test(tc, evas_object_image_partially_load_orientation); | 1187 | tcase_add_test(tc, evas_object_image_partially_load_orientation); |
1144 | tcase_add_test(tc, evas_object_image_cached_data_comparision); | 1188 | tcase_add_test(tc, evas_object_image_cached_data_comparision); |
1145 | tcase_add_test(tc, evas_object_image_9patch); | 1189 | tcase_add_test(tc, evas_object_image_9patch); |
1190 | tcase_add_test(tc, evas_object_image_save_from_proxy); | ||
1146 | } | 1191 | } |
1147 | 1192 | ||
1148 | 1193 | ||