draw: call vfunc rather then emit signal for the common case
This avoids a lot of overhead in the common case where a signal is not connected and we're just using the class vfunc (which is true for all in-libgtk widgets). Additionally it makes backtraces in debuggers and profiles much much nicer to look at. https://bugzilla.gnome.org/show_bug.cgi?id=754986
This commit is contained in:
@ -6834,9 +6834,18 @@ _gtk_widget_draw_internal (GtkWidget *widget,
|
|||||||
|
|
||||||
gdk_window_mark_paint_from_clip (window, cr);
|
gdk_window_mark_paint_from_clip (window, cr);
|
||||||
|
|
||||||
g_signal_emit (widget, widget_signals[DRAW],
|
if (g_signal_has_handler_pending (widget, widget_signals[DRAW], 0, FALSE))
|
||||||
0, cr,
|
{
|
||||||
&result);
|
g_signal_emit (widget, widget_signals[DRAW],
|
||||||
|
0, cr,
|
||||||
|
&result);
|
||||||
|
}
|
||||||
|
else if (GTK_WIDGET_GET_CLASS (widget)->draw)
|
||||||
|
{
|
||||||
|
cairo_save (cr);
|
||||||
|
GTK_WIDGET_GET_CLASS (widget)->draw (widget, cr);
|
||||||
|
cairo_restore (cr);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
if (GTK_DEBUG_CHECK (BASELINES))
|
if (GTK_DEBUG_CHECK (BASELINES))
|
||||||
|
|||||||
Reference in New Issue
Block a user