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

View File

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