diff --git a/demos/gtk-demo/paintable.c b/demos/gtk-demo/paintable.c index 3b3da1e0bc..933e7abd48 100644 --- a/demos/gtk-demo/paintable.c +++ b/demos/gtk-demo/paintable.c @@ -48,15 +48,17 @@ void gtk_nuclear_snapshot (GtkSnapshot *snapshot, double width, double height, - double rotation) + double rotation, + gboolean draw_background) { #define RADIUS 0.3 cairo_t *cr; double size; - gtk_snapshot_append_color (snapshot, - &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, - &GRAPHENE_RECT_INIT (0, 0, width, height)); + if (draw_background) + gtk_snapshot_append_color (snapshot, + &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, + &GRAPHENE_RECT_INIT (0, 0, width, height)); size = MIN (width, height); cr = gtk_snapshot_append_cairo (snapshot, @@ -93,7 +95,8 @@ gtk_nuclear_icon_snapshot (GdkPaintable *paintable, gtk_nuclear_snapshot (snapshot, width, height, - nuclear->rotation); + nuclear->rotation, + TRUE); } static GdkPaintableFlags diff --git a/demos/gtk-demo/paintable.h b/demos/gtk-demo/paintable.h index 33bc4dbc8b..a89713f9b1 100644 --- a/demos/gtk-demo/paintable.h +++ b/demos/gtk-demo/paintable.h @@ -6,10 +6,11 @@ void gtk_nuclear_snapshot (GtkSnapshot *snapshot, double width, double height, - double rotation); + double rotation, + gboolean draw_background); GdkPaintable * gtk_nuclear_icon_new (double rotation); -GdkPaintable * gtk_nuclear_animation_new (void); +GdkPaintable * gtk_nuclear_animation_new (gboolean draw_background); GtkMediaStream *gtk_nuclear_media_stream_new (void); #endif /* __PAINTABLE_H__ */ diff --git a/demos/gtk-demo/paintable_animated.c b/demos/gtk-demo/paintable_animated.c index 17b1372d98..93a51d492c 100644 --- a/demos/gtk-demo/paintable_animated.c +++ b/demos/gtk-demo/paintable_animated.c @@ -33,6 +33,8 @@ struct _GtkNuclearAnimation { GObject parent_instance; + gboolean draw_background; + /* This variable stores the progress of our animation. * We just count upwards until we hit MAX_PROGRESS and * then start from scratch. @@ -64,7 +66,8 @@ gtk_nuclear_animation_snapshot (GdkPaintable *paintable, /* We call the function from the previous example here. */ gtk_nuclear_snapshot (snapshot, width, height, - 2 * G_PI * nuclear->progress / MAX_PROGRESS); + 2 * G_PI * nuclear->progress / MAX_PROGRESS, + nuclear->draw_background); } static GdkPaintable * @@ -175,9 +178,15 @@ gtk_nuclear_animation_init (GtkNuclearAnimation *nuclear) /* And finally, we add the simple constructor we declared in the header. */ GdkPaintable * -gtk_nuclear_animation_new (void) +gtk_nuclear_animation_new (gboolean draw_background) { - return g_object_new (GTK_TYPE_NUCLEAR_ANIMATION, NULL); + GtkNuclearAnimation *nuclear; + + nuclear = g_object_new (GTK_TYPE_NUCLEAR_ANIMATION, NULL); + + nuclear->draw_background = draw_background; + + return GDK_PAINTABLE (nuclear); } GtkWidget * @@ -195,7 +204,7 @@ do_paintable_animated (GtkWidget *do_widget) gtk_window_set_default_size (GTK_WINDOW (window), 300, 200); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); - nuclear = gtk_nuclear_animation_new (); + nuclear = gtk_nuclear_animation_new (TRUE); image = gtk_image_new_from_paintable (nuclear); gtk_window_set_child (GTK_WINDOW (window), image); g_object_unref (nuclear); diff --git a/demos/gtk-demo/paintable_mediastream.c b/demos/gtk-demo/paintable_mediastream.c index 022c156d8a..6374087b96 100644 --- a/demos/gtk-demo/paintable_mediastream.c +++ b/demos/gtk-demo/paintable_mediastream.c @@ -74,7 +74,8 @@ gtk_nuclear_media_stream_snapshot (GdkPaintable *paintable, /* We call the function from the previous example here. */ gtk_nuclear_snapshot (snapshot, width, height, - 2 * G_PI * nuclear->progress / DURATION); + 2 * G_PI * nuclear->progress / DURATION, + TRUE); } static GdkPaintable * diff --git a/demos/gtk-demo/sliding_puzzle.c b/demos/gtk-demo/sliding_puzzle.c index 4cd2ab9116..a91aa6c227 100644 --- a/demos/gtk-demo/sliding_puzzle.c +++ b/demos/gtk-demo/sliding_puzzle.c @@ -437,7 +437,7 @@ do_sliding_puzzle (GtkWidget *do_widget) choices = gtk_flow_box_new (); gtk_widget_add_css_class (choices, "view"); add_choice (choices, puzzle); - add_choice (choices, gtk_nuclear_animation_new ()); + add_choice (choices, gtk_nuclear_animation_new (TRUE)); media = gtk_media_file_new_for_resource ("/images/gtk-logo.webm"); gtk_media_stream_set_loop (media, TRUE); gtk_media_stream_set_muted (media, TRUE); diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c index ffb0edd318..42c0f6636f 100644 --- a/demos/gtk-demo/textview.c +++ b/demos/gtk-demo/textview.c @@ -142,7 +142,7 @@ insert_text (GtkTextView *view) 32, 1, gtk_widget_get_direction (widget), 0); - nuclear = gtk_nuclear_animation_new (); + nuclear = gtk_nuclear_animation_new (TRUE); /* get start of buffer; each insertion will revalidate the * iterator to point to just after the inserted text.