summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-12-18 17:33:49 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-18 20:49:46 +0900
commita2309c5083a643011b4e69347d6be4da3a0adee8 (patch)
treea3995f0c91782e9a92cdf5b85d0d8cd3e4f61fed /src/lib
parent81ba035f6935128b2c025c88de05cf2b8f2c0ead (diff)
efl_ui_image: apply load_size when API is called
Summary: when efl_image_load_size_set() is called, image only sets internal variable and not apply to the internal image. elm_image_prescale_set() is also affected. Test Plan: Run elementary_test->Image Prescale Reviewers: jpeg, eunue, woohyun Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5645
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_image.c35
-rw-r--r--src/lib/elementary/efl_ui_widget_image.h2
2 files changed, 19 insertions, 18 deletions
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 696413df8e..35ee4e7c37 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -578,7 +578,7 @@ _efl_ui_image_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Data *priv)
578 priv->smooth = EINA_TRUE; 578 priv->smooth = EINA_TRUE;
579 priv->fill_inside = EINA_TRUE; 579 priv->fill_inside = EINA_TRUE;
580 priv->aspect_fixed = EINA_TRUE; 580 priv->aspect_fixed = EINA_TRUE;
581 priv->load_size = 0; 581 priv->load_size = EINA_SIZE2D(0, 0);
582 priv->scale = 1.0; 582 priv->scale = 1.0;
583 priv->scale_up = EINA_TRUE; 583 priv->scale_up = EINA_TRUE;
584 priv->scale_down = EINA_TRUE; 584 priv->scale_down = EINA_TRUE;
@@ -810,6 +810,16 @@ _efl_ui_image_sizing_eval(Evas_Object *obj)
810} 810}
811 811
812static void 812static void
813_efl_ui_image_load_size_set_internal(Evas_Object *obj, Efl_Ui_Image_Data *sd)
814{
815 Eina_Size2D sz = sd->load_size;
816
817 if ((sz.w <= 0) || (sz.h <= 0))
818 sz = efl_gfx_view_size_get(obj);
819 evas_object_image_load_size_set(sd->img, sz.w, sz.h);
820}
821
822static void
813_efl_ui_image_file_set_do(Evas_Object *obj) 823_efl_ui_image_file_set_do(Evas_Object *obj)
814{ 824{
815 Evas_Object *pclip = NULL; 825 Evas_Object *pclip = NULL;
@@ -831,13 +841,7 @@ _efl_ui_image_file_set_do(Evas_Object *obj)
831 841
832 sd->edje = EINA_FALSE; 842 sd->edje = EINA_FALSE;
833 843
834 if (sd->load_size > 0) 844 _efl_ui_image_load_size_set_internal(obj, sd);
835 evas_object_image_load_size_set(sd->img, sd->load_size, sd->load_size);
836 else
837 {
838 Eina_Size2D sz = efl_gfx_view_size_get(obj);
839 evas_object_image_load_size_set(sd->img, sz.w, sz.h);
840 }
841} 845}
842 846
843static void 847static void
@@ -1283,30 +1287,27 @@ elm_image_prescale_set(Evas_Object *obj,
1283} 1287}
1284 1288
1285EOLIAN static void 1289EOLIAN static void
1286_efl_ui_image_efl_image_load_load_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, Eina_Size2D sz) 1290_efl_ui_image_efl_image_load_load_size_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Size2D sz)
1287{ 1291{
1288 // FIXME: This should handle both dimensions! 1292 sd->load_size = sz;
1289 if (sz.w > sz.h) 1293 _efl_ui_image_load_size_set_internal(obj, sd);
1290 sd->load_size = sz.w;
1291 else
1292 sd->load_size = sz.h;
1293} 1294}
1294 1295
1295EAPI int 1296EAPI int
1296elm_image_prescale_get(const Evas_Object *obj) 1297elm_image_prescale_get(const Evas_Object *obj)
1297{ 1298{
1298 Eina_Size2D sz; 1299 Eina_Size2D sz;
1299
1300 EFL_UI_IMAGE_CHECK(obj) 0; 1300 EFL_UI_IMAGE_CHECK(obj) 0;
1301 1301
1302 sz = efl_image_load_size_get(obj); 1302 sz = efl_image_load_size_get(obj);
1303 return sz.w; 1303
1304 return MAX(sz.w, sz.h);
1304} 1305}
1305 1306
1306EOLIAN static Eina_Size2D 1307EOLIAN static Eina_Size2D
1307_efl_ui_image_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) 1308_efl_ui_image_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
1308{ 1309{
1309 return EINA_SIZE2D(sd->load_size, sd->load_size); 1310 return sd->load_size;
1310} 1311}
1311 1312
1312EOLIAN static void 1313EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h
index 88759c4a13..e5c45eb225 100644
--- a/src/lib/elementary/efl_ui_widget_image.h
+++ b/src/lib/elementary/efl_ui_widget_image.h
@@ -61,7 +61,7 @@ struct _Efl_Ui_Image_Data
61 61
62 Evas_Coord img_x, img_y, img_w, img_h; 62 Evas_Coord img_x, img_y, img_w, img_h;
63 63
64 int load_size; 64 Eina_Size2D load_size;
65 int frame_count; 65 int frame_count;
66 int cur_frame; 66 int cur_frame;
67 67