aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-06-23 23:08:20 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-06-24 14:36:24 +0200
commitbb4d3acd12976fa955b303f1460641e086de59ec (patch)
tree0b026e68b80db2eded0e3f52b094c3ecb22db72f
parent074bd4d37f36fa8963e66aa0f8f9de3ff6cadba7 (diff)
downloadfiv-bb4d3acd12976fa955b303f1460641e086de59ec.tar.gz
fiv-bb4d3acd12976fa955b303f1460641e086de59ec.tar.xz
fiv-bb4d3acd12976fa955b303f1460641e086de59ec.zip
Premultiply through Little CMS in animations
-rw-r--r--fiv-io.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/fiv-io.c b/fiv-io.c
index 0efee93..a685024 100644
--- a/fiv-io.c
+++ b/fiv-io.c
@@ -553,26 +553,24 @@ fiv_io_profile_argb32_premultiply(
}
}
-#define fiv_io_profile_argb32_premultiply_page(page, target) \
- fiv_io_profile_page((page), (target), fiv_io_profile_argb32_premultiply)
-
#else // ! HAVE_LCMS2 || LCMS_VERSION < 2130
// TODO(p): Unpremultiply, transform, repremultiply. Or require lcms2>=2.13.
#define fiv_io_profile_argb32(surface, source, target)
static void
-fiv_io_profile_argb32_premultiply_page(
- FivIoImage *page, FivIoProfile target)
+fiv_io_profile_argb32_premultiply(
+ FivIoImage *image, FivIoProfile source, FivIoProfile target)
{
- fiv_io_profile_page(page, target, fiv_io_profile_xrgb32);
-
- for (FivIoImage *frame = page; frame != NULL; frame = frame->frame_next)
- fiv_io_premultiply_argb32(frame);
+ fiv_io_profile_xrgb32(image, source, target);
+ fiv_io_premultiply_argb32(image);
}
#endif // ! HAVE_LCMS2 || LCMS_VERSION < 2130
+#define fiv_io_profile_argb32_premultiply_page(page, target) \
+ fiv_io_profile_page((page), (target), fiv_io_profile_argb32_premultiply)
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void
@@ -768,8 +766,7 @@ load_wuffs_frame(struct load_wuffs_frame_context *ctx, GError **error)
targetbuf, ctx->width, ctx->height, ctx->source, ctx->target);
// The first one premultiplies below, the second doesn't need to.
} else {
- fiv_io_profile_xrgb32(image, ctx->source, ctx->target);
- fiv_io_premultiply_argb32(image);
+ fiv_io_profile_argb32_premultiply(image, ctx->source, ctx->target);
}
}