| 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 "SkAtomics.h" | |
| 9 #include "SkColorSpace.h" | 8 #include "SkColorSpace.h" |
| 10 #include "SkColorSpacePriv.h" | 9 #include "SkColorSpacePriv.h" |
| 11 #include "SkOnce.h" | 10 #include "SkOnce.h" |
| 12 | 11 |
| 13 static bool color_space_almost_equal(float a, float b) { | 12 static bool color_space_almost_equal(float a, float b) { |
| 14 return SkTAbs(a - b) < 0.01f; | 13 return SkTAbs(a - b) < 0.01f; |
| 15 } | 14 } |
| 16 | 15 |
| 17 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 16 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
| 18 | 17 |
| 19 static int32_t gUniqueColorSpaceID; | |
| 20 | |
| 21 SkColorSpace::SkColorSpace(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZD50, N
amed named) | 18 SkColorSpace::SkColorSpace(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZD50, N
amed named) |
| 22 : fGammas(gammas) | 19 : fGammas(gammas) |
| 23 , fToXYZD50(toXYZD50) | 20 , fToXYZD50(toXYZD50) |
| 24 , fUniqueID(sk_atomic_inc(&gUniqueColorSpaceID)) | |
| 25 , fNamed(named) | 21 , fNamed(named) |
| 26 {} | 22 {} |
| 27 | 23 |
| 28 SkColorSpace::SkColorSpace(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas, | 24 SkColorSpace::SkColorSpace(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas, |
| 29 const SkMatrix44& toXYZD50) | 25 const SkMatrix44& toXYZD50) |
| 30 : fColorLUT(colorLUT) | 26 : fColorLUT(colorLUT) |
| 31 , fGammas(gammas) | 27 , fGammas(gammas) |
| 32 , fToXYZD50(toXYZD50) | 28 , fToXYZD50(toXYZD50) |
| 33 , fUniqueID(sk_atomic_inc(&gUniqueColorSpaceID)) | |
| 34 , fNamed(kUnknown_Named) | 29 , fNamed(kUnknown_Named) |
| 35 {} | 30 {} |
| 36 | 31 |
| 37 const float gSRGB_toXYZD50[] { | 32 const float gSRGB_toXYZD50[] { |
| 38 0.4358f, 0.2224f, 0.0139f, // * R | 33 0.4358f, 0.2224f, 0.0139f, // * R |
| 39 0.3853f, 0.7170f, 0.0971f, // * G | 34 0.3853f, 0.7170f, 0.0971f, // * G |
| 40 0.1430f, 0.0606f, 0.7139f, // * B | 35 0.1430f, 0.0606f, 0.7139f, // * B |
| 41 }; | 36 }; |
| 42 | 37 |
| 43 const float gAdobeRGB_toXYZD50[] { | 38 const float gAdobeRGB_toXYZD50[] { |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 } | 737 } |
| 743 } | 738 } |
| 744 | 739 |
| 745 } | 740 } |
| 746 default: | 741 default: |
| 747 break; | 742 break; |
| 748 } | 743 } |
| 749 | 744 |
| 750 return_null("ICC profile contains unsupported colorspace"); | 745 return_null("ICC profile contains unsupported colorspace"); |
| 751 } | 746 } |
| OLD | NEW |