Index: ui/gfx/icc_profile.h |
diff --git a/ui/gfx/icc_profile.h b/ui/gfx/icc_profile.h |
index c6170c61aadde79e2ded3c55afc767cfaa16c680..e719c16f1718a10cf3806b5df40d9b170f26aaab 100644 |
--- a/ui/gfx/icc_profile.h |
+++ b/ui/gfx/icc_profile.h |
@@ -22,6 +22,10 @@ |
} |
namespace gfx { |
+ |
+namespace mojom { |
+class ICCProfileDataView; |
+} |
// Used to represent a full ICC profile, usually retrieved from a monitor. It |
// can be lossily compressed into a ColorSpace object. This structure should |
@@ -50,13 +54,14 @@ |
// Internally, this will make an effort to create an identical ICCProfile |
// to the one that created |color_space|, but this is not guaranteed. |
static ICCProfile FromColorSpace(const gfx::ColorSpace& color_space); |
+ static ICCProfile FromSkColorSpace(sk_sp<SkColorSpace> color_space); |
// Create directly from profile data. |
- static ICCProfile FromData(const void* icc_profile, size_t size); |
+ static ICCProfile FromData(const char* icc_profile, size_t size); |
// This will perform a potentially-lossy conversion to a more compact color |
// space representation. |
- const ColorSpace& GetColorSpace() const; |
+ ColorSpace GetColorSpace() const; |
const std::vector<char>& GetData() const; |
@@ -67,25 +72,36 @@ |
static bool CachedProfilesNeedUpdate(); |
#endif |
+ enum class Type { |
+ // This is not a valid profile. |
+ INVALID, |
+ // This is from a gfx::ColorSpace. This ensures that GetColorSpace returns |
+ // the exact same object as was used to create this. |
+ FROM_COLOR_SPACE, |
+ // This was created from ICC profile data. |
+ FROM_DATA, |
+ LAST = FROM_DATA |
+ }; |
+ |
private: |
- // TODO(ccameron): Remove this function once its callerrs are gone. |
- static ICCProfile FromSkColorSpace(sk_sp<SkColorSpace> color_space); |
static bool IsValidProfileLength(size_t length); |
- void ComputeColorSpaceAndCache(); |
+ |
+ Type type_ = Type::INVALID; |
+ gfx::ColorSpace color_space_; |
+ std::vector<char> data_; |
// This globally identifies this ICC profile. It is used to look up this ICC |
- // profile from a ColorSpace object created from it. The object is invalid if |
- // |id_| is zero. |
+ // profile from a ColorSpace object created from it. |
uint64_t id_ = 0; |
- std::vector<char> data_; |
- |
- gfx::ColorSpace color_space_; |
FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, BT709toSRGBICC); |
FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); |
friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t); |
friend class ColorSpace; |
friend struct IPC::ParamTraits<gfx::ICCProfile>; |
+ friend struct IPC::ParamTraits<gfx::ICCProfile::Type>; |
+ friend struct mojo::StructTraits<gfx::mojom::ICCProfileDataView, |
+ gfx::ICCProfile>; |
}; |
} // namespace gfx |