summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 17:41:20 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 18:09:19 +0900
commit89733b22f6287f0c9126acc93a2b1dae590ae4dd (patch)
tree557083c042dae7d3bfecc403bc28dbeee64de94f /src
parent83ea35541ceea5583528b09daf397deecb354b97 (diff)
efl_gfx_fill: Use Eina.Rectangle for fill (EO)
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/edje_calc.c4
-rw-r--r--src/lib/edje/edje_private.h4
-rw-r--r--src/lib/efl/interfaces/efl_gfx_fill.eo10
-rw-r--r--src/lib/elementary/elm_transit.c18
-rw-r--r--src/lib/evas/canvas/evas_image_legacy.c8
-rw-r--r--src/lib/evas/canvas/evas_object_image.c15
-rw-r--r--src/lib/evas/canvas/evas_object_vg.c18
7 files changed, 34 insertions, 43 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 8c811478b7..9bdedcaa0b 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -3616,7 +3616,7 @@ _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
3616 } 3616 }
3617 } 3617 }
3618 3618
3619 efl_gfx_fill_set(ep->object, p3->type.common->fill.x, p3->type.common->fill.y, p3->type.common->fill.w, p3->type.common->fill.h); 3619 efl_gfx_fill_set(ep->object, p3->type.common->fill);
3620 efl_image_smooth_scale_set(ep->object, p3->smooth); 3620 efl_image_smooth_scale_set(ep->object, p3->smooth);
3621 evas_object_image_source_visible_set(ep->object, chosen_desc->proxy.source_visible); 3621 evas_object_image_source_visible_set(ep->object, chosen_desc->proxy.source_visible);
3622 evas_object_image_source_clip_set(ep->object, chosen_desc->proxy.source_clip); 3622 evas_object_image_source_clip_set(ep->object, chosen_desc->proxy.source_clip);
@@ -3656,7 +3656,7 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
3656 set->entry->border.scale_by : p3->type.common->spec.image.border_scale_by; 3656 set->entry->border.scale_by : p3->type.common->spec.image.border_scale_by;
3657 } 3657 }
3658 3658
3659 efl_gfx_fill_set(ep->object, p3->type.common->fill.x, p3->type.common->fill.y, p3->type.common->fill.w, p3->type.common->fill.h); 3659 efl_gfx_fill_set(ep->object, p3->type.common->fill);
3660 efl_image_smooth_scale_set(ep->object, p3->smooth); 3660 efl_image_smooth_scale_set(ep->object, p3->smooth);
3661 if (chosen_desc->image.border.scale) 3661 if (chosen_desc->image.border.scale)
3662 { 3662 {
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index b98e02af13..f0e7f00252 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1844,9 +1844,7 @@ typedef struct _Edje_Calc_Params_Type_Node Edje_Calc_Params_Type_Node;
1844 1844
1845struct _Edje_Calc_Params_Type_Common 1845struct _Edje_Calc_Params_Type_Common
1846{ 1846{
1847 struct { 1847 Eina_Rectangle fill; // 16
1848 int x, y, w, h; // 16
1849 } fill; // 16
1850 union { 1848 union {
1851 struct { 1849 struct {
1852 unsigned short l, r, t, b; // 8 1850 unsigned short l, r, t, b; // 8
diff --git a/src/lib/efl/interfaces/efl_gfx_fill.eo b/src/lib/efl/interfaces/efl_gfx_fill.eo
index f0280c0074..385f79fce5 100644
--- a/src/lib/efl/interfaces/efl_gfx_fill.eo
+++ b/src/lib/efl/interfaces/efl_gfx_fill.eo
@@ -1,3 +1,5 @@
1import eina_types;
2
1interface Efl.Gfx.Fill { 3interface Efl.Gfx.Fill {
2 [[Efl graphics fill interface]] 4 [[Efl graphics fill interface]]
3 methods { 5 methods {
@@ -36,12 +38,8 @@ interface Efl.Gfx.Fill {
36 set {} 38 set {}
37 get {} 39 get {}
38 values { 40 values {
39 x: int; [[The x coordinate (from the top left corner of the bound 41 fill: Eina.Rectangle; [[The top-left corner to start drawing from
40 image) to start drawing from.]] 42 as well as the size at which the bound image will be displayed.]]
41 y: int; [[The y coordinate (from the top left corner of the bound
42 image) to start drawing from.]]
43 w: int; [[The width the bound image will be displayed at.]]
44 h: int; [[The height the bound image will be displayed at.]]
45 } 43 }
46 } 44 }
47 } 45 }
diff --git a/src/lib/elementary/elm_transit.c b/src/lib/elementary/elm_transit.c
index 0ff99faed3..69c9604c7a 100644
--- a/src/lib/elementary/elm_transit.c
+++ b/src/lib/elementary/elm_transit.c
@@ -480,7 +480,6 @@ _recover_image_uv(Evas_Object *obj, Evas_Map *map, Eina_Bool revert, Eina_Bool b
480 //Need to handle uvs only for image objects 480 //Need to handle uvs only for image objects
481 int iw, ih; 481 int iw, ih;
482 int x, y, w, h; 482 int x, y, w, h;
483 int fill_x, fill_y, fill_w, fill_h;
484 483
485 const char *type = evas_object_type_get(obj); 484 const char *type = evas_object_type_get(obj);
486 if ((!type) || (strcmp(type, "image"))) return EINA_FALSE; 485 if ((!type) || (strcmp(type, "image"))) return EINA_FALSE;
@@ -507,16 +506,19 @@ _recover_image_uv(Evas_Object *obj, Evas_Map *map, Eina_Bool revert, Eina_Bool b
507 //Zooming image fill area. 506 //Zooming image fill area.
508 else 507 else
509 { 508 {
510 efl_gfx_fill_get(obj, &fill_x, &fill_y, &fill_w, &fill_h); 509 Eina_Rectangle fill;
510
511 fill = efl_gfx_fill_get(obj);
511 efl_gfx_size_get(obj, &w, &h); 512 efl_gfx_size_get(obj, &w, &h);
512 513
513 double rate_x = (double) w / (double) fill_w; 514 EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_rectangle_is_valid(&fill), EINA_FALSE);
514 double rate_y = (double) h / (double) fill_h; 515 double rate_x = (double) w / (double) fill.w;
515 double rate_x2 = (double) iw / (double) fill_w; 516 double rate_y = (double) h / (double) fill.h;
516 double rate_y2 = (double) ih / (double) fill_h; 517 double rate_x2 = (double) iw / (double) fill.w;
518 double rate_y2 = (double) ih / (double) fill.h;
517 519
518 x = -(int)((double) fill_x * rate_x2); 520 x = -(int)((double) fill.x * rate_x2);
519 y = -(int)((double) fill_y * rate_y2); 521 y = -(int)((double) fill.y * rate_y2);
520 w = (int)(((double) iw) * rate_x) + x; 522 w = (int)(((double) iw) * rate_x) + x;
521 h = (int)(((double) ih) * rate_y) + y; 523 h = (int)(((double) ih) * rate_y) + y;
522 } 524 }
diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c
index 9ac97408d7..9b7557128d 100644
--- a/src/lib/evas/canvas/evas_image_legacy.c
+++ b/src/lib/evas/canvas/evas_image_legacy.c
@@ -90,8 +90,14 @@ evas_object_image_fill_get(const Evas_Object *obj,
90 Evas_Coord *x, Evas_Coord *y, 90 Evas_Coord *x, Evas_Coord *y,
91 Evas_Coord *w, Evas_Coord *h) 91 Evas_Coord *w, Evas_Coord *h)
92{ 92{
93 Eina_Rectangle r;
94
93 EVAS_IMAGE_API(obj); 95 EVAS_IMAGE_API(obj);
94 efl_gfx_fill_get(obj, x, y, w, h); 96 r = efl_gfx_fill_get(obj);
97 if (x) *x = r.x;
98 if (y) *y = r.y;
99 if (w) *w = r.w;
100 if (h) *h = r.h;
95} 101}
96 102
97EAPI void 103EAPI void
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index e3f428d91b..452311ec0f 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -668,23 +668,18 @@ _evas_image_fill_set(Eo *eo_obj, Evas_Image_Data *o, int x, int y, int w, int h)
668} 668}
669 669
670EOLIAN static void 670EOLIAN static void
671_efl_canvas_image_internal_efl_gfx_fill_fill_set(Eo *eo_obj, Evas_Image_Data *o, 671_efl_canvas_image_internal_efl_gfx_fill_fill_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Rectangle fill)
672 int x, int y, int w, int h)
673{ 672{
674 // Should (0,0,0,0) reset the filled flag to true? 673 // Should (0,0,0,0) reset the filled flag to true?
675 o->filled = EINA_FALSE; 674 o->filled = EINA_FALSE;
676 o->filled_set = EINA_TRUE; 675 o->filled_set = EINA_TRUE;
677 _evas_image_fill_set(eo_obj, o, x, y, w, h); 676 _evas_image_fill_set(eo_obj, o, fill.x, fill.y, fill.w, fill.h);
678} 677}
679 678
680EOLIAN static void 679EOLIAN static Eina_Rectangle
681_efl_canvas_image_internal_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, 680_efl_canvas_image_internal_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
682 int *x, int *y, int *w, int *h)
683{ 681{
684 if (x) *x = o->cur->fill.x; 682 return o->cur->fill;
685 if (y) *y = o->cur->fill.y;
686 if (w) *w = o->cur->fill.w;
687 if (h) *h = o->cur->fill.h;
688} 683}
689 684
690EOLIAN static void 685EOLIAN static void
diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c
index c3edc9dac9..19a4b45d83 100644
--- a/src/lib/evas/canvas/evas_object_vg.c
+++ b/src/lib/evas/canvas/evas_object_vg.c
@@ -418,23 +418,15 @@ _evas_vg_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd,
418} 418}
419 419
420void 420void
421_evas_vg_efl_gfx_fill_fill_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, 421_evas_vg_efl_gfx_fill_fill_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, Eina_Rectangle fill)
422 int x, int y, int w, int h)
423{ 422{
424 pd->fill.x = x; 423 pd->fill = fill;
425 pd->fill.y = y;
426 pd->fill.w = w;
427 pd->fill.h = h;
428} 424}
429 425
430void 426Eina_Rectangle
431_evas_vg_efl_gfx_fill_fill_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, 427_evas_vg_efl_gfx_fill_fill_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd)
432 int *x, int *y, int *w, int *h)
433{ 428{
434 if (x) *x = pd->fill.x; 429 return pd->fill;
435 if (y) *y = pd->fill.y;
436 if (w) *w = pd->fill.w;
437 if (h) *h = pd->fill.h;
438} 430}
439 431
440#include "evas_vg.eo.c" 432#include "evas_vg.eo.c"