efl: Use Eina.Size2D for image load size

This commit is contained in:
Jean-Philippe Andre 2017-09-18 20:56:45 +09:00
parent 89a7d9ea8e
commit a3250f975a
5 changed files with 30 additions and 27 deletions

View File

@ -68,8 +68,7 @@ interface Efl.Image.Load ()
[[Returns the requested load size.]] [[Returns the requested load size.]]
} }
values { values {
w: int; [[Width of the image's load size.]] size: Eina.Size2D; [[The image load size.]]
h: int; [[Height of the image's load size.]]
} }
} }
@property load_dpi { @property load_dpi {

View File

@ -1272,33 +1272,34 @@ elm_image_prescale_set(Evas_Object *obj,
int size) int size)
{ {
EFL_UI_IMAGE_CHECK(obj); 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 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) // FIXME: This should handle both dimensions!
sd->load_size = w; if (sz.w > sz.h)
sd->load_size = sz.w;
else else
sd->load_size = h; sd->load_size = sz.h;
} }
EAPI int EAPI int
elm_image_prescale_get(const Evas_Object *obj) elm_image_prescale_get(const Evas_Object *obj)
{ {
Eina_Size2D sz;
EFL_UI_IMAGE_CHECK(obj) 0; EFL_UI_IMAGE_CHECK(obj) 0;
int w = 0; sz = efl_image_load_size_get(obj);
efl_image_load_size_get((Eo *)obj, &w, NULL); return sz.w;
return w;
} }
EOLIAN static void EOLIAN static Eina_Size2D
_efl_ui_image_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h) _efl_ui_image_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
{ {
if (w) *w = sd->load_size; return EINA_SIZE2D(sd->load_size, sd->load_size);
if (h) *h = sd->load_size;
} }
EOLIAN static void EOLIAN static void

View File

@ -757,17 +757,18 @@ emotion_object_play_length_get(const Evas_Object *obj)
EAPI void EAPI void
emotion_object_size_get(const Evas_Object *obj, int *iw, int *ih) emotion_object_size_get(const Evas_Object *obj, int *iw, int *ih)
{ {
if (iw) *iw = 0; Eina_Size2D sz;
if (ih) *ih = 0;
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 EOLIAN static Eina_Size2D
_efl_canvas_video_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, int *iw, int *ih) _efl_canvas_video_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
{ {
if (iw) *iw = sd->video.w; // FIXME: Shouldn't this be efl_gfx_view_size instead?
if (ih) *ih = sd->video.h; return EINA_SIZE2D(sd->video.w, sd->video.h);
} }
EAPI void EAPI void

View File

@ -270,9 +270,9 @@ _evas_image_load_size_set(Eo *eo_obj, int w, int h)
} }
EOLIAN static void 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 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; if (h) *h = o->load_opts->h;
} }
EOLIAN static void EOLIAN static Eina_Size2D
_efl_canvas_image_efl_image_load_load_size_get(Eo *eo_obj, void *_pd EINA_UNUSED EINA_UNUSED, int *w, int *h) _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 void

View 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; 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) _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); return EINA_SIZE2D(o->file_size.w, o->file_size.h);