OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkColorSpace.h" | 8 #include "SkColorSpace.h" |
9 #include "SkColorSpace_Base.h" | 9 #include "SkColorSpace_Base.h" |
10 #include "SkEndian.h" | 10 #include "SkEndian.h" |
11 #include "SkOnce.h" | 11 #include "SkOnce.h" |
12 | 12 |
13 static bool color_space_almost_equal(float a, float b) { | 13 static bool color_space_almost_equal(float a, float b) { |
14 return SkTAbs(a - b) < 0.01f; | 14 return SkTAbs(a - b) < 0.01f; |
15 } | 15 } |
16 | 16 |
17 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 17 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
18 | 18 |
19 SkColorSpace::SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Na
med named) | 19 SkColorSpace::SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Na
med named) |
20 : fGammaNamed(kNonStandard_GammaNamed) | 20 : fGammaNamed(gammaNamed) |
21 , fToXYZD50(toXYZD50) | 21 , fToXYZD50(toXYZD50) |
22 , fNamed(named) | 22 , fNamed(named) |
23 {} | 23 {} |
24 | 24 |
25 SkColorSpace_Base::SkColorSpace_Base(sk_sp<SkGammas> gammas, const SkMatrix44& t
oXYZD50, | 25 SkColorSpace_Base::SkColorSpace_Base(sk_sp<SkGammas> gammas, const SkMatrix44& t
oXYZD50, |
26 Named named, sk_sp<SkData> profileData) | 26 Named named, sk_sp<SkData> profileData) |
27 : INHERITED(kNonStandard_GammaNamed, toXYZD50, named) | 27 : INHERITED(kNonStandard_GammaNamed, toXYZD50, named) |
28 , fGammas(std::move(gammas)) | 28 , fGammas(std::move(gammas)) |
29 , fProfileData(std::move(profileData)) | 29 , fProfileData(std::move(profileData)) |
30 {} | 30 {} |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 ptr32[4] = SkEndian_SwapBE32(0x000116cc); | 1092 ptr32[4] = SkEndian_SwapBE32(0x000116cc); |
1093 ptr += kTAG_XYZ_Bytes; | 1093 ptr += kTAG_XYZ_Bytes; |
1094 | 1094 |
1095 // Write copyright tag | 1095 // Write copyright tag |
1096 memcpy(ptr, gEmptyTextTag, sizeof(gEmptyTextTag)); | 1096 memcpy(ptr, gEmptyTextTag, sizeof(gEmptyTextTag)); |
1097 | 1097 |
1098 // TODO (msarett): Should we try to hold onto the data so we can return imme
diately if | 1098 // TODO (msarett): Should we try to hold onto the data so we can return imme
diately if |
1099 // the client calls again? | 1099 // the client calls again? |
1100 return SkData::MakeFromMalloc(profile.release(), kICCProfileSize); | 1100 return SkData::MakeFromMalloc(profile.release(), kICCProfileSize); |
1101 } | 1101 } |
OLD | NEW |