efl: Use Eina.Size2D for image load size
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 18 Sep 2017 11:56:45 +0000 (20:56 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 19 Sep 2017 01:51:48 +0000 (10:51 +0900)
src/lib/efl/interfaces/efl_image_load.eo
src/lib/elementary/efl_ui_image.c
src/lib/emotion/emotion_smart.c
src/lib/evas/canvas/efl_canvas_image.c
src/lib/evas/canvas/evas_object_image.c

index 18d6590..53f549f 100644 (file)
@@ -68,8 +68,7 @@ interface Efl.Image.Load ()
             [[Returns the requested load size.]]
          }
          values {
-            w: int; [[Width of the image's load size.]]
-            h: int; [[Height of the image's load size.]]
+            size: Eina.Size2D; [[The image load size.]]
          }
       }
       @property load_dpi {
index 319ef14..f27daba 100644 (file)
@@ -1272,33 +1272,34 @@ elm_image_prescale_set(Evas_Object *obj,
                        int size)
 {
    EFL_UI_IMAGE_CHECK(obj);
-   efl_image_load_size_set(obj, size, size);
+   efl_image_load_size_set(obj, EINA_SIZE2D(size, size));
 }
 
 EOLIAN static void
-_efl_ui_image_efl_image_load_load_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int w, int h)
+_efl_ui_image_efl_image_load_load_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, Eina_Size2D sz)
 {
-   if (w > h)
-      sd->load_size = w;
+   // FIXME: This should handle both dimensions!
+   if (sz.w > sz.h)
+      sd->load_size = sz.w;
    else
-      sd->load_size = h;
+      sd->load_size = sz.h;
 }
 
 EAPI int
 elm_image_prescale_get(const Evas_Object *obj)
 {
+   Eina_Size2D sz;
+
    EFL_UI_IMAGE_CHECK(obj) 0;
 
-   int w = 0;
-   efl_image_load_size_get((Eo *)obj, &w, NULL);
-   return w;
+   sz = efl_image_load_size_get(obj);
+   return sz.w;
 }
 
-EOLIAN static void
-_efl_ui_image_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h)
+EOLIAN static Eina_Size2D
+_efl_ui_image_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
 {
-   if (w) *w = sd->load_size;
-   if (h) *h = sd->load_size;
+   return EINA_SIZE2D(sd->load_size, sd->load_size);
 }
 
 EOLIAN static void
index 0cdbaae..04e1901 100644 (file)
@@ -757,17 +757,18 @@ emotion_object_play_length_get(const Evas_Object *obj)
 EAPI void
 emotion_object_size_get(const Evas_Object *obj, int *iw, int *ih)
 {
-   if (iw) *iw = 0;
-   if (ih) *ih = 0;
+   Eina_Size2D sz;
 
-   efl_image_load_size_get(obj, iw, ih);
+   sz = efl_image_load_size_get(obj);
+   if (iw) *iw = sz.w;
+   if (ih) *ih = sz.h;
 }
 
-EOLIAN static void
-_efl_canvas_video_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, int *iw, int *ih)
+EOLIAN static Eina_Size2D
+_efl_canvas_video_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
 {
-   if (iw) *iw = sd->video.w;
-   if (ih) *ih = sd->video.h;
+   // FIXME: Shouldn't this be efl_gfx_view_size instead?
+   return EINA_SIZE2D(sd->video.w, sd->video.h);
 }
 
 EAPI void
index b463451..13e8e5a 100644 (file)
@@ -270,9 +270,9 @@ _evas_image_load_size_set(Eo *eo_obj, int w, int h)
 }
 
 EOLIAN static void
-_efl_canvas_image_efl_image_load_load_size_set(Eo *eo_obj, void *_pd EINA_UNUSED EINA_UNUSED, int w, int h)
+_efl_canvas_image_efl_image_load_load_size_set(Eo *eo_obj, void *_pd EINA_UNUSED EINA_UNUSED, Eina_Size2D sz)
 {
-   _evas_image_load_size_set(eo_obj, w, h);
+   _evas_image_load_size_set(eo_obj, sz.w, sz.h);
 }
 
 void
@@ -284,10 +284,12 @@ _evas_image_load_size_get(const Eo *eo_obj, int *w, int *h)
    if (h) *h = o->load_opts->h;
 }
 
-EOLIAN static void
-_efl_canvas_image_efl_image_load_load_size_get(Eo *eo_obj, void *_pd EINA_UNUSED EINA_UNUSED, int *w, int *h)
+EOLIAN static Eina_Size2D
+_efl_canvas_image_efl_image_load_load_size_get(Eo *eo_obj, void *_pd EINA_UNUSED EINA_UNUSED)
 {
-   _evas_image_load_size_get(eo_obj, w, h);
+   Eina_Size2D sz;
+   _evas_image_load_size_get(eo_obj, &sz.w, &sz.h);
+   return sz;
 }
 
 void
index c99e860..313dad9 100644 (file)
@@ -682,7 +682,7 @@ _efl_canvas_image_internal_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Im
    return (Eina_Rect) o->cur->fill;
 }
 
-EOLIAN static void
+EOLIAN static Eina_Size2D
 _efl_canvas_image_internal_efl_image_image_size_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
 {
    return EINA_SIZE2D(o->file_size.w, o->file_size.h);