aboutsummaryrefslogtreecommitdiff
path: root/src/imv.c
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-07-15 23:06:34 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-07-15 23:14:54 +0100
commit4e4174918749a44fdcaa4e8390a747698cbcfdb0 (patch)
tree9149b2df40610e278398ce754940c6b9ba391c12 /src/imv.c
parentdd69714d74accd6749b6523e55bba3da552eb4e2 (diff)
downloadimv-4e4174918749a44fdcaa4e8390a747698cbcfdb0.tar.gz
Fix next frame command
Diffstat (limited to 'src/imv.c')
-rw-r--r--src/imv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/imv.c b/src/imv.c
index 6f8972b..6581013 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -135,6 +135,8 @@ struct imv {
double duration;
/* the next frame of an animated image, pre-fetched */
struct imv_image *image;
+ /* force the next frame to load, even if early */
+ bool force_next_frame;
} next_frame;
struct imv_image *current_image;
@@ -944,8 +946,16 @@ int imv_run(struct imv *imv)
current_time = cur_time();
/* Check if a new frame is due */
+ bool should_change_frame = false;
+ if (imv->next_frame.force_next_frame && imv->next_frame.image) {
+ should_change_frame = true;
+ }
if (imv_viewport_is_playing(imv->view) && imv->next_frame.image
&& imv->next_frame.due && imv->next_frame.due <= current_time) {
+ should_change_frame = true;
+ }
+
+ if (should_change_frame) {
if (imv->current_image) {
imv_image_free(imv->current_image);
}
@@ -953,6 +963,7 @@ int imv_run(struct imv *imv)
imv->next_frame.image = NULL;
imv->next_frame.due = current_time + imv->next_frame.duration;
imv->next_frame.duration = 0;
+ imv->next_frame.force_next_frame = false;
imv->need_redraw = true;
@@ -1516,7 +1527,7 @@ static void command_next_frame(struct list *args, const char *argstr, void *data
struct imv *imv = data;
if (imv->current_source && imv->current_source->load_next_frame) {
async_load_next_frame(imv->current_source);
- imv->next_frame.due = 0.0001; /* Earliest possible non-zero timestamp */
+ imv->next_frame.force_next_frame = true;
}
}