ClutterActor: Avoid frequent signal emission if possible

Avoid signal emission for ::paint/::pick if no handlers are connected,
which is the most frequent case.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
This commit is contained in:
Emmanuele Bassi 2017-04-28 19:47:52 +02:00 committed by Carlos Garnacho
parent 05d15f8885
commit 4b4c2b1afa

View File

@ -4015,7 +4015,11 @@ clutter_actor_continue_paint (ClutterActor *self)
clutter_paint_node_unref (dummy);
/* XXX:2.0 - Call the paint() virtual directly */
g_signal_emit (self, actor_signals[PAINT], 0);
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
0, TRUE))
g_signal_emit (self, actor_signals[PAINT], 0);
else
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
}
else
{
@ -4029,7 +4033,11 @@ clutter_actor_continue_paint (ClutterActor *self)
*
* XXX:2.0 - Call the pick() virtual directly
*/
g_signal_emit (self, actor_signals[PICK], 0, &col);
if (g_signal_has_handler_pending (self, actor_signals[PICK],
0, TRUE))
g_signal_emit (self, actor_signals[PICK], 0, &col);
else
CLUTTER_ACTOR_GET_CLASS (self)->pick (self, &col);
}
}
else