From dc1ca79398e343d06918cf1c38b72771f476f0a6 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 17 Jun 2009 18:36:27 +0100 Subject: [PATCH] [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. --- clutter/clutter-actor.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 7f8b1e997..76c574a20 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -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); }