[actor] Avoid modifying materials mid-scene to improve journal batching

Currently cogl_set_source_color uses a single shared material which means
each actor that uses it causes the journal to flush if the color changes.
Until we improve cogl_set_source_color to use a pool of materials that can
be recycled as the journal is flushed we avoid mid-scene material changes by
giving all actors a private material instead.
This commit is contained in:
Robert Bragg 2009-06-17 18:36:27 +01:00
parent 40cfaeaffc
commit dc1ca79398

View File

@ -332,6 +332,8 @@ struct _ClutterActorPrivate
PangoContext *pango_context;
ClutterActor *opacity_parent;
CoglHandle pick_material;
};
enum
@ -1374,11 +1376,13 @@ clutter_actor_real_pick (ClutterActor *self,
width = box.x2 - box.x1;
height = box.y2 - box.y1;
cogl_set_source_color4ub (color->red,
color->green,
color->blue,
color->alpha);
cogl_material_set_color4ub (self->priv->pick_material,
color->red,
color->green,
color->blue,
color->alpha);
cogl_set_source (self->priv->pick_material);
cogl_rectangle (0, 0, width, height);
}
}
@ -4254,6 +4258,8 @@ clutter_actor_init (ClutterActor *self)
priv->opacity_parent = NULL;
priv->enable_model_view_transform = TRUE;
priv->pick_material = cogl_material_new ();
memset (priv->clip, 0, sizeof (gfloat) * 4);
}