Drop both the ProfileCache and the LUT cache when `profile` matches the current cache key. set_input_gamut() mutates input_xy_* in place without touching the profile pointer or CCT, so the (pointer, cct) cache key stays equal and would otherwise serve stale M_src / LUT data.
| 362 | // touching the profile pointer or CCT, so the (pointer, cct) cache key |
| 363 | // stays equal and would otherwise serve stale M_src / LUT data. |
| 364 | void invalidate_colorimetric_caches_for(const DiodeProfile* profile) FL_NOEXCEPT { |
| 365 | ColorimetricCacheHolder& ch = |
| 366 | fl::Singleton<ColorimetricCacheHolder>::instance(); |
| 367 | if (ch.cached_for == profile) { |
| 368 | ch.cached_for = nullptr; |
| 369 | ch.cached_cct = 0; |
| 370 | } |
| 371 | LutStateHolder& lh = fl::Singleton<LutStateHolder>::instance(); |
| 372 | if (lh.built_for == profile) { |
| 373 | lh.built_for = nullptr; |
| 374 | lh.built_cct = 0; |
| 375 | } |
| 376 | } |
| 377 | } // namespace |
| 378 | |
| 379 | void rgb_2_rgbw_colorimetric(u16 w_color_temperature, u8 r, |