diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2024-01-26 21:58:18 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-01-28 01:48:28 +0100 |
commit | 604594a8f1d048b516120ba98eba71302e2043b4 (patch) | |
tree | 22e2923cadd1413503d1527bb10efbaaf1c09d81 /fiv-thumbnail.c | |
parent | 9acab00bcc53d3adc52f1681d733e57dcb3c3f0d (diff) | |
download | fiv-604594a8f1d048b516120ba98eba71302e2043b4.tar.gz fiv-604594a8f1d048b516120ba98eba71302e2043b4.tar.xz fiv-604594a8f1d048b516120ba98eba71302e2043b4.zip |
Prepare for parallelized colour management
This rewrite is more or less necessary for:
- colour-managed browser thumbnails,
- asynchronous image loading,
- turning fiv-io into a reusable library.
Little CMS has a fairly terrible API in this regard.
Diffstat (limited to 'fiv-thumbnail.c')
-rw-r--r-- | fiv-thumbnail.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fiv-thumbnail.c b/fiv-thumbnail.c index 6ff1246..80f378e 100644 --- a/fiv-thumbnail.c +++ b/fiv-thumbnail.c @@ -137,10 +137,12 @@ might_be_a_thumbnail(const char *path_or_uri) static FivIoImage * render(GFile *target, GBytes *data, gboolean *color_managed, GError **error) { + FivIoCmm *cmm = fiv_io_cmm_get_default(); FivIoOpenContext ctx = { .uri = g_file_get_uri(target), // Remember to synchronize changes with adjust_thumbnail(). - .screen_profile = fiv_io_profile_new_sRGB(), + .cmm = cmm, + .screen_profile = fiv_io_cmm_get_profile_sRGB(cmm), .screen_dpi = 96, .first_frame_only = TRUE, // Only using this array as a redirect. @@ -182,9 +184,11 @@ adjust_thumbnail(FivIoImage *thumbnail, double row_height) FivIoRenderClosure *closure = thumbnail->render; if (closure && orientation <= FivIoOrientation0) { // Remember to synchronize changes with render(). - FivIoProfile *screen_profile = fiv_io_profile_new_sRGB(); + FivIoCmm *cmm = fiv_io_cmm_get_default(); + FivIoProfile *screen_profile = fiv_io_cmm_get_profile_sRGB(cmm); // This API doesn't accept non-uniform scaling; prefer a vertical fit. - FivIoImage *scaled = closure->render(closure, screen_profile, scale_y); + FivIoImage *scaled = + closure->render(closure, cmm, screen_profile, scale_y); if (screen_profile) fiv_io_profile_free(screen_profile); if (scaled) |