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

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

Issue 2502703002: Add more robust gfx::ColorSpace<->gfx::ICCProfile conversion (Closed)
Patch Set: Clean up includes Created 4 years, 1 month 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
« no previous file with comments | « ui/gfx/color_space.cc ('k') | ui/gfx/icc_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_ICC_PROFILE_H_ 5 #ifndef UI_GFX_ICC_PROFILE_H_
6 #define UI_GFX_ICC_PROFILE_H_ 6 #define UI_GFX_ICC_PROFILE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 const std::vector<char>& GetData() const; 64 const std::vector<char>& GetData() const;
65 65
66 #if defined(OS_WIN) 66 #if defined(OS_WIN)
67 // This will read monitor ICC profiles from disk and cache the results for the 67 // This will read monitor ICC profiles from disk and cache the results for the
68 // other functions to read. This should not be called on the UI or IO thread. 68 // other functions to read. This should not be called on the UI or IO thread.
69 static void UpdateCachedProfilesOnBackgroundThread(); 69 static void UpdateCachedProfilesOnBackgroundThread();
70 static bool CachedProfilesNeedUpdate(); 70 static bool CachedProfilesNeedUpdate();
71 #endif 71 #endif
72 72
73 enum class Type {
74 // This is not a valid profile.
75 INVALID,
76 // This is from a gfx::ColorSpace. This ensures that GetColorSpace returns
77 // the exact same object as was used to create this.
78 FROM_COLOR_SPACE,
79 // This was created from ICC profile data.
80 FROM_DATA,
81 LAST = FROM_DATA
82 };
83
73 private: 84 private:
74 static bool IsValidProfileLength(size_t length); 85 static bool IsValidProfileLength(size_t length);
75 86
76 bool valid_ = false; 87 Type type_ = Type::INVALID;
88 gfx::ColorSpace color_space_;
77 std::vector<char> data_; 89 std::vector<char> data_;
78 90
79 // This globally identifies this ICC profile. It is used to look up this ICC 91 // This globally identifies this ICC profile. It is used to look up this ICC
80 // profile from a ColorSpace object created from it. 92 // profile from a ColorSpace object created from it.
81 uint64_t id_ = 0; 93 uint64_t id_ = 0;
82 94
83 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); 95 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC);
84 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); 96 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace);
85 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); 97 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t);
86 friend class ColorSpace; 98 friend class ColorSpace;
87 friend struct IPC::ParamTraits<gfx::ICCProfile>; 99 friend struct IPC::ParamTraits<gfx::ICCProfile>;
100 friend struct IPC::ParamTraits<gfx::ICCProfile::Type>;
88 friend struct mojo::StructTraits<gfx::mojom::ICCProfileDataView, 101 friend struct mojo::StructTraits<gfx::mojom::ICCProfileDataView,
89 gfx::ICCProfile>; 102 gfx::ICCProfile>;
90 }; 103 };
91 104
92 } // namespace gfx 105 } // namespace gfx
93 106
94 #endif // UI_GFX_ICC_PROFILE_H_ 107 #endif // UI_GFX_ICC_PROFILE_H_
OLDNEW
« no previous file with comments | « ui/gfx/color_space.cc ('k') | ui/gfx/icc_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698