evas vg: Shape interpolation patch: indent and case check fix 26/258626/6
authorMichal Maciola <m.maciola@samsung.com>
Fri, 21 May 2021 07:36:56 +0000 (09:36 +0200)
committerHermet Park <chuneon.park@samsung.com>
Thu, 27 May 2021 04:23:38 +0000 (04:23 +0000)
This patch fixes indent and if condition in patch "evas vg: Shape
interpolation patch".

Change-Id: I6d3c322c174f3b5d5cdcc4f8f866de05b3047d98

src/lib/evas/canvas/efl_canvas_vg_shape.c

index 920c2ab..78f7a47 100644 (file)
@@ -436,34 +436,34 @@ _shape_properties_interpolate(Evas_Vg_Shape *obj,
    efl_gfx_color_get(from, &r, &g, &b, &a);
    efl_gfx_color_get(to, &to_r, &to_g, &to_b, &to_a);
    if (a != to_a || r != to_r || g != to_g || b != to_b)
-      {
-         a = _interpolate(a, to_a, pos_map);
-         r = _interpolate(r, to_r, pos_map);
-         g = _interpolate(g, to_g, pos_map);
-         b = _interpolate(b, to_b, pos_map);
-      }
+     {
+        a = _interpolate(a, to_a, pos_map);
+        r = _interpolate(r, to_r, pos_map);
+        g = _interpolate(g, to_g, pos_map);
+        b = _interpolate(b, to_b, pos_map);
+     }
    efl_gfx_color_set((Eo*)obj, r, g, b, a);
 
    // Stroke - color
    tvg_shape_get_stroke_color(sd_from->shape, (uint8_t*)&r, (uint8_t*)&g, (uint8_t*)&b, (uint8_t*)&a);
    tvg_shape_get_stroke_color(sd_to->shape, (uint8_t*)&to_r, (uint8_t*)&to_g, (uint8_t*)&to_b, (uint8_t*)&to_a);
    if (a != to_a || r != to_r || g != to_g || b != to_b)
-      {
-         a = _interpolate(a, to_a, pos_map);
-         r = _interpolate(r, to_r, pos_map);
-         g = _interpolate(g, to_g, pos_map);
-         b = _interpolate(b, to_b, pos_map);
-      }
+     {
+        a = _interpolate(a, to_a, pos_map);
+        r = _interpolate(r, to_r, pos_map);
+        g = _interpolate(g, to_g, pos_map);
+        b = _interpolate(b, to_b, pos_map);
+     }
    tvg_shape_set_stroke_color(sd->shape, r, g, b, a);
 
    // Stroke - width (scale)
    tvg_shape_get_stroke_width(sd_from->shape, &width);
    tvg_shape_get_stroke_width(sd_to->shape, &width_to);
    if (sd_from->scale != sd_to->scale || width != width_to)
-      {
-         sd->scale = _interpolate(sd_from->scale, sd_to->scale, pos_map);
-         width = _interpolate(width, width_to, pos_map) * sd->scale;
-      }
+     {
+        sd->scale = _interpolate(sd_from->scale, sd_to->scale, pos_map);
+        width = _interpolate(width, width_to, pos_map) * sd->scale;
+     }
    tvg_shape_set_stroke_width(sd->shape, width);
 
    // Stroke - dash
@@ -539,25 +539,29 @@ _shape_path_interpolate(Evas_Vg_Shape *obj,
    tvg_shape_get_path_commands(tvg_to, (const Tvg_Path_Command**)&path_commands_to, &cmds_count_to);
    tvg_shape_get_path_coords(tvg_to, (const Tvg_Point**)&path_coords_to, &pts_count_to);
 
-   if (cmds_count_from != cmds_count_to) return EINA_FALSE;
-   if (pts_count_from != pts_count_to) return EINA_FALSE;
+   if (!path_commands_from || !path_commands_to) return EINA_FALSE;
+   if (!path_coords_from || !path_coords_to) return EINA_FALSE;
+   if (!cmds_count_from || cmds_count_from != cmds_count_to) return EINA_FALSE;
+   if (!pts_count_from || pts_count_from != pts_count_to) return EINA_FALSE;
 
-   // interpolate only if coords differ
-   if (memcmp(path_coords_from, path_coords_to, sizeof(Tvg_Point) * pts_count_from))
-      {
-         path_coords_dest = (Tvg_Point*)malloc(sizeof(Tvg_Point) * pts_count_from);
-         if (!path_coords_dest) return EINA_FALSE;
+   // interpolate only if commands are the same
+   for (i = 0; i < cmds_count_from; ++i)
+     {
+        if (path_commands_from[i] != path_commands_to[i]) return EINA_FALSE;
+     }
 
-         for (i = 0; i < pts_count_from; ++i)
-           {
-              path_coords_dest[i].x = _interpolate(path_coords_from[i].x, path_coords_to[i].x, pos_map);
-              path_coords_dest[i].y = _interpolate(path_coords_from[i].y, path_coords_to[i].y, pos_map);
-           }
+   path_coords_dest = (Tvg_Point*)malloc(sizeof(Tvg_Point) * pts_count_from);
+   if (!path_coords_dest) return EINA_FALSE;
+
+   for (i = 0; i < pts_count_from; ++i)
+     {
+        path_coords_dest[i].x = _interpolate(path_coords_from[i].x, path_coords_to[i].x, pos_map);
+        path_coords_dest[i].y = _interpolate(path_coords_from[i].y, path_coords_to[i].y, pos_map);
+     }
 
-         evas_vg_shape_reset(obj);
-         tvg_shape_append_path(tvg_dest, path_commands_from, cmds_count_from, path_coords_dest, pts_count_from);
-         free(path_coords_dest);
-      }
+   evas_vg_shape_reset(obj);
+   tvg_shape_append_path(tvg_dest, path_commands_from, cmds_count_from, path_coords_dest, pts_count_from);
+   free(path_coords_dest);
 
    return EINA_TRUE;
 }