render: Remove spinner special-cases

The spinner is a regular builtin image now. There is no need to go
through the shadows code manually anymore as regular items do get
shadows automatically.

This also allows simplifying the actual spinner drawing code so that it
actually works.
This commit is contained in:
Benjamin Otte
2015-01-19 17:41:29 +01:00
parent cc4d34e688
commit e697213b35
7 changed files with 31 additions and 104 deletions

View File

@ -732,17 +732,44 @@ gtk_css_image_builtin_draw_spinner (GtkCssImage *image,
double height)
{
GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
guint num_steps;
gdouble radius;
gdouble half;
gint i;
radius = MIN (width / 2, height / 2);
cairo_save (cr);
cairo_translate (cr, width / 2, height / 2);
gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
gtk_render_paint_spinner (cr, radius, -1);
num_steps = 12;
cairo_restore (cr);
cairo_set_line_width (cr, 2.0);
half = num_steps / 2;
for (i = 0; i < num_steps; i++)
{
gint inset = 0.7 * radius;
/* transparency is a function of time and intial value */
gdouble t = 1.0 - (gdouble) i / num_steps;
gdouble xscale = - sin (i * G_PI / half);
gdouble yscale = - cos (i * G_PI / half);
cairo_move_to (cr,
(radius - inset) * xscale,
(radius - inset) * yscale);
cairo_line_to (cr,
radius * xscale,
radius * yscale);
cairo_set_source_rgba (cr,
builtin->fg_color.red,
builtin->fg_color.green,
builtin->fg_color.blue,
builtin->fg_color.alpha * t);
cairo_stroke (cr);
}
}
static void