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

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

Issue 2691213007: color: Don't use QCMS for transforms unless necessary (Closed)
Patch Set: Incorporate review feedback Created 3 years, 10 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
« no previous file with comments | « ui/gfx/color_transform_unittest.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 20 matching lines...) Expand all
31 public: 31 public:
32 ICCProfile(); 32 ICCProfile();
33 ICCProfile(ICCProfile&& other); 33 ICCProfile(ICCProfile&& other);
34 ICCProfile(const ICCProfile& other); 34 ICCProfile(const ICCProfile& other);
35 ICCProfile& operator=(ICCProfile&& other); 35 ICCProfile& operator=(ICCProfile&& other);
36 ICCProfile& operator=(const ICCProfile& other); 36 ICCProfile& operator=(const ICCProfile& other);
37 ~ICCProfile(); 37 ~ICCProfile();
38 bool operator==(const ICCProfile& other) const; 38 bool operator==(const ICCProfile& other) const;
39 bool operator!=(const ICCProfile& other) const; 39 bool operator!=(const ICCProfile& other) const;
40 40
41 // Returns true if this profile was successfully parsed by SkICC.
42 bool IsValid() const;
43
41 // Returns the color profile of the monitor that can best represent color. 44 // Returns the color profile of the monitor that can best represent color.
42 // This profile should be used for creating content that does not know on 45 // This profile should be used for creating content that does not know on
43 // which monitor it will be displayed. 46 // which monitor it will be displayed.
44 static ICCProfile FromBestMonitor(); 47 static ICCProfile FromBestMonitor();
45 #if defined(OS_MACOSX) 48 #if defined(OS_MACOSX)
46 static ICCProfile FromCGColorSpace(CGColorSpaceRef cg_color_space); 49 static ICCProfile FromCGColorSpace(CGColorSpaceRef cg_color_space);
47 #endif 50 #endif
48 51
49 // This will recover a ICCProfile from a compact ColorSpace representation. 52 // This will recover a ICCProfile from a compact ColorSpace representation.
50 // Internally, this will make an effort to create an identical ICCProfile 53 // Internally, this will make an effort to create an identical ICCProfile
(...skipping 19 matching lines...) Expand all
70 private: 73 private:
71 friend ICCProfile ICCProfileForTestingAdobeRGB(); 74 friend ICCProfile ICCProfileForTestingAdobeRGB();
72 friend ICCProfile ICCProfileForTestingColorSpin(); 75 friend ICCProfile ICCProfileForTestingColorSpin();
73 friend ICCProfile ICCProfileForTestingGenericRGB(); 76 friend ICCProfile ICCProfileForTestingGenericRGB();
74 friend ICCProfile ICCProfileForTestingSRGB(); 77 friend ICCProfile ICCProfileForTestingSRGB();
75 static const uint64_t test_id_adobe_rgb_; 78 static const uint64_t test_id_adobe_rgb_;
76 static const uint64_t test_id_color_spin_; 79 static const uint64_t test_id_color_spin_;
77 static const uint64_t test_id_generic_rgb_; 80 static const uint64_t test_id_generic_rgb_;
78 static const uint64_t test_id_srgb_; 81 static const uint64_t test_id_srgb_;
79 82
83 // Populate |icc_profile| with the ICCProfile corresponding to id |id|. Return
84 // false if |id| is not in the cache. If |only_if_needed| is true, then return
85 // false if |color_space_is_accurate_| is true for this profile (that is, if
86 // the ICCProfile is needed to know the space precisely).
87 static bool FromId(uint64_t id, bool only_if_needed, ICCProfile* icc_profile);
88
80 // This method is used to hard-code the |id_| to a specific value, and is 89 // This method is used to hard-code the |id_| to a specific value, and is
81 // used by test methods to ensure that they don't conflict with the values 90 // used by test methods to ensure that they don't conflict with the values
82 // generated in the browser. 91 // generated in the browser.
83 static ICCProfile FromDataWithId(const void* icc_profile, 92 static ICCProfile FromDataWithId(const void* icc_profile,
84 size_t size, 93 size_t size,
85 uint64_t id); 94 uint64_t id);
86 95
87 static bool IsValidProfileLength(size_t length); 96 static bool IsValidProfileLength(size_t length);
88 void ComputeColorSpaceAndCache(); 97 void ComputeColorSpaceAndCache();
89 98
90 // This globally identifies this ICC profile. It is used to look up this ICC 99 // This globally identifies this ICC profile. It is used to look up this ICC
91 // profile from a ColorSpace object created from it. The object is invalid if 100 // profile from a ColorSpace object created from it. The object is invalid if
92 // |id_| is zero. 101 // |id_| is zero.
93 uint64_t id_ = 0; 102 uint64_t id_ = 0;
94 std::vector<char> data_; 103 std::vector<char> data_;
95 104
96 gfx::ColorSpace color_space_; 105 gfx::ColorSpace color_space_;
97 106
107 // True if |color_space_| accurately represents this color space (this is
108 // false e.g, for lookup-based profiles).
109 bool color_space_is_accurate_ = false;
110
111 // This is set to true if SkICC successfully parsed this profile.
112 bool successfully_parsed_by_sk_icc_ = false;
113
98 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); 114 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC);
99 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); 115 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace);
100 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); 116 friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t);
101 friend class ColorSpace; 117 friend class ColorSpace;
118 friend class ColorTransformInternal;
102 friend struct IPC::ParamTraits<gfx::ICCProfile>; 119 friend struct IPC::ParamTraits<gfx::ICCProfile>;
103 }; 120 };
104 121
105 } // namespace gfx 122 } // namespace gfx
106 123
107 #endif // UI_GFX_ICC_PROFILE_H_ 124 #endif // UI_GFX_ICC_PROFILE_H_
OLDNEW
« no previous file with comments | « ui/gfx/color_transform_unittest.cc ('k') | ui/gfx/icc_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698