forked from enlightenment/efl
efl: Use Eina.Size2D in Gfx.View
This commit is contained in:
parent
2df8ad36b4
commit
b19ee757e5
|
@ -1,3 +1,5 @@
|
||||||
|
import eina_types;
|
||||||
|
|
||||||
interface Efl.Gfx.View
|
interface Efl.Gfx.View
|
||||||
{
|
{
|
||||||
[[Efl graphics view interface]]
|
[[Efl graphics view interface]]
|
||||||
|
@ -28,8 +30,7 @@ interface Efl.Gfx.View
|
||||||
set {}
|
set {}
|
||||||
get {}
|
get {}
|
||||||
values {
|
values {
|
||||||
w: int; [[Width of the view.]]
|
size: Eina.Size2D; [[Size of the view.]]
|
||||||
h: int; [[Height of the view.]]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -749,7 +749,7 @@ void
|
||||||
_efl_ui_image_sizing_eval(Evas_Object *obj)
|
_efl_ui_image_sizing_eval(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
|
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
|
||||||
int w = 0, h = 0;
|
Eina_Size2D sz;
|
||||||
double ts;
|
double ts;
|
||||||
|
|
||||||
EFL_UI_IMAGE_DATA_GET_OR_RETURN(obj, sd);
|
EFL_UI_IMAGE_DATA_GET_OR_RETURN(obj, sd);
|
||||||
|
@ -764,37 +764,37 @@ _efl_ui_image_sizing_eval(Evas_Object *obj)
|
||||||
|
|
||||||
ts = sd->scale;
|
ts = sd->scale;
|
||||||
sd->scale = 1.0;
|
sd->scale = 1.0;
|
||||||
efl_gfx_view_size_get(obj, &w, &h);
|
sz = efl_gfx_view_size_get(obj);
|
||||||
|
|
||||||
sd->scale = ts;
|
sd->scale = ts;
|
||||||
evas_object_size_hint_combined_min_get(obj, &minw, &minh);
|
evas_object_size_hint_combined_min_get(obj, &minw, &minh);
|
||||||
|
|
||||||
if (sd->no_scale)
|
if (sd->no_scale)
|
||||||
{
|
{
|
||||||
maxw = minw = w;
|
maxw = minw = sz.w;
|
||||||
maxh = minh = h;
|
maxh = minh = sz.h;
|
||||||
if ((sd->scale > 1.0) && (sd->scale_up))
|
if ((sd->scale > 1.0) && (sd->scale_up))
|
||||||
{
|
{
|
||||||
maxw = minw = w * sd->scale;
|
maxw = minw = sz.w * sd->scale;
|
||||||
maxh = minh = h * sd->scale;
|
maxh = minh = sz.h * sd->scale;
|
||||||
}
|
}
|
||||||
else if ((sd->scale < 1.0) && (sd->scale_down))
|
else if ((sd->scale < 1.0) && (sd->scale_down))
|
||||||
{
|
{
|
||||||
maxw = minw = w * sd->scale;
|
maxw = minw = sz.w * sd->scale;
|
||||||
maxh = minh = h * sd->scale;
|
maxh = minh = sz.h * sd->scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!sd->scale_down)
|
if (!sd->scale_down)
|
||||||
{
|
{
|
||||||
minw = w * sd->scale;
|
minw = sz.w * sd->scale;
|
||||||
minh = h * sd->scale;
|
minh = sz.h * sd->scale;
|
||||||
}
|
}
|
||||||
if (!sd->scale_up)
|
if (!sd->scale_up)
|
||||||
{
|
{
|
||||||
maxw = w * sd->scale;
|
maxw = sz.w * sd->scale;
|
||||||
maxh = h * sd->scale;
|
maxh = sz.h * sd->scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,7 +806,6 @@ static void
|
||||||
_efl_ui_image_file_set_do(Evas_Object *obj)
|
_efl_ui_image_file_set_do(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Evas_Object *pclip = NULL;
|
Evas_Object *pclip = NULL;
|
||||||
int w = 0, h = 0;
|
|
||||||
|
|
||||||
EFL_UI_IMAGE_DATA_GET(obj, sd);
|
EFL_UI_IMAGE_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
@ -829,8 +828,8 @@ _efl_ui_image_file_set_do(Evas_Object *obj)
|
||||||
evas_object_image_load_size_set(sd->img, sd->load_size, sd->load_size);
|
evas_object_image_load_size_set(sd->img, sd->load_size, sd->load_size);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
efl_gfx_view_size_get((Eo *) obj, &w, &h);
|
Eina_Size2D sz = efl_gfx_view_size_get(obj);
|
||||||
evas_object_image_load_size_set(sd->img, w, h);
|
evas_object_image_load_size_set(sd->img, sz.w, sz.h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1246,20 +1245,17 @@ elm_image_async_open_set(Eo *obj, Eina_Bool async)
|
||||||
if (!async) _async_cancel(pd);
|
if (!async) _async_cancel(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static Eina_Size2D
|
||||||
_efl_ui_image_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h)
|
_efl_ui_image_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
|
||||||
{
|
{
|
||||||
int tw, th;
|
int tw, th;
|
||||||
|
|
||||||
if (w) *w = 0;
|
|
||||||
if (h) *h = 0;
|
|
||||||
|
|
||||||
if (efl_isa(sd->img, EDJE_OBJECT_CLASS))
|
if (efl_isa(sd->img, EDJE_OBJECT_CLASS))
|
||||||
edje_object_size_min_get(sd->img, &tw, &th);
|
edje_object_size_min_get(sd->img, &tw, &th);
|
||||||
else
|
else
|
||||||
evas_object_image_size_get(sd->img, &tw, &th);
|
evas_object_image_size_get(sd->img, &tw, &th);
|
||||||
if (w) *w = tw;
|
|
||||||
if (h) *h = th;
|
return EINA_SIZE2D(tw, th);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -2194,7 +2190,10 @@ elm_image_object_get(const Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_image_object_size_get(const Evas_Object *obj, int *w, int *h)
|
elm_image_object_size_get(const Evas_Object *obj, int *w, int *h)
|
||||||
{
|
{
|
||||||
efl_gfx_view_size_get(obj, w, h);
|
Eina_Size2D sz;
|
||||||
|
sz = efl_gfx_view_size_get(obj);
|
||||||
|
if (w) *w = sz.w;
|
||||||
|
if (h) *h = sz.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
|
@ -2206,11 +2206,10 @@ _efl_ui_image_zoomable_efl_ui_zoom_zoom_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Ima
|
||||||
return sd->mode;
|
return sd->mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static Eina_Size2D
|
||||||
_efl_ui_image_zoomable_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *pd, int *w, int *h)
|
_efl_ui_image_zoomable_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *pd)
|
||||||
{
|
{
|
||||||
if (w) *w = pd->size.imw;
|
return EINA_SIZE2D(pd->size.imw, pd->size.imh);
|
||||||
if (h) *h = pd->size.imh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -2361,7 +2360,8 @@ _min_obj_size_get(Evas_Object *o, int *w, int *h)
|
||||||
{
|
{
|
||||||
EFL_UI_IMAGE_ZOOMABLE_DATA_GET(o, sd);
|
EFL_UI_IMAGE_ZOOMABLE_DATA_GET(o, sd);
|
||||||
|
|
||||||
efl_gfx_view_size_get(o, w, h);
|
*w = sd->size.imw;
|
||||||
|
*h = sd->size.imh;
|
||||||
|
|
||||||
if (*w == 0 || *h == 0)
|
if (*w == 0 || *h == 0)
|
||||||
{
|
{
|
||||||
|
@ -2849,7 +2849,10 @@ elm_photocam_internal_image_get(const Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
|
elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
|
||||||
{
|
{
|
||||||
efl_gfx_view_size_get(obj, w, h);
|
Eina_Size2D sz;
|
||||||
|
sz = efl_gfx_view_size_get(obj);
|
||||||
|
if (w) *w = sz.w;
|
||||||
|
if (h) *h = sz.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
|
|
@ -508,22 +508,21 @@ _elm_glview_render_policy_set(Eo *obj, Elm_Glview_Data *sd, Elm_GLView_Render_Po
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_elm_glview_efl_gfx_view_view_size_set(Eo *obj, Elm_Glview_Data *sd, int w, int h)
|
_elm_glview_efl_gfx_view_view_size_set(Eo *obj, Elm_Glview_Data *sd, Eina_Size2D sz)
|
||||||
{
|
{
|
||||||
if ((w == sd->w) && (h == sd->h)) return;
|
if ((sz.w == sd->w) && (sz.h == sd->h)) return;
|
||||||
|
|
||||||
sd->w = w;
|
sd->w = sz.w;
|
||||||
sd->h = h;
|
sd->h = sz.h;
|
||||||
|
|
||||||
_glview_update_surface(obj);
|
_glview_update_surface(obj);
|
||||||
elm_obj_glview_draw_request(obj);
|
elm_obj_glview_draw_request(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static Eina_Size2D
|
||||||
_elm_glview_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, int *w, int *h)
|
_elm_glview_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd)
|
||||||
{
|
{
|
||||||
if (w) *w = sd->w;
|
return EINA_SIZE2D(sd->w, sd->h);
|
||||||
if (h) *h = sd->h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -571,13 +570,16 @@ elm_glview_changed_set(Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_glview_size_get(const Elm_Glview *obj, int *w, int *h)
|
elm_glview_size_get(const Elm_Glview *obj, int *w, int *h)
|
||||||
{
|
{
|
||||||
efl_gfx_view_size_get(obj, w, h);
|
Eina_Size2D sz;
|
||||||
|
sz = efl_gfx_view_size_get(obj);
|
||||||
|
if (w) *w = sz.w;
|
||||||
|
if (h) *h = sz.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_glview_size_set(Elm_Glview *obj, int w, int h)
|
elm_glview_size_set(Elm_Glview *obj, int w, int h)
|
||||||
{
|
{
|
||||||
efl_gfx_view_size_set(obj, w, h);
|
efl_gfx_view_size_set(obj, EINA_SIZE2D(w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
|
@ -319,7 +319,10 @@ _map_calc(Eo *eo_obj, Evas_Object_Protected_Data *obj, Efl_Gfx_Map_Data *pd)
|
||||||
if (obj->is_image_object)
|
if (obj->is_image_object)
|
||||||
{
|
{
|
||||||
// Image is a special case in terms of geometry
|
// Image is a special case in terms of geometry
|
||||||
efl_gfx_view_size_get(eo_obj, &imw, &imh);
|
Eina_Size2D sz;
|
||||||
|
sz = efl_gfx_view_size_get(eo_obj);
|
||||||
|
imw = sz.w;
|
||||||
|
imh = sz.h;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -159,8 +159,11 @@ evas_object_image_border_center_fill_get(const Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_object_image_size_get(const Evas_Object *obj, int *w, int *h)
|
evas_object_image_size_get(const Evas_Object *obj, int *w, int *h)
|
||||||
{
|
{
|
||||||
|
Eina_Size2D sz;
|
||||||
EVAS_IMAGE_API(obj);
|
EVAS_IMAGE_API(obj);
|
||||||
efl_gfx_view_size_get(obj, w, h);
|
sz = efl_gfx_view_size_get(obj);
|
||||||
|
if (w) *w = sz.w;
|
||||||
|
if (h) *h = sz.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Colorspace
|
EAPI Evas_Colorspace
|
||||||
|
|
|
@ -689,8 +689,8 @@ _efl_canvas_image_internal_efl_image_image_size_get(Eo *eo_obj EINA_UNUSED, Evas
|
||||||
if (h) *h = o->file_size.h;
|
if (h) *h = o->file_size.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static Eina_Size2D
|
||||||
_efl_canvas_image_internal_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o, int *w, int *h)
|
_efl_canvas_image_internal_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o)
|
||||||
{
|
{
|
||||||
int uvw, uvh;
|
int uvw, uvh;
|
||||||
Evas_Object_Protected_Data *source = NULL;
|
Evas_Object_Protected_Data *source = NULL;
|
||||||
|
@ -727,8 +727,7 @@ _efl_canvas_image_internal_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Dat
|
||||||
uvh = source->proxy->h;
|
uvh = source->proxy->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w) *w = uvw;
|
return EINA_SIZE2D(uvw, uvh);
|
||||||
if (h) *h = uvh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
|
|
@ -401,20 +401,17 @@ evas_object_vg_was_opaque(Evas_Object *eo_obj EINA_UNUSED,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
EOLIAN static Eina_Size2D
|
||||||
_evas_vg_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd,
|
_evas_vg_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd)
|
||||||
int *w, int *h)
|
|
||||||
{
|
{
|
||||||
if (w) *w = pd->width;
|
return EINA_SIZE2D(pd->width, pd->height);
|
||||||
if (h) *h = pd->height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
EOLIAN static void
|
||||||
_evas_vg_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd,
|
_evas_vg_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, Eina_Size2D sz)
|
||||||
int w, int h)
|
|
||||||
{
|
{
|
||||||
pd->width = w;
|
pd->width = sz.w;
|
||||||
pd->height = h;
|
pd->height = sz.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -675,14 +675,17 @@ START_TEST(evas_object_image_map_unmap)
|
||||||
Eina_Bool all_white = 1, all_transparent = 1;
|
Eina_Bool all_white = 1, all_transparent = 1;
|
||||||
Eina_Rw_Slice slice;
|
Eina_Rw_Slice slice;
|
||||||
Eina_Rect r, r2;
|
Eina_Rect r, r2;
|
||||||
|
Eina_Size2D sz;
|
||||||
|
|
||||||
const char *imgpath = TESTS_IMG_DIR "/Pic4.png";
|
const char *imgpath = TESTS_IMG_DIR "/Pic4.png";
|
||||||
|
|
||||||
o = efl_add(EFL_CANVAS_IMAGE_CLASS, e);
|
o = efl_add(EFL_CANVAS_IMAGE_CLASS, e);
|
||||||
efl_file_set(o, imgpath, NULL);
|
efl_file_set(o, imgpath, NULL);
|
||||||
efl_gfx_view_size_get(o, &w, &h);
|
sz = efl_gfx_view_size_get(o);
|
||||||
cs = efl_gfx_buffer_colorspace_get(o);
|
cs = efl_gfx_buffer_colorspace_get(o);
|
||||||
|
|
||||||
|
w = sz.w;
|
||||||
|
h = sz.h;
|
||||||
r.x = (w / 4) & ~3;
|
r.x = (w / 4) & ~3;
|
||||||
r.y = (h / 4) & ~3;
|
r.y = (h / 4) & ~3;
|
||||||
r.w = (w / 2) & ~3;
|
r.w = (w / 2) & ~3;
|
||||||
|
@ -757,7 +760,9 @@ START_TEST(evas_object_image_map_unmap)
|
||||||
|
|
||||||
o2 = efl_add(EFL_CANVAS_IMAGE_CLASS, e);
|
o2 = efl_add(EFL_CANVAS_IMAGE_CLASS, e);
|
||||||
efl_file_set(o2, tmp, NULL);
|
efl_file_set(o2, tmp, NULL);
|
||||||
efl_gfx_view_size_get(o, &w2, &h2);
|
sz = efl_gfx_view_size_get(o);
|
||||||
|
w2 = sz.w;
|
||||||
|
h2 = sz.h;
|
||||||
|
|
||||||
// unlink now to not leave any crap after failing the test
|
// unlink now to not leave any crap after failing the test
|
||||||
unlink(tmp);
|
unlink(tmp);
|
||||||
|
|
Loading…
Reference in New Issue