1/*
2 * Copyright 2018 Google Inc.
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 "include/private/SkEncodedInfo.h"
9
10std::unique_ptr<SkEncodedInfo::ICCProfile> SkEncodedInfo::ICCProfile::Make(sk_sp<SkData> data) {
11 if (data) {
12 skcms_ICCProfile profile;
13 if (skcms_Parse(data->data(), data->size(), &profile)) {
14 return std::unique_ptr<ICCProfile>(new ICCProfile(profile, std::move(data)));
15 }
16 }
17 return nullptr;
18}
19
20std::unique_ptr<SkEncodedInfo::ICCProfile> SkEncodedInfo::ICCProfile::Make(
21 const skcms_ICCProfile& profile) {
22 return std::unique_ptr<ICCProfile>(new ICCProfile(profile));
23}
24
25SkEncodedInfo::ICCProfile::ICCProfile(const skcms_ICCProfile& profile, sk_sp<SkData> data)
26 : fProfile(profile)
27 , fData(std::move(data))
28{}
29