aboutsummaryrefslogtreecommitdiff
path: root/fastiv-io.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-26 20:54:08 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-26 20:54:41 +0100
commit18e96d8c9dd6b0346514121facf8137f13ccd6dc (patch)
tree96db29d63a69be5cab71c907822a6e4899d0c59b /fastiv-io.c
parentbd7f2f8c987772704a5889790b2dc06fa087ee62 (diff)
downloadfiv-18e96d8c9dd6b0346514121facf8137f13ccd6dc.tar.gz
fiv-18e96d8c9dd6b0346514121facf8137f13ccd6dc.tar.xz
fiv-18e96d8c9dd6b0346514121facf8137f13ccd6dc.zip
Allow frame iteration in both directions
Diffstat (limited to 'fastiv-io.c')
-rw-r--r--fastiv-io.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fastiv-io.c b/fastiv-io.c
index a2ac166..35e640d 100644
--- a/fastiv-io.c
+++ b/fastiv-io.c
@@ -317,6 +317,8 @@ load_wuffs_frame(struct load_wuffs_frame_context *ctx, GError **error)
(void *) (intptr_t) (wuffs_base__frame_config__duration(&fc) /
WUFFS_BASE__FLICKS_PER_MILLISECOND), NULL);
+ cairo_surface_set_user_data(surface, &fastiv_io_key_frame_previous,
+ ctx->result_tail, NULL);
if (ctx->result_tail)
cairo_surface_set_user_data(ctx->result_tail, &fastiv_io_key_frame_next,
surface, (cairo_destroy_func_t) cairo_surface_destroy);
@@ -466,6 +468,11 @@ open_wuffs(
while (load_wuffs_frame(&ctx, error))
;
+ // Wrap the chain around, since our caller receives only one pointer.
+ if (ctx.result)
+ cairo_surface_set_user_data(ctx.result, &fastiv_io_key_frame_previous,
+ ctx.result_tail, NULL);
+
fail:
free(ctx.workbuf.ptr);
g_clear_pointer(&ctx.meta_exif, g_bytes_unref);
@@ -1024,6 +1031,7 @@ cairo_user_data_key_t fastiv_io_key_orientation;
cairo_user_data_key_t fastiv_io_key_icc;
cairo_user_data_key_t fastiv_io_key_frame_next;
+cairo_user_data_key_t fastiv_io_key_frame_previous;
cairo_user_data_key_t fastiv_io_key_frame_duration;
cairo_user_data_key_t fastiv_io_key_loops;