mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
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:
parent
2dba3e8cbf
commit
305bb124b7
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user