1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:27:46 +00:00

LibGfx/ICC: Cache presence of various tags

Reduces time spent rendering page 3 of 0000849.pdf from 1.45s to 1.32s
on my machine.

Also reduces the time to run Meta/test_pdf.py on 0000.zip
(without 0000849.pdf) from 58s to 55s.
This commit is contained in:
Nico Weber 2024-01-08 19:08:02 -05:00 committed by Sam Atkins
parent 3365a92ead
commit 89315787ae
2 changed files with 27 additions and 14 deletions

View file

@ -249,6 +249,13 @@ private:
ErrorOr<FloatVector3> to_pcs_a_to_b(TagData const& tag_data, ReadonlyBytes) const;
ErrorOr<void> from_pcs_b_to_a(TagData const& tag_data, FloatVector3 const&, Bytes) const;
// Cached values.
bool m_cached_has_any_a_to_b_tag { false };
bool m_cached_has_a_to_b0_tag { false };
bool m_cached_has_any_b_to_a_tag { false };
bool m_cached_has_b_to_a0_tag { false };
bool m_cached_has_all_rgb_matrix_tags { false };
// Only valid for RGB matrix-based profiles.
ErrorOr<FloatMatrix3x3> xyz_to_rgb_matrix() const;
FloatMatrix3x3 rgb_to_xyz_matrix() const;