| 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 |
| 11 #include "base/gtest_prod_util.h" |
| 11 #include "ui/gfx/color_space.h" | 12 #include "ui/gfx/color_space.h" |
| 12 | 13 |
| 13 #if defined(OS_MACOSX) | 14 #if defined(OS_MACOSX) |
| 14 #include <CoreGraphics/CGColorSpace.h> | 15 #include <CoreGraphics/CGColorSpace.h> |
| 15 #endif | 16 #endif |
| 16 | 17 |
| 17 namespace gfx { | 18 namespace gfx { |
| 18 | 19 |
| 19 // Used to represent a full ICC profile, usually retrieved from a monitor. It | 20 // Used to represent a full ICC profile, usually retrieved from a monitor. It |
| 20 // can be lossily compressed into a ColorSpace object. This structure should | 21 // can be lossily compressed into a ColorSpace object. This structure should |
| (...skipping 29 matching lines...) Expand all Loading... |
| 50 const std::vector<char>& GetData() const; | 51 const std::vector<char>& GetData() const; |
| 51 | 52 |
| 52 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 53 // This will read monitor ICC profiles from disk and cache the results for the | 54 // This will read monitor ICC profiles from disk and cache the results for the |
| 54 // other functions to read. This should not be called on the UI or IO thread. | 55 // other functions to read. This should not be called on the UI or IO thread. |
| 55 static void UpdateCachedProfilesOnBackgroundThread(); | 56 static void UpdateCachedProfilesOnBackgroundThread(); |
| 56 static bool CachedProfilesNeedUpdate(); | 57 static bool CachedProfilesNeedUpdate(); |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 static ICCProfile FromData(const std::vector<char>& icc_profile); | 61 static ICCProfile FromData(const char* icc_profile, size_t size); |
| 61 static bool IsValidProfileLength(size_t length); | 62 static bool IsValidProfileLength(size_t length); |
| 62 | 63 |
| 63 bool valid_ = false; | 64 bool valid_ = false; |
| 64 std::vector<char> data_; | 65 std::vector<char> data_; |
| 65 | 66 |
| 66 // This globally identifies this ICC profile. It is used to look up this ICC | 67 // This globally identifies this ICC profile. It is used to look up this ICC |
| 67 // profile from a ColorSpace object created from it. | 68 // profile from a ColorSpace object created from it. |
| 68 uint64_t id_ = 0; | 69 uint64_t id_ = 0; |
| 69 | 70 |
| 71 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); |
| 70 friend class ColorSpace; | 72 friend class ColorSpace; |
| 71 friend struct IPC::ParamTraits<gfx::ICCProfile>; | 73 friend struct IPC::ParamTraits<gfx::ICCProfile>; |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 } // namespace gfx | 76 } // namespace gfx |
| 75 | 77 |
| 76 #endif // UI_GFX_ICC_PROFILE_H_ | 78 #endif // UI_GFX_ICC_PROFILE_H_ |
| OLD | NEW |