use cogl_matrix_transform_points in clutter

When transforming a paint-volume or transforming allocation vertices we
are transforming more than one point at a time so we can batch those
together with cogl_matrix_transform_points instead of
cogl_matrix_transform_point. Also in both of these cases we don't need
to do a projective transform so using cogl_matrix_transform_points also
lets us reduce the per-vertex computation.
This commit is contained in:
Robert Bragg 2010-11-12 16:08:25 +00:00
parent 2dba3e8cbf
commit 305bb124b7
2 changed files with 15 additions and 26 deletions

View File

@ -2115,7 +2115,6 @@ clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActorBox box;
ClutterVertex vertices[4];
CoglMatrix modelview;
float w;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (ancestor == NULL || CLUTTER_IS_ACTOR (ancestor));
@ -2163,19 +2162,13 @@ clutter_actor_get_allocation_vertices (ClutterActor *self,
_clutter_actor_get_relative_modelview (self, ancestor, &modelview);
w = 1;
cogl_matrix_transform_point (&modelview,
&vertices[0].x, &vertices[0].y, &vertices[0].z,
&w);
cogl_matrix_transform_point (&modelview,
&vertices[1].x, &vertices[1].y, &vertices[1].z,
&w);
cogl_matrix_transform_point (&modelview,
&vertices[2].x, &vertices[2].y, &vertices[2].z,
&w);
cogl_matrix_transform_point (&modelview,
&vertices[3].x, &vertices[3].y, &vertices[3].z,
&w);
cogl_matrix_transform_points (&modelview,
3,
sizeof (ClutterVertex),
vertices,
sizeof (ClutterVertex),
vertices,
4);
}
/**
@ -8862,7 +8855,7 @@ clutter_actor_find_property (ClutterAnimatable *animatable,
if (meta != NULL)
{
klass = G_OBJECT_GET_CLASS (meta);
pspec = g_object_class_find_property (klass, p_name);
g_free (p_name);

View File

@ -693,7 +693,6 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
const CoglMatrix *matrix)
{
int transform_count;
int i;
if (pv->is_empty)
{
@ -718,16 +717,13 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
else
transform_count = 8;
for (i = 0; i < transform_count; i++)
{
gfloat w = 1;
cogl_matrix_transform_point (matrix,
&pv->vertices[i].x,
&pv->vertices[i].y,
&pv->vertices[i].z,
&w);
}
cogl_matrix_transform_points (matrix,
3,
sizeof (ClutterVertex),
pv->vertices,
sizeof (ClutterVertex),
pv->vertices,
transform_count);
pv->is_axis_aligned = FALSE;
}