summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubhransu Mohanty <sub.mohanty@samsung.com>2016-07-26 11:32:59 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-07-26 14:19:59 +0900
commit0023f20d85f5237448aed177d2ca9c2195063bbb (patch)
tree8ae2ffa4805e0f46ef292ca9089bd1c94c97b90c
parent9f04590bbf111bad892effe32355ada0419bb9fc (diff)
efl/interface: fixed the shape interpolation implementation.
Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4188
-rw-r--r--src/lib/efl/interfaces/efl_gfx_shape.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c
index 11b38a6..d0e3cad 100644
--- a/src/lib/efl/interfaces/efl_gfx_shape.c
+++ b/src/lib/efl/interfaces/efl_gfx_shape.c
@@ -271,13 +271,13 @@ _efl_gfx_shape_equal_commands_internal(Efl_Gfx_Shape_Data *a,
271static inline double 271static inline double
272interpolate(double from, double to, double pos_map) 272interpolate(double from, double to, double pos_map)
273{ 273{
274 return (from * pos_map) + (to * (1.0 - pos_map)); 274 return (from * (1.0 - pos_map)) + (to * pos_map);
275} 275}
276 276
277static inline int 277static inline int
278interpolatei(int from, int to, double pos_map) 278interpolatei(int from, int to, double pos_map)
279{ 279{
280 return (from * pos_map) + (to * (1.0 - pos_map)); 280 return (from * (1.0 - pos_map)) + (to * pos_map);
281} 281}
282 282
283typedef struct _Efl_Gfx_Property Efl_Gfx_Property; 283typedef struct _Efl_Gfx_Property Efl_Gfx_Property;
@@ -399,11 +399,19 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd,
399 } 399 }
400 400
401 401
402 efl_gfx_shape_stroke_scale_set(obj, interpolate(property_to.scale, property_from.scale, pos_map)); 402 efl_gfx_shape_stroke_scale_set(obj, interpolate(property_from.scale, property_to.scale, pos_map));
403 efl_gfx_shape_stroke_color_set(obj, interpolatei(property_to.r, property_from.r, pos_map), interpolatei(property_to.g, property_from.g, pos_map), interpolatei(property_to.b, property_from.b, pos_map), interpolatei(property_to.a, property_from.a, pos_map)); 403 efl_gfx_shape_stroke_color_set(obj,
404 efl_gfx_color_set(obj, interpolatei(property_to.fr, property_from.fr, pos_map), interpolatei(property_to.fg, property_from.fg, pos_map), interpolatei(property_to.fb, property_from.fb, pos_map), interpolatei(property_to.fa, property_from.fa, pos_map)); 404 interpolatei(property_from.r, property_to.r, pos_map),
405 efl_gfx_shape_stroke_width_set(obj, interpolate(property_to.w, property_from.w, pos_map)); 405 interpolatei(property_from.g, property_to.g, pos_map),
406 efl_gfx_shape_stroke_location_set(obj, interpolate(property_to.centered, property_from.centered, pos_map)); 406 interpolatei(property_from.b, property_to.b, pos_map),
407 interpolatei(property_from.a, property_to.a, pos_map));
408 efl_gfx_color_set(obj,
409 interpolatei(property_from.fr, property_to.fr, pos_map),
410 interpolatei(property_from.fg, property_to.fg, pos_map),
411 interpolatei(property_from.fb, property_to.fb, pos_map),
412 interpolatei(property_from.fa, property_to.fa, pos_map));
413 efl_gfx_shape_stroke_width_set(obj, interpolate(property_from.w, property_to.w, pos_map));
414 efl_gfx_shape_stroke_location_set(obj, interpolate(property_from.centered, property_to.centered, pos_map));
407 efl_gfx_shape_stroke_dash_set(obj, dash, property_to.dash_length); 415 efl_gfx_shape_stroke_dash_set(obj, dash, property_to.dash_length);
408 efl_gfx_shape_stroke_cap_set(obj, pos_map < 0.5 ? property_from.c : property_to.c); 416 efl_gfx_shape_stroke_cap_set(obj, pos_map < 0.5 ? property_from.c : property_to.c);
409 efl_gfx_shape_stroke_join_set(obj, pos_map < 0.5 ? property_from.j : property_to.j); 417 efl_gfx_shape_stroke_join_set(obj, pos_map < 0.5 ? property_from.j : property_to.j);