Debian Codegraph @

src/codec/SkCodecColorProfileRust.cpp

raw
1 /*
2 * Copyright 2025 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "src/codec/SkCodecColorProfileRust.h"
9
10 #include "rust/icc/FFI.rs.h"
11
12 namespace SkCodecs {
13
14 std::unique_ptr<ColorProfile> MakeICCProfileWithRust(
15 sk_sp<const SkData> data) {
16 if (data) {
17 rust_icc::IccProfile rust_profile;
18
19 if (rust_icc::parse_icc_profile(
20 rust::Slice<const uint8_t>(data->bytes(), data->size()), rust_profile)) {
21 skcms_ICCProfile profile;
22 rust_icc::ToSkcmsIccProfile(rust_profile, &profile);
23 return std::unique_ptr<ColorProfile>(
24 new ColorProfile(profile, std::move(data)));
25 }
26 }
27 return nullptr;
28 }
29
30 } // namespace SkCodecs