Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: ui/gfx/icc_profile.h

Issue 2161293002: Color: Separate ICCProfile and ColorSpace structures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add parts to resource provider Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_GFX_ICC_PROFILE_H_
6 #define UI_GFX_ICC_PROFILE_H_
7
8 #include <stdint.h>
9 #include <vector>
10
11 #include "ui/gfx/color_space.h"
12
13 #if defined(OS_MACOSX)
14 #include <CoreGraphics/CGColorSpace.h>
15 #endif
16
17 namespace gfx {
18
19 // Used to represent a full ICC profile, usually retrieved from a monitor. It
20 // can be lossily compressed into a ColorSpace object.
21 class GFX_EXPORT ICCProfile {
22 public:
23 ICCProfile();
24 ICCProfile(ICCProfile&& other);
25 ICCProfile(const ICCProfile& other);
26 ICCProfile& operator=(const ICCProfile& other);
27 ~ICCProfile();
28 bool operator==(const ICCProfile& other) const;
29
30 // Returns the color profile of the monitor that can best represent color.
31 // This profile should be used for creating content that does not know on
32 // which monitor it will be displayed.
33 static ICCProfile FromBestMonitor();
34 #if defined(OS_MACOSX)
35 static ICCProfile FromCGColorSpace(CGColorSpaceRef cg_color_space);
36 #endif
37
38 // This will recover a ICCProfile from a compact ColorSpace representation.
39 // Internally, this will make an effort to create an identical ICCProfile
40 // to the one that created |color_space|, but this is not guaranteed.
41 static ICCProfile FromColorSpace(const gfx::ColorSpace& color_space);
42
43 // This will perform a potentially-lossy conversion to a more compact color
44 // space representation.
45 ColorSpace GetColorSpace() const;
46
47 const std::vector<char>& GetData() const;
48
49 #if defined(OS_WIN)
50 // This will read monitor ICC profiles from disk and cache the results for the
51 // other functions to read. This should not be called on the UI or IO thread.
52 static void UpdateCachedProfilesOnBackgroundThread();
53 static bool CachedProfilesNeedUpdate();
54 #endif
55
56 private:
57 static ICCProfile FromData(const std::vector<char>& icc_profile);
58 static bool IsValidProfileLength(size_t length);
59
60 bool valid_ = false;
61 std::vector<char> data_;
62 uint64_t id_ = 0;
hubbe 2016/07/21 22:08:54 id_ sees to be completely unused right now. Either
ccameron 2016/07/22 00:59:17 This is now used in the fleshed-out version.
63
64 friend struct IPC::ParamTraits<gfx::ICCProfile>;
65 };
66
67 } // namespace gfx
68
69 #endif // UI_GFX_ICC_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698