| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const std::vector<char>& GetData() const; | 61 const std::vector<char>& GetData() const; |
| 62 | 62 |
| 63 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
| 64 // This will read monitor ICC profiles from disk and cache the results for the | 64 // This will read monitor ICC profiles from disk and cache the results for the |
| 65 // other functions to read. This should not be called on the UI or IO thread. | 65 // other functions to read. This should not be called on the UI or IO thread. |
| 66 static void UpdateCachedProfilesOnBackgroundThread(); | 66 static void UpdateCachedProfilesOnBackgroundThread(); |
| 67 static bool CachedProfilesNeedUpdate(); | 67 static bool CachedProfilesNeedUpdate(); |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 friend ICCProfile ICCProfileForTestingAdobeRGB(); |
| 72 friend ICCProfile ICCProfileForTestingColorSpin(); |
| 73 friend ICCProfile ICCProfileForTestingGenericRGB(); |
| 74 friend ICCProfile ICCProfileForTestingSRGB(); |
| 75 static const uint64_t test_id_adobe_rgb_; |
| 76 static const uint64_t test_id_color_spin_; |
| 77 static const uint64_t test_id_generic_rgb_; |
| 78 static const uint64_t test_id_srgb_; |
| 79 |
| 80 // 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 |
| 82 // generated in the browser. |
| 83 static ICCProfile FromDataWithId(const void* icc_profile, |
| 84 size_t size, |
| 85 uint64_t id); |
| 86 |
| 71 // TODO(ccameron): Remove this function once its callerrs are gone. | 87 // TODO(ccameron): Remove this function once its callerrs are gone. |
| 72 static ICCProfile FromSkColorSpace(sk_sp<SkColorSpace> color_space); | 88 static ICCProfile FromSkColorSpace(sk_sp<SkColorSpace> color_space); |
| 73 static bool IsValidProfileLength(size_t length); | 89 static bool IsValidProfileLength(size_t length); |
| 74 void ComputeColorSpaceAndCache(); | 90 void ComputeColorSpaceAndCache(); |
| 75 | 91 |
| 76 // This globally identifies this ICC profile. It is used to look up this ICC | 92 // This globally identifies this ICC profile. It is used to look up this ICC |
| 77 // profile from a ColorSpace object created from it. The object is invalid if | 93 // profile from a ColorSpace object created from it. The object is invalid if |
| 78 // |id_| is zero. | 94 // |id_| is zero. |
| 79 uint64_t id_ = 0; | 95 uint64_t id_ = 0; |
| 80 std::vector<char> data_; | 96 std::vector<char> data_; |
| 81 | 97 |
| 82 gfx::ColorSpace color_space_; | 98 gfx::ColorSpace color_space_; |
| 83 | 99 |
| 84 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); | 100 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); |
| 85 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); | 101 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
| 86 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); | 102 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); |
| 87 friend class ColorSpace; | 103 friend class ColorSpace; |
| 88 friend struct IPC::ParamTraits<gfx::ICCProfile>; | 104 friend struct IPC::ParamTraits<gfx::ICCProfile>; |
| 89 }; | 105 }; |
| 90 | 106 |
| 91 } // namespace gfx | 107 } // namespace gfx |
| 92 | 108 |
| 93 #endif // UI_GFX_ICC_PROFILE_H_ | 109 #endif // UI_GFX_ICC_PROFILE_H_ |
| OLD | NEW |