From 8a5c593af3b01e26a48e7d4e88d1d0104a12fcb1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 24 Jan 2022 07:01:12 +0100 Subject: [PATCH] ctx: factor lut processing out of path_process --- babl/babl-fish-path.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c index 422e9f4..f709c3f 100644 --- a/babl/babl-fish-path.c +++ b/babl/babl-fish-path.c @@ -756,15 +756,12 @@ babl_gc_fishes (void) // is responsibility of higher layers } -static void -babl_fish_path_process (const Babl *babl, - const char *source, - char *destination, - long n, - void *data) +static int babl_fish_lut_process_maybe (const Babl *babl, + const char *source, + const char *destination, + long n, + void *data) { - if (babl->fish_path.is_u8_color_conv) - { uint32_t *lut = (uint32_t*)babl->fish_path.u8_lut; ((Babl*)babl)->fish.pixels += n; @@ -867,8 +864,26 @@ babl_fish_path_process (const Babl *babl, } } BABL(babl)->fish_path.last_lut_use = babl_ticks (); - return; + return 1; } + return 0; +} + +static void +babl_fish_path_process (const Babl *babl, + const char *source, + char *destination, + long n, + void *data) +{ + if (babl->fish_path.is_u8_color_conv) + { + if (babl_fish_lut_process_maybe (babl, + source, + destination, + n, + data)) + return; } else { -- 2.30.2