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_PROFILE_H_ |
6 #define UI_GFX_COLOR_PROFILE_H_ | 6 #define UI_GFX_COLOR_PROFILE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
11 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 static const size_t kMinProfileLength = 128; | 15 static const size_t kMinProfileLength = 128; |
16 static const size_t kMaxProfileLength = 4 * 1024 * 1024; | 16 static const size_t kMaxProfileLength = 4 * 1024 * 1024; |
17 | 17 |
18 class GFX_EXPORT ColorProfile { | 18 class GFX_EXPORT ColorProfile { |
19 public: | 19 public: |
20 // On Windows, this reads a file from disk so it shouldn't be run on the UI | 20 // On Windows, this reads a file from disk so it should not be run on the UI |
21 // or IO thread. | 21 // or IO thread. |
22 ColorProfile(); | 22 ColorProfile(); |
23 ~ColorProfile(); | 23 ~ColorProfile(); |
24 | 24 |
25 const std::vector<char>& profile() const { return profile_; } | 25 const std::vector<char>& profile() const { return profile_; } |
26 | 26 |
27 private: | 27 private: |
28 std::vector<char> profile_; | 28 std::vector<char> profile_; |
29 | 29 |
30 DISALLOW_COPY_AND_ASSIGN(ColorProfile); | 30 DISALLOW_COPY_AND_ASSIGN(ColorProfile); |
31 }; | 31 }; |
32 | 32 |
33 inline bool InvalidColorProfileLength(size_t length) { | 33 inline bool InvalidColorProfileLength(size_t length) { |
34 return (length < kMinProfileLength) || (length > kMaxProfileLength); | 34 return (length < kMinProfileLength) || (length > kMaxProfileLength); |
35 } | 35 } |
36 | 36 |
37 // Return the color profile of the display nearest the screen bounds. On Win32, | 37 // Return the color profile of the display nearest the screen bounds. On Win32, |
38 // this may read a file from disk, so it shouldn't be run on the UI/IO threads. | 38 // this may read a file from disk so it should not be run on the UI/IO threads. |
39 // If the given bounds are empty, or are off-screen, return false meaning there | 39 // If the given bounds are empty, or are off-screen, return false meaning there |
40 // is no color profile associated with the bounds. | 40 // is no color profile associated with the bounds. Otherwise return true after |
| 41 // storing the display's color profile in |profile|, which will be empty if the |
| 42 // standard sRGB color profile should be assumed. |
41 GFX_EXPORT bool GetDisplayColorProfile(const gfx::Rect& bounds, | 43 GFX_EXPORT bool GetDisplayColorProfile(const gfx::Rect& bounds, |
42 std::vector<char>* profile); | 44 std::vector<char>* profile); |
43 } // namespace gfx | 45 } // namespace gfx |
44 | 46 |
45 #endif // UI_GFX_COLOR_PROFILE_H_ | 47 #endif // UI_GFX_COLOR_PROFILE_H_ |
OLD | NEW |