OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_ICC_PROFILE_H_ | 5 #ifndef UI_GFX_ICC_PROFILE_H_ |
6 #define UI_GFX_ICC_PROFILE_H_ | 6 #define UI_GFX_ICC_PROFILE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 private: | 70 private: |
71 friend ICCProfile ICCProfileForTestingAdobeRGB(); | 71 friend ICCProfile ICCProfileForTestingAdobeRGB(); |
72 friend ICCProfile ICCProfileForTestingColorSpin(); | 72 friend ICCProfile ICCProfileForTestingColorSpin(); |
73 friend ICCProfile ICCProfileForTestingGenericRGB(); | 73 friend ICCProfile ICCProfileForTestingGenericRGB(); |
74 friend ICCProfile ICCProfileForTestingSRGB(); | 74 friend ICCProfile ICCProfileForTestingSRGB(); |
75 static const uint64_t test_id_adobe_rgb_; | 75 static const uint64_t test_id_adobe_rgb_; |
76 static const uint64_t test_id_color_spin_; | 76 static const uint64_t test_id_color_spin_; |
77 static const uint64_t test_id_generic_rgb_; | 77 static const uint64_t test_id_generic_rgb_; |
78 static const uint64_t test_id_srgb_; | 78 static const uint64_t test_id_srgb_; |
79 | 79 |
| 80 // Populate |icc_profile| with the ICCProfile corresponding to id |id|. Return |
| 81 // false if |id| is not in the cache. If |only_if_needed| is true, then return |
| 82 // false if |color_space_is_accurate_| is true for this profile (that is, if |
| 83 // the ICCProfile is needed to know the space precisely). |
| 84 static bool FromId(uint64_t id, bool only_if_needed, ICCProfile* icc_profile); |
| 85 |
80 // This method is used to hard-code the |id_| to a specific value, and is | 86 // This method is used to hard-code the |id_| to a specific value, and is |
81 // used by test methods to ensure that they don't conflict with the values | 87 // used by test methods to ensure that they don't conflict with the values |
82 // generated in the browser. | 88 // generated in the browser. |
83 static ICCProfile FromDataWithId(const void* icc_profile, | 89 static ICCProfile FromDataWithId(const void* icc_profile, |
84 size_t size, | 90 size_t size, |
85 uint64_t id); | 91 uint64_t id); |
86 | 92 |
87 static bool IsValidProfileLength(size_t length); | 93 static bool IsValidProfileLength(size_t length); |
88 void ComputeColorSpaceAndCache(); | 94 void ComputeColorSpaceAndCache(); |
89 | 95 |
90 // This globally identifies this ICC profile. It is used to look up this ICC | 96 // This globally identifies this ICC profile. It is used to look up this ICC |
91 // profile from a ColorSpace object created from it. The object is invalid if | 97 // profile from a ColorSpace object created from it. The object is invalid if |
92 // |id_| is zero. | 98 // |id_| is zero. |
93 uint64_t id_ = 0; | 99 uint64_t id_ = 0; |
94 std::vector<char> data_; | 100 std::vector<char> data_; |
95 | 101 |
96 gfx::ColorSpace color_space_; | 102 gfx::ColorSpace color_space_; |
| 103 // True if |color_space_| accurately represents this color space (this is |
| 104 // false e.g, for lookup-based profiles). |
| 105 bool color_space_is_accurate_ = false; |
97 | 106 |
98 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); | 107 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); |
99 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 108 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
100 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); | 109 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); |
101 friend class ColorSpace; | 110 friend class ColorSpace; |
| 111 friend class ColorTransformInternal; |
102 friend struct IPC::ParamTraits<gfx::ICCProfile>; | 112 friend struct IPC::ParamTraits<gfx::ICCProfile>; |
103 }; | 113 }; |
104 | 114 |
105 } // namespace gfx | 115 } // namespace gfx |
106 | 116 |
107 #endif // UI_GFX_ICC_PROFILE_H_ | 117 #endif // UI_GFX_ICC_PROFILE_H_ |
OLD | NEW |