node = clutter_path_node_full_new ();
nodes = g_slist_prepend (nodes, node);
- node->k.type = (*p == 'M' ? CLUTTER_PATH_MOVE_TO
- : *p == 'm' ? CLUTTER_PATH_REL_MOVE_TO
- : *p == 'L' ? CLUTTER_PATH_LINE_TO
- : CLUTTER_PATH_REL_LINE_TO);
+ node->k.type = (*p == 'M' ? CLUTTER_PATH_MOVE_TO :
+ *p == 'm' ? CLUTTER_PATH_REL_MOVE_TO :
+ *p == 'L' ? CLUTTER_PATH_LINE_TO :
+ CLUTTER_PATH_REL_LINE_TO);
p++;
- if (!clutter_path_parse_number (&p, FALSE, &node->k.points[0].x)
- || !clutter_path_parse_number (&p, TRUE, &node->k.points[0].y))
+ if (!clutter_path_parse_number (&p, FALSE, &node->k.points[0].x) ||
+ !clutter_path_parse_number (&p, TRUE, &node->k.points[0].y))
goto fail;
break;
node = clutter_path_node_full_new ();
nodes = g_slist_prepend (nodes, node);
- node->k.type = (*p == 'C' ? CLUTTER_PATH_CURVE_TO
- : CLUTTER_PATH_REL_CURVE_TO);
+ node->k.type = (*p == 'C' ? CLUTTER_PATH_CURVE_TO :
+ CLUTTER_PATH_REL_CURVE_TO);
p++;
- if (!clutter_path_parse_number (&p, FALSE, &node->k.points[0].x)
- || !clutter_path_parse_number (&p, TRUE, &node->k.points[0].y)
- || !clutter_path_parse_number (&p, TRUE, &node->k.points[1].x)
- || !clutter_path_parse_number (&p, TRUE, &node->k.points[1].y)
- || !clutter_path_parse_number (&p, TRUE, &node->k.points[2].x)
- || !clutter_path_parse_number (&p, TRUE, &node->k.points[2].y))
+ if (!clutter_path_parse_number (&p, FALSE, &node->k.points[0].x) ||
+ !clutter_path_parse_number (&p, TRUE, &node->k.points[0].y) ||
+ !clutter_path_parse_number (&p, TRUE, &node->k.points[1].x) ||
+ !clutter_path_parse_number (&p, TRUE, &node->k.points[1].y) ||
+ !clutter_path_parse_number (&p, TRUE, &node->k.points[2].x) ||
+ !clutter_path_parse_number (&p, TRUE, &node->k.points[2].y))
goto fail;
break;
return g_string_free (str, FALSE);
}
-static gint
+static guint
clutter_path_node_distance (const ClutterKnot *start,
const ClutterKnot *end)
{
- gint t;
+ gint64 x_d, y_d;
+ float t;
g_return_val_if_fail (start != NULL, 0);
g_return_val_if_fail (end != NULL, 0);
if (clutter_knot_equal (start, end))
return 0;
- t = (end->x - start->x) * (end->x - start->x) +
- (end->y - start->y) * (end->y - start->y);
+ x_d = end->x - start->x;
+ y_d = end->y - start->y;
- return sqrtf (t);
+ t = floorf (sqrtf ((x_d * x_d) + (y_d * y_d)));
+
+ return (guint) t;
}
static void