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

Unified Diff: ui/gfx/icc_profile.h

Issue 2652503002: Use SkICC in gfx::ICCProfile and gfx::ColorSpace (Closed)
Patch Set: Rebase Created 3 years, 11 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/icc_profile.h
diff --git a/ui/gfx/icc_profile.h b/ui/gfx/icc_profile.h
index e719c16f1718a10cf3806b5df40d9b170f26aaab..c6170c61aadde79e2ded3c55afc767cfaa16c680 100644
--- a/ui/gfx/icc_profile.h
+++ b/ui/gfx/icc_profile.h
@@ -23,10 +23,6 @@ template <typename, typename> struct StructTraits;
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
// only be sent from higher-privilege processes to lower-privilege processes,
@@ -54,14 +50,13 @@ class GFX_EXPORT ICCProfile {
// 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 char* icc_profile, size_t size);
+ static ICCProfile FromData(const void* icc_profile, size_t size);
// This will perform a potentially-lossy conversion to a more compact color
// space representation.
- ColorSpace GetColorSpace() const;
+ const ColorSpace& GetColorSpace() const;
const std::vector<char>& GetData() const;
@@ -72,36 +67,25 @@ class GFX_EXPORT ICCProfile {
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);
-
- Type type_ = Type::INVALID;
- gfx::ColorSpace color_space_;
- std::vector<char> data_;
+ void ComputeColorSpaceAndCache();
// This globally identifies this ICC profile. It is used to look up this ICC
- // profile from a ColorSpace object created from it.
+ // profile from a ColorSpace object created from it. The object is invalid if
+ // |id_| is zero.
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
« 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