OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COLOR_PROFILE_H_ | 5 #ifndef UI_GFX_COLOR_SPACE_H_ |
6 #define UI_GFX_COLOR_PROFILE_H_ | 6 #define UI_GFX_COLOR_SPACE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "ui/gfx/gfx_export.h" | 12 #include "ui/gfx/gfx_export.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 | 15 |
16 class GFX_EXPORT ColorProfile { | 16 class GFX_EXPORT ColorSpace { |
17 public: | 17 public: |
18 ColorProfile(const std::vector<char>& profile); | 18 ColorSpace(); |
19 ColorProfile(); | 19 ColorSpace(ColorSpace&& other); |
20 ColorProfile(ColorProfile&& other); | 20 ColorSpace(const ColorSpace& other); |
21 ColorProfile(const ColorProfile& other); | 21 ColorSpace& operator=(const ColorSpace& other); |
22 ColorProfile& operator=(const ColorProfile& other); | 22 ~ColorSpace(); |
23 ~ColorProfile(); | 23 bool operator==(const ColorSpace& other) const; |
24 | 24 |
25 const std::vector<char>& profile() const { return profile_; } | 25 // Returns the color profile of the monitor that can best represent color. |
| 26 // This profile should be used for creating content that does not know on |
| 27 // which monitor it will be displayed. |
| 28 static ColorSpace FromBestMonitor(); |
| 29 static ColorSpace FromICCProfile(const std::vector<char>& icc_profile); |
| 30 |
| 31 const std::vector<char>& GetICCProfile() const { return icc_profile_; } |
26 | 32 |
27 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
28 // This will read color profile information from disk and cache the results | 34 // This will read monitor ICC profiles from disk and cache the results for the |
29 // for the other functions to read. This should not be called on the UI or IO | 35 // other functions to read. This should not be called on the UI or IO thread. |
30 // thread. | |
31 static void UpdateCachedProfilesOnBackgroundThread(); | 36 static void UpdateCachedProfilesOnBackgroundThread(); |
32 static bool CachedProfilesNeedUpdate(); | 37 static bool CachedProfilesNeedUpdate(); |
33 #endif | 38 #endif |
34 | 39 |
35 // Returns the color profile of the monitor that can best represent color. | |
36 // This profile should be used for creating content that does not know on | |
37 // which monitor it will be displayed. | |
38 static ColorProfile GetFromBestMonitor(); | |
39 | |
40 static bool IsValidProfileLength(size_t length); | 40 static bool IsValidProfileLength(size_t length); |
41 | 41 |
42 private: | 42 private: |
43 std::vector<char> profile_; | 43 std::vector<char> icc_profile_; |
44 }; | 44 }; |
45 | 45 |
46 } // namespace gfx | 46 } // namespace gfx |
47 | 47 |
48 #endif // UI_GFX_COLOR_PROFILE_H_ | 48 #endif // UI_GFX_COLOR_SPACE_H_ |
OLD | NEW |