summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiin.moon <jiin.moon@samsung.com>2015-09-04 13:39:26 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-09-04 13:51:58 +0900
commit3190c11c83a941f559a02ab06820108e0189af15 (patch)
treed667537cadea4117285d64a2b73307be878861ef
parent01ef11eb56f73af38ba8a3e7f6a5fc2b31a7f53d (diff)
elm_image: fix image preload issue
Summary: There are two issues about preload 1. elm_image_preload_disabled_set api does not work. Always returned before call the evas_object_image_preload() 2. image preload does not work at file_set time. If image's show property is not TRUE, do not call evas_object_image_preload() at file_set time. But there is no action when image's show property will be TRUE after call the file_set api. @fix Reviewers: Hermet, jpeg Differential Revision: https://phab.enlightenment.org/D2989 Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
-rw-r--r--src/lib/elm_image.c38
-rw-r--r--src/lib/elm_widget_image.h10
2 files changed, 30 insertions, 18 deletions
diff --git a/src/lib/elm_image.c b/src/lib/elm_image.c
index f1b7b5796..9c043b8c7 100644
--- a/src/lib/elm_image.c
+++ b/src/lib/elm_image.c
@@ -56,7 +56,7 @@ _on_image_preloaded(void *data,
56 void *event EINA_UNUSED) 56 void *event EINA_UNUSED)
57{ 57{
58 Elm_Image_Data *sd = data; 58 Elm_Image_Data *sd = data;
59 sd->preloading = EINA_FALSE; 59 sd->preload_status = ELM_IMAGE_PRELOADED;
60 if (sd->show) evas_object_show(obj); 60 if (sd->show) evas_object_show(obj);
61 ELM_SAFE_FREE(sd->prev_img, evas_object_del); 61 ELM_SAFE_FREE(sd->prev_img, evas_object_del);
62} 62}
@@ -714,7 +714,7 @@ EOLIAN static void
714_elm_image_evas_object_smart_show(Eo *obj, Elm_Image_Data *sd) 714_elm_image_evas_object_smart_show(Eo *obj, Elm_Image_Data *sd)
715{ 715{
716 sd->show = EINA_TRUE; 716 sd->show = EINA_TRUE;
717 if (sd->preloading) return; 717 if (sd->preload_status == ELM_IMAGE_PRELOADING) return;
718 718
719 eo_do_super(obj, MY_CLASS, evas_obj_smart_show()); 719 eo_do_super(obj, MY_CLASS, evas_obj_smart_show());
720 720
@@ -904,7 +904,7 @@ _elm_image_memfile_set(Eo *obj, Elm_Image_Data *sd, const void *img, size_t size
904 evas_object_image_memfile_set 904 evas_object_image_memfile_set
905 (sd->img, (void *)img, size, (char *)format, (char *)key); 905 (sd->img, (void *)img, size, (char *)format, (char *)key);
906 906
907 sd->preloading = EINA_TRUE; 907 sd->preload_status = ELM_IMAGE_PRELOADING;
908 evas_object_image_preload(sd->img, EINA_FALSE); 908 evas_object_image_preload(sd->img, EINA_FALSE);
909 909
910 if (evas_object_image_load_error_get(sd->img) != EVAS_LOAD_ERROR_NONE) 910 if (evas_object_image_load_error_get(sd->img) != EVAS_LOAD_ERROR_NONE)
@@ -1019,11 +1019,10 @@ _elm_image_smart_internal_file_set(Eo *obj, Elm_Image_Data *sd,
1019 else 1019 else
1020 evas_object_image_file_set(sd->img, file, key); 1020 evas_object_image_file_set(sd->img, file, key);
1021 1021
1022 evas_object_hide(sd->img); 1022 if (sd->preload_status != ELM_IMAGE_PRELOAD_DISABLED)
1023
1024 if (evas_object_visible_get(obj))
1025 { 1023 {
1026 sd->preloading = EINA_TRUE; 1024 evas_object_hide(sd->img);
1025 sd->preload_status = ELM_IMAGE_PRELOADING;
1027 evas_object_image_preload(sd->img, EINA_FALSE); 1026 evas_object_image_preload(sd->img, EINA_FALSE);
1028 } 1027 }
1029 1028
@@ -1068,9 +1067,9 @@ _elm_image_smart_download_done(void *data, Elm_Url *url EINA_UNUSED, Eina_Binbuf
1068 } 1067 }
1069 else 1068 else
1070 { 1069 {
1071 if (evas_object_visible_get(obj)) 1070 if (sd->preload_status != ELM_IMAGE_PRELOAD_DISABLED)
1072 { 1071 {
1073 sd->preloading = EINA_TRUE; 1072 sd->preload_status = ELM_IMAGE_PRELOADING;
1074 evas_object_image_preload(sd->img, EINA_FALSE); 1073 evas_object_image_preload(sd->img, EINA_FALSE);
1075 } 1074 }
1076 1075
@@ -1340,18 +1339,23 @@ _elm_image_fill_outside_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
1340EOLIAN static void 1339EOLIAN static void
1341_elm_image_preload_disabled_set(Eo *obj EINA_UNUSED, Elm_Image_Data *sd, Eina_Bool disable) 1340_elm_image_preload_disabled_set(Eo *obj EINA_UNUSED, Elm_Image_Data *sd, Eina_Bool disable)
1342{ 1341{
1343 if (sd->edje || !sd->preloading) return; 1342 if (sd->edje || !sd->img) return;
1344
1345 //FIXME: Need to keep the disabled status for next image loading.
1346
1347 evas_object_image_preload(sd->img, disable);
1348 sd->preloading = !disable;
1349 1343
1350 if (disable) 1344 if (disable)
1351 { 1345 {
1352 if (sd->show && sd->img) evas_object_show(sd->img); 1346 if (sd->preload_status == ELM_IMAGE_PRELOADING)
1353 ELM_SAFE_FREE(sd->prev_img, evas_object_del); 1347 {
1348 evas_object_image_preload(sd->img, disable);
1349 if (sd->show) evas_object_show(sd->img);
1350 ELM_SAFE_FREE(sd->prev_img, evas_object_del);
1351 }
1352 sd->preload_status = ELM_IMAGE_PRELOAD_DISABLED;
1354 } 1353 }
1354 else if (sd->preload_status == ELM_IMAGE_PRELOAD_DISABLED)
1355 {
1356 sd->preload_status = ELM_IMAGE_PRELOADING;
1357 evas_object_image_preload(sd->img, disable);
1358 }
1355} 1359}
1356 1360
1357EAPI void 1361EAPI void
diff --git a/src/lib/elm_widget_image.h b/src/lib/elm_widget_image.h
index 1c3079c03..7836d9083 100644
--- a/src/lib/elm_widget_image.h
+++ b/src/lib/elm_widget_image.h
@@ -10,6 +10,13 @@
10 */ 10 */
11 11
12typedef struct _Async_Open_Data Async_Open_Data; 12typedef struct _Async_Open_Data Async_Open_Data;
13typedef enum
14 {
15 ELM_IMAGE_PRELOAD_ENABLED,
16 ELM_IMAGE_PRELOADING,
17 ELM_IMAGE_PRELOADED,
18 ELM_IMAGE_PRELOAD_DISABLED
19 } Elm_Image_Preload_Status;
13 20
14/** 21/**
15 * @addtogroup Widget 22 * @addtogroup Widget
@@ -63,10 +70,11 @@ struct _Elm_Image_Data
63 Eina_Spinlock lck; 70 Eina_Spinlock lck;
64 } async; 71 } async;
65 72
73 Elm_Image_Preload_Status preload_status;
74
66 Eina_Bool aspect_fixed : 1; 75 Eina_Bool aspect_fixed : 1;
67 Eina_Bool fill_inside : 1; 76 Eina_Bool fill_inside : 1;
68 Eina_Bool resize_down : 1; 77 Eina_Bool resize_down : 1;
69 Eina_Bool preloading : 1;
70 Eina_Bool resize_up : 1; 78 Eina_Bool resize_up : 1;
71 Eina_Bool no_scale : 1; 79 Eina_Bool no_scale : 1;
72 Eina_Bool smooth : 1; 80 Eina_Bool smooth : 1;