mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Improve progressive loading from slow sources: (#107368)
2003-05-19 Matthias Clasen <maclas@gmx.de> Improve progressive loading from slow sources: (#107368) * io-gif-animation.c (gdk_pixbuf_gif_anim_get_iter): Initialize first_loop_slowness. (gdk_pixbuf_gif_anim_iter_advance): Don't wrap during loading if the datasource falls behind the speed of the display. * io-gif-animation.h: Add a loading flag to GdkPixbufGifAnim and first_loop_slowness to GdkPixbufGifAnimIter.
This commit is contained in:
parent
69c1943972
commit
ed1ac0e2c6
@ -1,3 +1,15 @@
|
||||
2003-05-19 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
Improve progressive loading from slow sources: (#107368)
|
||||
|
||||
* io-gif-animation.c (gdk_pixbuf_gif_anim_get_iter): Initialize
|
||||
first_loop_slowness.
|
||||
(gdk_pixbuf_gif_anim_iter_advance): Don't wrap during loading if
|
||||
the datasource falls behind the speed of the display.
|
||||
|
||||
* io-gif-animation.h: Add a loading flag to GdkPixbufGifAnim and
|
||||
first_loop_slowness to GdkPixbufGifAnimIter.
|
||||
|
||||
Wed May 14 18:24:50 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk-pixdata.c (gdk_pixdata_deserialize): Add a
|
||||
|
@ -180,6 +180,7 @@ gdk_pixbuf_gif_anim_get_iter (GdkPixbufAnimation *anim,
|
||||
|
||||
iter->start_time = *start_time;
|
||||
iter->current_time = *start_time;
|
||||
iter->first_loop_slowness = 0;
|
||||
|
||||
return GDK_PIXBUF_ANIMATION_ITER (iter);
|
||||
}
|
||||
@ -287,8 +288,21 @@ gdk_pixbuf_gif_anim_iter_advance (GdkPixbufAnimationIter *anim_iter,
|
||||
* and subtract time for that.
|
||||
*/
|
||||
|
||||
loop = elapsed / iter->gif_anim->total_time;
|
||||
elapsed = elapsed % iter->gif_anim->total_time;
|
||||
if (iter->gif_anim->loading)
|
||||
loop = 0;
|
||||
else {
|
||||
/* If current_frame is NULL at this point, we have loaded the
|
||||
* animation from a source which fell behind the speed of the
|
||||
* display. We remember how much slower the first loop was due
|
||||
* to this and correct the position calculation in order to not
|
||||
* jump in the middle of the second loop.
|
||||
*/
|
||||
if (iter->current_frame == NULL)
|
||||
iter->first_loop_slowness = MAX(0, elapsed - iter->gif_anim->total_time);
|
||||
|
||||
loop = (elapsed - iter->first_loop_slowness) / iter->gif_anim->total_time;
|
||||
elapsed = (elapsed - iter->first_loop_slowness) % iter->gif_anim->total_time;
|
||||
}
|
||||
|
||||
iter->position = elapsed;
|
||||
|
||||
@ -334,9 +348,8 @@ gdk_pixbuf_gif_anim_iter_get_delay_time (GdkPixbufAnimationIter *anim_iter)
|
||||
#endif
|
||||
|
||||
return frame->delay_time - (iter->position - frame->elapsed);
|
||||
} else {
|
||||
} else
|
||||
return -1; /* show last frame forever */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -78,6 +78,7 @@ struct _GdkPixbufGifAnim {
|
||||
guchar bg_blue;
|
||||
|
||||
int loop;
|
||||
gboolean loading;
|
||||
};
|
||||
|
||||
struct _GdkPixbufGifAnimClass {
|
||||
@ -113,6 +114,8 @@ struct _GdkPixbufGifAnimIter {
|
||||
gint position;
|
||||
|
||||
GList *current_frame;
|
||||
|
||||
gint first_loop_slowness;
|
||||
};
|
||||
|
||||
struct _GdkPixbufGifAnimIterClass {
|
||||
|
Loading…
Reference in New Issue
Block a user