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

Unified Diff: ui/gfx/color_space.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 | « no previous file | ui/gfx/color_space.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_space.h
diff --git a/ui/gfx/color_space.h b/ui/gfx/color_space.h
index dc54cb7b5066a3ec7b87f167f869af8b9e22e72f..fbbb78690df39aa52a701190369f4ae979912155 100644
--- a/ui/gfx/color_space.h
+++ b/ui/gfx/color_space.h
@@ -152,6 +152,8 @@ class GFX_EXPORT ColorSpace {
static MatrixID MatrixIDFromInt(int matrix_id);
static ColorSpace CreateSRGB();
+ static ColorSpace CreateCustom(const SkMatrix44& to_XYZD50,
+ const SkColorSpaceTransferFn& fn);
// scRGB is like RGB, but linear and values outside of 0-1 are allowed.
// scRGB is normally used with fp16 textures.
static ColorSpace CreateSCRGBLinear();
@@ -169,23 +171,31 @@ class GFX_EXPORT ColorSpace {
bool IsHDR() const;
// Note that this may return nullptr.
- const sk_sp<SkColorSpace>& ToSkColorSpace() const { return sk_color_space_; }
+ sk_sp<SkColorSpace> ToSkColorSpace() const;
static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space);
+ void GetPrimaryMatrix(SkMatrix44* to_XYZD50) const;
+ bool GetTransferFunction(SkColorSpaceTransferFn* fn) const;
+ bool GetInverseTransferFunction(SkColorSpaceTransferFn* fn) const;
+
private:
PrimaryID primaries_ = PrimaryID::UNSPECIFIED;
TransferID transfer_ = TransferID::UNSPECIFIED;
MatrixID matrix_ = MatrixID::UNSPECIFIED;
RangeID range_ = RangeID::LIMITED;
- // Only used if primaries_ == PrimaryID::CUSTOM
- float custom_primary_matrix_[12];
+ // Only used if primaries_ is PrimaryID::CUSTOM.
+ float custom_primary_matrix_[9] = {0, 0, 0, 0, 0, 0, 0, 0};
+
+ // Only used if transfer_ is TransferID::CUSTOM. This array consists of the A
+ // through G entries of the SkColorSpaceTransferFn structure in alphabetical
+ // order.
+ float custom_transfer_params_[7] = {0, 0, 0, 0, 0, 0, 0};
// This is used to look up the ICCProfile from which this ColorSpace was
// created, if possible.
uint64_t icc_profile_id_ = 0;
-
- sk_sp<SkColorSpace> sk_color_space_;
+ sk_sp<SkColorSpace> icc_profile_sk_color_space_;
friend class ICCProfile;
friend class ColorSpaceToColorSpaceTransform;
« no previous file with comments | « no previous file | ui/gfx/color_space.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698