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_SPACE_H_ | 5 #ifndef UI_GFX_COLOR_SPACE_H_ |
6 #define UI_GFX_COLOR_SPACE_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 #if defined(OS_MACOSX) |
| 15 #include <CoreGraphics/CGColorSpace.h> |
| 16 #endif |
| 17 |
14 namespace gfx { | 18 namespace gfx { |
15 | 19 |
16 class GFX_EXPORT ColorSpace { | 20 class GFX_EXPORT ColorSpace { |
17 public: | 21 public: |
18 ColorSpace(); | 22 ColorSpace(); |
19 ColorSpace(ColorSpace&& other); | 23 ColorSpace(ColorSpace&& other); |
20 ColorSpace(const ColorSpace& other); | 24 ColorSpace(const ColorSpace& other); |
21 ColorSpace& operator=(const ColorSpace& other); | 25 ColorSpace& operator=(const ColorSpace& other); |
22 ~ColorSpace(); | 26 ~ColorSpace(); |
23 bool operator==(const ColorSpace& other) const; | 27 bool operator==(const ColorSpace& other) const; |
24 | 28 |
25 // Returns the color profile of the monitor that can best represent color. | 29 // 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 | 30 // This profile should be used for creating content that does not know on |
27 // which monitor it will be displayed. | 31 // which monitor it will be displayed. |
28 static ColorSpace FromBestMonitor(); | 32 static ColorSpace FromBestMonitor(); |
29 static ColorSpace FromICCProfile(const std::vector<char>& icc_profile); | 33 static ColorSpace FromICCProfile(const std::vector<char>& icc_profile); |
| 34 #if defined(OS_MACOSX) |
| 35 static ColorSpace FromCGColorSpace(CGColorSpaceRef cg_color_space); |
| 36 #endif |
30 | 37 |
31 const std::vector<char>& GetICCProfile() const { return icc_profile_; } | 38 const std::vector<char>& GetICCProfile() const { return icc_profile_; } |
32 | 39 |
33 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
34 // This will read monitor ICC profiles from disk and cache the results for the | 41 // This will read monitor ICC profiles from disk and cache the results for the |
35 // other functions to read. This should not be called on the UI or IO thread. | 42 // other functions to read. This should not be called on the UI or IO thread. |
36 static void UpdateCachedProfilesOnBackgroundThread(); | 43 static void UpdateCachedProfilesOnBackgroundThread(); |
37 static bool CachedProfilesNeedUpdate(); | 44 static bool CachedProfilesNeedUpdate(); |
38 #endif | 45 #endif |
39 | 46 |
40 static bool IsValidProfileLength(size_t length); | 47 static bool IsValidProfileLength(size_t length); |
41 | 48 |
42 private: | 49 private: |
43 std::vector<char> icc_profile_; | 50 std::vector<char> icc_profile_; |
44 }; | 51 }; |
45 | 52 |
46 } // namespace gfx | 53 } // namespace gfx |
47 | 54 |
48 #endif // UI_GFX_COLOR_SPACE_H_ | 55 #endif // UI_GFX_COLOR_SPACE_H_ |
OLD | NEW |