mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
gtk-demo: Fix images demo
The incremental loading was broken by GtkIconHelper - queuing a redraw is no longer sufficient to cause GtkImage to redraw with the new pixbuf contents. Pointed out by Jasper St. Pierre.
This commit is contained in:
parent
9268ef36ab
commit
8ccdd5b7cf
@ -50,18 +50,21 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
image = GTK_WIDGET (data);
|
image = GTK_WIDGET (data);
|
||||||
|
|
||||||
/* We know the pixbuf inside the GtkImage has changed, but the image
|
/* We know the pixbuf inside the GtkImage has changed, but the image
|
||||||
* itself doesn't know this; so queue a redraw. If we wanted to be
|
* itself doesn't know this; so give it a hint by setting the pixbuf
|
||||||
* really efficient, we could use a drawing area or something
|
* again. Queuing a redraw used to be sufficient, but nowadays GtkImage
|
||||||
* instead of a GtkImage, so we could control the exact position of
|
* uses GtkIconHelper which caches the pixbuf state and will just redraw
|
||||||
* the pixbuf on the display, then we could queue a draw for only
|
* from the cache.
|
||||||
* the updated area of the image.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gtk_widget_queue_draw (image);
|
pixbuf = gtk_image_get_pixbuf (GTK_IMAGE (image));
|
||||||
|
g_object_ref (pixbuf);
|
||||||
|
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
|
||||||
|
g_object_unref (pixbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
Loading…
Reference in New Issue
Block a user