[gtk/matthiasc/for-master: 4/4] gtk-demo: Speed up image demo




commit 44c66196609d57348cd4ef2b2d006aca54c8c191
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 22 00:22:15 2020 -0400

    gtk-demo: Speed up image demo
    
    The progressive loading demo here was so slow as to appear
    broken. Make it faster, and ensure that it updates regularly.

 demos/gtk-demo/images.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c
index e13302eb53..22177a7f5c 100644
--- a/demos/gtk-demo/images.c
+++ b/demos/gtk-demo/images.c
@@ -56,6 +56,7 @@ progressive_updated_callback (GdkPixbufLoader *loader,
   picture = GTK_WIDGET (data);
 
   pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+  gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
   gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
 }
 
@@ -262,7 +263,7 @@ start_progressive_loading (GtkWidget *picture)
    * The timeout simply simulates a slow data source by inserting
    * pauses in the reading process.
    */
-  load_timeout = g_timeout_add (1500, progressive_timeout, picture);
+  load_timeout = g_timeout_add (300, progressive_timeout, picture);
   g_source_set_name_by_id (load_timeout, "[gtk] progressive_timeout");
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]