ply-image: Attempt to improve animation consistency.

When displaying an animation, ply-image previously slept
before loading and displaying each image.  The code was
written such that intervals between frames would be
reasonably consistent when faced with consistent load times
for each image, but less so for inconsistent load times.

This change makes ply-image load the next image before
sleeping the required amount and displaying the image.

In my testing, this leads to very consistent frame intervals
during boot on Lumpy -- out of 18 frames, all but one or two
are shown 25 ms after the previous frame and the others are
all 26 ms.  Doing the same testing with the old code, I see
intervals ranging between 22 and 29 ms.

BUG=chromium-os:33971
TEST=update /etc/init/boot-splash.conf to pass --debug to
     ply-image and to redirect stderr to a file in /tmp;
     after booting, grep it for "showing" and check
     timestamps

Change-Id: Ibb82f8d38d8a19dce555028f9288b70789362edb
Reviewed-on: https://gerrit.chromium.org/gerrit/38433
Commit-Ready: Daniel Erat <derat@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
1 file changed