Premultiply through Little CMS in animations

This commit is contained in:
Přemysl Eric Janouch 2023-06-23 23:08:20 +02:00
parent 074bd4d37f
commit bb4d3acd12
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 8 additions and 11 deletions

View File

@ -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 #else // ! HAVE_LCMS2 || LCMS_VERSION < 2130
// TODO(p): Unpremultiply, transform, repremultiply. Or require lcms2>=2.13. // TODO(p): Unpremultiply, transform, repremultiply. Or require lcms2>=2.13.
#define fiv_io_profile_argb32(surface, source, target) #define fiv_io_profile_argb32(surface, source, target)
static void static void
fiv_io_profile_argb32_premultiply_page( fiv_io_profile_argb32_premultiply(
FivIoImage *page, FivIoProfile target) FivIoImage *image, FivIoProfile source, FivIoProfile target)
{ {
fiv_io_profile_page(page, target, fiv_io_profile_xrgb32); fiv_io_profile_xrgb32(image, source, target);
fiv_io_premultiply_argb32(image);
for (FivIoImage *frame = page; frame != NULL; frame = frame->frame_next)
fiv_io_premultiply_argb32(frame);
} }
#endif // ! HAVE_LCMS2 || LCMS_VERSION < 2130 #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 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); targetbuf, ctx->width, ctx->height, ctx->source, ctx->target);
// The first one premultiplies below, the second doesn't need to. // The first one premultiplies below, the second doesn't need to.
} else { } else {
fiv_io_profile_xrgb32(image, ctx->source, ctx->target); fiv_io_profile_argb32_premultiply(image, ctx->source, ctx->target);
fiv_io_premultiply_argb32(image);
} }
} }