From 18946b10b2631985bb12d6e04a3ff95b15d2ac50 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 14 Oct 2010 20:59:47 +0200 Subject: [PATCH] Use cairo to draw static throbber and avoid unused code paths --- katze/katze-throbber.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c index 6dcbbac1..66e133e3 100644 --- a/katze/katze-throbber.c +++ b/katze/katze-throbber.c @@ -855,14 +855,8 @@ static gboolean katze_throbber_expose_event (GtkWidget* widget, GdkEventExpose* event) { - gint ax, ay; KatzeThrobber* throbber = KATZE_THROBBER (widget); - #if HAVE_SPINNER - if (throbber->animated) - return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event); - #endif - if (G_UNLIKELY (!throbber->width || !throbber->height)) return TRUE; @@ -873,6 +867,9 @@ katze_throbber_expose_event (GtkWidget* widget, if (!throbber->animated && (throbber->static_pixbuf || throbber->static_icon_name || throbber->static_stock_id)) { + gint ax, ay; + cairo_t* cr; + if (G_UNLIKELY (!throbber->static_pixbuf && throbber->static_icon_name)) { icon_theme_changed (KATZE_THROBBER (widget)); @@ -902,13 +899,17 @@ katze_throbber_expose_event (GtkWidget* widget, katze_throbber_aligned_coords (widget, &ax, &ay); - gdk_draw_pixbuf (event->window, NULL, throbber->static_pixbuf, - 0, 0, ax, ay, - throbber->width, throbber->height, - GDK_RGB_DITHER_NONE, 0, 0); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); + gdk_cairo_set_source_pixbuf (cr, throbber->static_pixbuf, ax, ay); + cairo_paint (cr); + cairo_destroy (cr); } else { + #if HAVE_SPINNER + if (throbber->animated) + return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event); + #else gint cols, rows; if (G_UNLIKELY (throbber->icon_name && !throbber->pixbuf)) @@ -969,6 +970,7 @@ katze_throbber_expose_event (GtkWidget* widget, g_object_notify (G_OBJECT (throbber), "pixbuf"); g_object_thaw_notify (G_OBJECT (throbber)); } + #endif } return TRUE;