| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 // This will recover a ICCProfile from a compact ColorSpace representation. | 52 // This will recover a ICCProfile from a compact ColorSpace representation. |
| 53 // Internally, this will make an effort to create an identical ICCProfile | 53 // Internally, this will make an effort to create an identical ICCProfile |
| 54 // to the one that created |color_space|, but this is not guaranteed. | 54 // to the one that created |color_space|, but this is not guaranteed. |
| 55 static ICCProfile FromColorSpace(const gfx::ColorSpace& color_space); | 55 static ICCProfile FromColorSpace(const gfx::ColorSpace& color_space); |
| 56 | 56 |
| 57 // Create directly from profile data. | 57 // Create directly from profile data. |
| 58 static ICCProfile FromData(const void* icc_profile, size_t size); | 58 static ICCProfile FromData(const void* icc_profile, size_t size); |
| 59 | 59 |
| 60 // TODO(ccameron): Move this flag to display::Display, like forcing device |
| 61 // scale factor. |
| 62 static bool HasForcedProfile(); |
| 63 static ICCProfile GetForcedProfile(); |
| 64 |
| 60 // Return a ColorSpace that references this ICCProfile. ColorTransforms | 65 // Return a ColorSpace that references this ICCProfile. ColorTransforms |
| 61 // created using this ColorSpace will match this ICCProfile precisely. | 66 // created using this ColorSpace will match this ICCProfile precisely. |
| 62 const ColorSpace& GetColorSpace() const; | 67 const ColorSpace& GetColorSpace() const; |
| 63 | 68 |
| 64 // Return a ColorSpace that is the best parametric approximation of this | 69 // Return a ColorSpace that is the best parametric approximation of this |
| 65 // ICCProfile. The resulting ColorSpace will reference this ICCProfile only | 70 // ICCProfile. The resulting ColorSpace will reference this ICCProfile only |
| 66 // if the parametric approximation is almost exact. | 71 // if the parametric approximation is almost exact. |
| 67 const ColorSpace& GetParametricColorSpace() const; | 72 const ColorSpace& GetParametricColorSpace() const; |
| 68 | 73 |
| 69 const std::vector<char>& GetData() const; | 74 const std::vector<char>& GetData() const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 96 // false if |id| is not in the cache. | 101 // false if |id| is not in the cache. |
| 97 static bool FromId(uint64_t id, ICCProfile* icc_profile); | 102 static bool FromId(uint64_t id, ICCProfile* icc_profile); |
| 98 | 103 |
| 99 // This method is used to hard-code the |id_| to a specific value, and is | 104 // This method is used to hard-code the |id_| to a specific value, and is |
| 100 // used by test methods to ensure that they don't conflict with the values | 105 // used by test methods to ensure that they don't conflict with the values |
| 101 // generated in the browser. | 106 // generated in the browser. |
| 102 static ICCProfile FromDataWithId(const void* icc_profile, | 107 static ICCProfile FromDataWithId(const void* icc_profile, |
| 103 size_t size, | 108 size_t size, |
| 104 uint64_t id); | 109 uint64_t id); |
| 105 | 110 |
| 106 static bool HasForcedProfile(); | |
| 107 static ICCProfile GetForcedProfile(); | |
| 108 | |
| 109 void ComputeColorSpaceAndCache(); | 111 void ComputeColorSpaceAndCache(); |
| 110 | 112 |
| 111 // This globally identifies this ICC profile. It is used to look up this ICC | 113 // This globally identifies this ICC profile. It is used to look up this ICC |
| 112 // profile from a ColorSpace object created from it. The object is invalid if | 114 // profile from a ColorSpace object created from it. The object is invalid if |
| 113 // |id_| is zero. | 115 // |id_| is zero. |
| 114 uint64_t id_ = 0; | 116 uint64_t id_ = 0; |
| 115 std::vector<char> data_; | 117 std::vector<char> data_; |
| 116 | 118 |
| 117 // |color_space| always links back to this ICC profile, and its SkColorSpace | 119 // |color_space| always links back to this ICC profile, and its SkColorSpace |
| 118 // is always equal to the SkColorSpace created from this ICCProfile. | 120 // is always equal to the SkColorSpace created from this ICCProfile. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 129 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 131 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
| 130 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); | 132 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); |
| 131 friend class ColorSpace; | 133 friend class ColorSpace; |
| 132 friend class ColorTransformInternal; | 134 friend class ColorTransformInternal; |
| 133 friend struct IPC::ParamTraits<gfx::ICCProfile>; | 135 friend struct IPC::ParamTraits<gfx::ICCProfile>; |
| 134 }; | 136 }; |
| 135 | 137 |
| 136 } // namespace gfx | 138 } // namespace gfx |
| 137 | 139 |
| 138 #endif // UI_GFX_ICC_PROFILE_H_ | 140 #endif // UI_GFX_ICC_PROFILE_H_ |
| OLD | NEW |