From 9ccae46bc1e5af4fe51bc1d5b2f29e475585303d Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 26 Jan 2009 16:22:39 +0000 Subject: [PATCH] Bug 1415 - short-circuit setting same clip again There is some GL work and a repaint anytime the clip is set or unset, so avoid that if it isn't really changed. Signed-off-by: Emmanuele Bassi --- clutter/clutter-actor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 81e7757c2..c5445aab9 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -5539,6 +5539,13 @@ clutter_actor_set_clipu (ClutterActor *self, priv = self->priv; + if (priv->has_clip && + priv->clip[0] == xoff && + priv->clip[1] == yoff && + priv->clip[2] == width && + priv->clip[3] == height) + return; + priv->clip[0] = xoff; priv->clip[1] = yoff; priv->clip[2] = width; @@ -5591,6 +5598,9 @@ clutter_actor_remove_clip (ClutterActor *self) { g_return_if_fail (CLUTTER_IS_ACTOR (self)); + if (!self->priv->has_clip) + return; + self->priv->has_clip = FALSE; clutter_actor_queue_redraw (self);