Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / gfx / color_profile.h
blob790bfe57fffb941b1aa09d788b81bdf8c2cc0d02
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
3 // found in the LICENSE file.
5 #ifndef UI_GFX_COLOR_PROFILE_H_
6 #define UI_GFX_COLOR_PROFILE_H_
8 #include <vector>
10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/gfx/gfx_export.h"
13 namespace gfx {
15 static const size_t kMinProfileLength = 128;
16 static const size_t kMaxProfileLength = 4 * 1024 * 1024;
18 class GFX_EXPORT ColorProfile {
19 public:
20 // On Windows, this reads a file from disk so it shouldn't be run on the UI
21 // or IO thread.
22 ColorProfile();
23 ~ColorProfile();
25 const std::vector<char>& profile() const { return profile_; }
27 private:
28 std::vector<char> profile_;
30 DISALLOW_COPY_AND_ASSIGN(ColorProfile);
33 inline bool InvalidColorProfileLength(size_t length) {
34 return (length < kMinProfileLength) || (length > kMaxProfileLength);
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.
39 // If the given bounds are empty, or are off-screen, return false meaning there
40 // is no color profile associated with the bounds.
41 GFX_EXPORT bool GetDisplayColorProfile(const gfx::Rect& bounds,
42 std::vector<char>* profile);
43 } // namespace gfx
45 #endif // UI_GFX_COLOR_PROFILE_H_