summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 20:16:33 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-19 10:51:48 +0900
commitb19ee757e59d8a8565486495dbbb9f90db7500f6 (patch)
treeb35aeac7bbd1fb5970a3ed0dd45eaabb1e0b0438 /src
parent2df8ad36b4b0068ae5ae3f547d2ece4d3c741a76 (diff)
efl: Use Eina.Size2D in Gfx.View
Diffstat (limited to 'src')
-rw-r--r--src/lib/efl/interfaces/efl_gfx_view.eo5
-rw-r--r--src/lib/elementary/efl_ui_image.c45
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.c15
-rw-r--r--src/lib/elementary/elm_glview.c22
-rw-r--r--src/lib/evas/canvas/efl_gfx_map.c5
-rw-r--r--src/lib/evas/canvas/evas_image_legacy.c5
-rw-r--r--src/lib/evas/canvas/evas_object_image.c7
-rw-r--r--src/lib/evas/canvas/evas_object_vg.c17
-rw-r--r--src/tests/evas/evas_test_image.c9
9 files changed, 71 insertions, 59 deletions
diff --git a/src/lib/efl/interfaces/efl_gfx_view.eo b/src/lib/efl/interfaces/efl_gfx_view.eo
index 677cfa887f..233175c6a2 100644
--- a/src/lib/efl/interfaces/efl_gfx_view.eo
+++ b/src/lib/efl/interfaces/efl_gfx_view.eo
@@ -1,3 +1,5 @@
1import eina_types;
2
1interface Efl.Gfx.View 3interface Efl.Gfx.View
2{ 4{
3 [[Efl graphics view interface]] 5 [[Efl graphics view interface]]
@@ -28,8 +30,7 @@ interface Efl.Gfx.View
28 set {} 30 set {}
29 get {} 31 get {}
30 values { 32 values {
31 w: int; [[Width of the view.]] 33 size: Eina.Size2D; [[Size of the view.]]
32 h: int; [[Height of the view.]]
33 } 34 }
34 } 35 }
35 } 36 }
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index a750327d5c..75facb4bee 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -749,7 +749,7 @@ void
749_efl_ui_image_sizing_eval(Evas_Object *obj) 749_efl_ui_image_sizing_eval(Evas_Object *obj)
750{ 750{
751 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; 751 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
752 int w = 0, h = 0; 752 Eina_Size2D sz;
753 double ts; 753 double ts;
754 754
755 EFL_UI_IMAGE_DATA_GET_OR_RETURN(obj, sd); 755 EFL_UI_IMAGE_DATA_GET_OR_RETURN(obj, sd);
@@ -764,37 +764,37 @@ _efl_ui_image_sizing_eval(Evas_Object *obj)
764 764
765 ts = sd->scale; 765 ts = sd->scale;
766 sd->scale = 1.0; 766 sd->scale = 1.0;
767 efl_gfx_view_size_get(obj, &w, &h); 767 sz = efl_gfx_view_size_get(obj);
768 768
769 sd->scale = ts; 769 sd->scale = ts;
770 evas_object_size_hint_combined_min_get(obj, &minw, &minh); 770 evas_object_size_hint_combined_min_get(obj, &minw, &minh);
771 771
772 if (sd->no_scale) 772 if (sd->no_scale)
773 { 773 {
774 maxw = minw = w; 774 maxw = minw = sz.w;
775 maxh = minh = h; 775 maxh = minh = sz.h;
776 if ((sd->scale > 1.0) && (sd->scale_up)) 776 if ((sd->scale > 1.0) && (sd->scale_up))
777 { 777 {
778 maxw = minw = w * sd->scale; 778 maxw = minw = sz.w * sd->scale;
779 maxh = minh = h * sd->scale; 779 maxh = minh = sz.h * sd->scale;
780 } 780 }
781 else if ((sd->scale < 1.0) && (sd->scale_down)) 781 else if ((sd->scale < 1.0) && (sd->scale_down))
782 { 782 {
783 maxw = minw = w * sd->scale; 783 maxw = minw = sz.w * sd->scale;
784 maxh = minh = h * sd->scale; 784 maxh = minh = sz.h * sd->scale;
785 } 785 }
786 } 786 }
787 else 787 else
788 { 788 {
789 if (!sd->scale_down) 789 if (!sd->scale_down)
790 { 790 {
791 minw = w * sd->scale; 791 minw = sz.w * sd->scale;
792 minh = h * sd->scale; 792 minh = sz.h * sd->scale;
793 } 793 }
794 if (!sd->scale_up) 794 if (!sd->scale_up)
795 { 795 {
796 maxw = w * sd->scale; 796 maxw = sz.w * sd->scale;
797 maxh = h * sd->scale; 797 maxh = sz.h * sd->scale;
798 } 798 }
799 } 799 }
800 800
@@ -806,7 +806,6 @@ static void
806_efl_ui_image_file_set_do(Evas_Object *obj) 806_efl_ui_image_file_set_do(Evas_Object *obj)
807{ 807{
808 Evas_Object *pclip = NULL; 808 Evas_Object *pclip = NULL;
809 int w = 0, h = 0;
810 809
811 EFL_UI_IMAGE_DATA_GET(obj, sd); 810 EFL_UI_IMAGE_DATA_GET(obj, sd);
812 811
@@ -829,8 +828,8 @@ _efl_ui_image_file_set_do(Evas_Object *obj)
829 evas_object_image_load_size_set(sd->img, sd->load_size, sd->load_size); 828 evas_object_image_load_size_set(sd->img, sd->load_size, sd->load_size);
830 else 829 else
831 { 830 {
832 efl_gfx_view_size_get((Eo *) obj, &w, &h); 831 Eina_Size2D sz = efl_gfx_view_size_get(obj);
833 evas_object_image_load_size_set(sd->img, w, h); 832 evas_object_image_load_size_set(sd->img, sz.w, sz.h);
834 } 833 }
835} 834}
836 835
@@ -1246,20 +1245,17 @@ elm_image_async_open_set(Eo *obj, Eina_Bool async)
1246 if (!async) _async_cancel(pd); 1245 if (!async) _async_cancel(pd);
1247} 1246}
1248 1247
1249EOLIAN static void 1248EOLIAN static Eina_Size2D
1250_efl_ui_image_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h) 1249_efl_ui_image_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
1251{ 1250{
1252 int tw, th; 1251 int tw, th;
1253 1252
1254 if (w) *w = 0;
1255 if (h) *h = 0;
1256
1257 if (efl_isa(sd->img, EDJE_OBJECT_CLASS)) 1253 if (efl_isa(sd->img, EDJE_OBJECT_CLASS))
1258 edje_object_size_min_get(sd->img, &tw, &th); 1254 edje_object_size_min_get(sd->img, &tw, &th);
1259 else 1255 else
1260 evas_object_image_size_get(sd->img, &tw, &th); 1256 evas_object_image_size_get(sd->img, &tw, &th);
1261 if (w) *w = tw; 1257
1262 if (h) *h = th; 1258 return EINA_SIZE2D(tw, th);
1263} 1259}
1264 1260
1265EOLIAN static void 1261EOLIAN static void
@@ -2194,7 +2190,10 @@ elm_image_object_get(const Evas_Object *obj)
2194EAPI void 2190EAPI void
2195elm_image_object_size_get(const Evas_Object *obj, int *w, int *h) 2191elm_image_object_size_get(const Evas_Object *obj, int *w, int *h)
2196{ 2192{
2197 efl_gfx_view_size_get(obj, w, h); 2193 Eina_Size2D sz;
2194 sz = efl_gfx_view_size_get(obj);
2195 if (w) *w = sz.w;
2196 if (h) *h = sz.h;
2198} 2197}
2199 2198
2200EAPI void 2199EAPI void
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index cd47ef769b..9940534074 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -2206,11 +2206,10 @@ _efl_ui_image_zoomable_efl_ui_zoom_zoom_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Ima
2206 return sd->mode; 2206 return sd->mode;
2207} 2207}
2208 2208
2209EOLIAN static void 2209EOLIAN static Eina_Size2D
2210_efl_ui_image_zoomable_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *pd, int *w, int *h) 2210_efl_ui_image_zoomable_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *pd)
2211{ 2211{
2212 if (w) *w = pd->size.imw; 2212 return EINA_SIZE2D(pd->size.imw, pd->size.imh);
2213 if (h) *h = pd->size.imh;
2214} 2213}
2215 2214
2216EOLIAN static void 2215EOLIAN static void
@@ -2361,7 +2360,8 @@ _min_obj_size_get(Evas_Object *o, int *w, int *h)
2361{ 2360{
2362 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(o, sd); 2361 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(o, sd);
2363 2362
2364 efl_gfx_view_size_get(o, w, h); 2363 *w = sd->size.imw;
2364 *h = sd->size.imh;
2365 2365
2366 if (*w == 0 || *h == 0) 2366 if (*w == 0 || *h == 0)
2367 { 2367 {
@@ -2849,7 +2849,10 @@ elm_photocam_internal_image_get(const Evas_Object *obj)
2849EAPI void 2849EAPI void
2850elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h) 2850elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
2851{ 2851{
2852 efl_gfx_view_size_get(obj, w, h); 2852 Eina_Size2D sz;
2853 sz = efl_gfx_view_size_get(obj);
2854 if (w) *w = sz.w;
2855 if (h) *h = sz.h;
2853} 2856}
2854 2857
2855EAPI Eina_Bool 2858EAPI Eina_Bool
diff --git a/src/lib/elementary/elm_glview.c b/src/lib/elementary/elm_glview.c
index fceb850be4..7107fb898c 100644
--- a/src/lib/elementary/elm_glview.c
+++ b/src/lib/elementary/elm_glview.c
@@ -508,22 +508,21 @@ _elm_glview_render_policy_set(Eo *obj, Elm_Glview_Data *sd, Elm_GLView_Render_Po
508} 508}
509 509
510EOLIAN static void 510EOLIAN static void
511_elm_glview_efl_gfx_view_view_size_set(Eo *obj, Elm_Glview_Data *sd, int w, int h) 511_elm_glview_efl_gfx_view_view_size_set(Eo *obj, Elm_Glview_Data *sd, Eina_Size2D sz)
512{ 512{
513 if ((w == sd->w) && (h == sd->h)) return; 513 if ((sz.w == sd->w) && (sz.h == sd->h)) return;
514 514
515 sd->w = w; 515 sd->w = sz.w;
516 sd->h = h; 516 sd->h = sz.h;
517 517
518 _glview_update_surface(obj); 518 _glview_update_surface(obj);
519 elm_obj_glview_draw_request(obj); 519 elm_obj_glview_draw_request(obj);
520} 520}
521 521
522EOLIAN static void 522EOLIAN static Eina_Size2D
523_elm_glview_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, int *w, int *h) 523_elm_glview_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd)
524{ 524{
525 if (w) *w = sd->w; 525 return EINA_SIZE2D(sd->w, sd->h);
526 if (h) *h = sd->h;
527} 526}
528 527
529EOLIAN static void 528EOLIAN static void
@@ -571,13 +570,16 @@ elm_glview_changed_set(Evas_Object *obj)
571EAPI void 570EAPI void
572elm_glview_size_get(const Elm_Glview *obj, int *w, int *h) 571elm_glview_size_get(const Elm_Glview *obj, int *w, int *h)
573{ 572{
574 efl_gfx_view_size_get(obj, w, h); 573 Eina_Size2D sz;
574 sz = efl_gfx_view_size_get(obj);
575 if (w) *w = sz.w;
576 if (h) *h = sz.h;
575} 577}
576 578
577EAPI void 579EAPI void
578elm_glview_size_set(Elm_Glview *obj, int w, int h) 580elm_glview_size_set(Elm_Glview *obj, int w, int h)
579{ 581{
580 efl_gfx_view_size_set(obj, w, h); 582 efl_gfx_view_size_set(obj, EINA_SIZE2D(w, h));
581} 583}
582 584
583EAPI void 585EAPI void
diff --git a/src/lib/evas/canvas/efl_gfx_map.c b/src/lib/evas/canvas/efl_gfx_map.c
index 9d5dc40c6b..4bcc11871d 100644
--- a/src/lib/evas/canvas/efl_gfx_map.c
+++ b/src/lib/evas/canvas/efl_gfx_map.c
@@ -319,7 +319,10 @@ _map_calc(Eo *eo_obj, Evas_Object_Protected_Data *obj, Efl_Gfx_Map_Data *pd)
319 if (obj->is_image_object) 319 if (obj->is_image_object)
320 { 320 {
321 // Image is a special case in terms of geometry 321 // Image is a special case in terms of geometry
322 efl_gfx_view_size_get(eo_obj, &imw, &imh); 322 Eina_Size2D sz;
323 sz = efl_gfx_view_size_get(eo_obj);
324 imw = sz.w;
325 imh = sz.h;
323 } 326 }
324 else 327 else
325 { 328 {
diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c
index 29ea9e079b..28c11c77a0 100644
--- a/src/lib/evas/canvas/evas_image_legacy.c
+++ b/src/lib/evas/canvas/evas_image_legacy.c
@@ -159,8 +159,11 @@ evas_object_image_border_center_fill_get(const Evas_Object *obj)
159EAPI void 159EAPI void
160evas_object_image_size_get(const Evas_Object *obj, int *w, int *h) 160evas_object_image_size_get(const Evas_Object *obj, int *w, int *h)
161{ 161{
162 Eina_Size2D sz;
162 EVAS_IMAGE_API(obj); 163 EVAS_IMAGE_API(obj);
163 efl_gfx_view_size_get(obj, w, h); 164 sz = efl_gfx_view_size_get(obj);
165 if (w) *w = sz.w;
166 if (h) *h = sz.h;
164} 167}
165 168
166EAPI Evas_Colorspace 169EAPI Evas_Colorspace
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 7d56927253..ee41ea4e4e 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -689,8 +689,8 @@ _efl_canvas_image_internal_efl_image_image_size_get(Eo *eo_obj EINA_UNUSED, Evas
689 if (h) *h = o->file_size.h; 689 if (h) *h = o->file_size.h;
690} 690}
691 691
692EOLIAN static void 692EOLIAN static Eina_Size2D
693_efl_canvas_image_internal_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o, int *w, int *h) 693_efl_canvas_image_internal_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o)
694{ 694{
695 int uvw, uvh; 695 int uvw, uvh;
696 Evas_Object_Protected_Data *source = NULL; 696 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
727 uvh = source->proxy->h; 727 uvh = source->proxy->h;
728 } 728 }
729 729
730 if (w) *w = uvw; 730 return EINA_SIZE2D(uvw, uvh);
731 if (h) *h = uvh;
732} 731}
733 732
734EOLIAN static void 733EOLIAN static void
diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c
index 006f070da2..c18d0b4357 100644
--- a/src/lib/evas/canvas/evas_object_vg.c
+++ b/src/lib/evas/canvas/evas_object_vg.c
@@ -401,20 +401,17 @@ evas_object_vg_was_opaque(Evas_Object *eo_obj EINA_UNUSED,
401 return 0; 401 return 0;
402} 402}
403 403
404void 404EOLIAN static Eina_Size2D
405_evas_vg_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, 405_evas_vg_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd)
406 int *w, int *h)
407{ 406{
408 if (w) *w = pd->width; 407 return EINA_SIZE2D(pd->width, pd->height);
409 if (h) *h = pd->height;
410} 408}
411 409
412void 410EOLIAN static void
413_evas_vg_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, 411_evas_vg_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, Eina_Size2D sz)
414 int w, int h)
415{ 412{
416 pd->width = w; 413 pd->width = sz.w;
417 pd->height = h; 414 pd->height = sz.h;
418} 415}
419 416
420void 417void
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index 2d715f0021..e0637a12fe 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -675,14 +675,17 @@ START_TEST(evas_object_image_map_unmap)
675 Eina_Bool all_white = 1, all_transparent = 1; 675 Eina_Bool all_white = 1, all_transparent = 1;
676 Eina_Rw_Slice slice; 676 Eina_Rw_Slice slice;
677 Eina_Rect r, r2; 677 Eina_Rect r, r2;
678 Eina_Size2D sz;
678 679
679 const char *imgpath = TESTS_IMG_DIR "/Pic4.png"; 680 const char *imgpath = TESTS_IMG_DIR "/Pic4.png";
680 681
681 o = efl_add(EFL_CANVAS_IMAGE_CLASS, e); 682 o = efl_add(EFL_CANVAS_IMAGE_CLASS, e);
682 efl_file_set(o, imgpath, NULL); 683 efl_file_set(o, imgpath, NULL);
683 efl_gfx_view_size_get(o, &w, &h); 684 sz = efl_gfx_view_size_get(o);
684 cs = efl_gfx_buffer_colorspace_get(o); 685 cs = efl_gfx_buffer_colorspace_get(o);
685 686
687 w = sz.w;
688 h = sz.h;
686 r.x = (w / 4) & ~3; 689 r.x = (w / 4) & ~3;
687 r.y = (h / 4) & ~3; 690 r.y = (h / 4) & ~3;
688 r.w = (w / 2) & ~3; 691 r.w = (w / 2) & ~3;
@@ -757,7 +760,9 @@ START_TEST(evas_object_image_map_unmap)
757 760
758 o2 = efl_add(EFL_CANVAS_IMAGE_CLASS, e); 761 o2 = efl_add(EFL_CANVAS_IMAGE_CLASS, e);
759 efl_file_set(o2, tmp, NULL); 762 efl_file_set(o2, tmp, NULL);
760 efl_gfx_view_size_get(o, &w2, &h2); 763 sz = efl_gfx_view_size_get(o);
764 w2 = sz.w;
765 h2 = sz.h;
761 766
762 // unlink now to not leave any crap after failing the test 767 // unlink now to not leave any crap after failing the test
763 unlink(tmp); 768 unlink(tmp);