This directory contains helpers and wrappers for exposing ICC (International Color Consortium) profile parsing from the moxcms Rust crate to Skia codecs:
SkPngRustCodec and SkBmpRustCodecImage Codec → ICC bytes → rust_icc::parse_icc_profile()
↓ (moxcms parsing)
IccProfile struct
↓
rust_icc::ToSkcmsIccProfile()
↓
skcms_ICCProfile
↓
Skia color transformations
All ICC profile parsing happens in Rust using the moxcms crate. This prevents memory safety vulnerabilities from malformed ICC data. The validated, parsed data is then converted to skcms_ICCProfile structures for use by Skia's color management system (skcms).
The parser supports:
$ cd skia-repo-root $ bazelisk build //rust/icc:ffi_rs $ bazelisk test //rust/icc:ffi_rs_test
Enabled automatically when Rust codecs are enabled:
$ gn args out/RustEnabled # Set: skia_use_rust_png_decode = true $ gn gen out/RustEnabled $ autoninja -C out/RustEnabled
Rust unit tests (test Rust-side parsing and FFI data structures):
$ bazelisk test //rust/icc:ffi_rs_test --test_output=all
C++ unit tests (test the complete FFI bridge to skcms):
Build and run via Skia's dm test runner:
$ gn gen out/Debug --args='skia_use_rust_png_decode=true' $ ninja -C out/Debug dm $ out/Debug/dm --src tests --match RustIcc
The C++ tests are located in tests/RustIccTest.cpp.