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

Unified Diff: ui/gfx/color_space.h

Issue 2183953002: Add some actual data to gfx::ColorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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') | ui/gfx/icc_profile.h » ('J')
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 4e166e17f404f184f7dcb1ba38f1f98e32a67cd7..c7703c28ec306762fe19ecc440eafc11b3b17665 100644
--- a/ui/gfx/color_space.h
+++ b/ui/gfx/color_space.h
@@ -25,7 +25,85 @@ class ICCProfile;
// between any processes.
class GFX_EXPORT ColorSpace {
public:
+ enum PrimaryID : int16_t {
ccameron 2016/07/27 17:10:30 nit: Please change this to enum class Primary {
hubbe 2016/07/27 17:44:04 Done. Although I'm still calling it PrimaryID, as
+ // The first 0-255 values should match the H264 specification.
+ PRI_RESERVED0 = 0,
+ PRI_BT709 = 1,
+ PRI_UNSPECIFIED = 2,
+ PRI_RESERVED = 3,
+ PRI_BT470M = 4,
+ PRI_BT470BG = 5,
+ PRI_SMPTE170M = 6,
+ PRI_SMPTE240M = 7,
+ PRI_FILM = 8,
+ PRI_BT2020 = 9,
+ PRI_SMPTEST428_1 = 10,
+ PRI_SMPTEST431_2 = 11,
+ PRI_SMPTEST432_1 = 12,
+
+ // Chrome-specific values start at 1000.
+ PRI_XYZ_D50 = 1000,
+ // TODO(hubbe): We need to store the primaries.
+ PRI_CUSTOM = 1001,
+ PRI_LAST = PRI_XYZ_D50
+ };
+
+ enum TransferID : uint16_t {
ccameron 2016/07/27 17:10:30 (same thing, "enum class TransferFunction", and no
hubbe 2016/07/27 17:44:04 Done, but still calling it TransferID
+ // The first 0-255 values should match the H264 specification.
+ TRC_RESERVED0 = 0,
+ TRC_BT709 = 1,
+ TRC_UNSPECIFIED = 2,
+ TRC_RESERVED = 3,
+ TRC_GAMMA22 = 4,
+ TRC_GAMMA28 = 5,
+ TRC_SMPTE170M = 6,
+ TRC_SMPTE240M = 7,
+ TRC_LINEAR = 8,
+ TRC_LOG = 9,
+ TRC_LOG_SQRT = 10,
+ TRC_IEC61966_2_4 = 11,
+ TRC_BT1361_ECG = 12,
+ TRC_IEC61966_2_1 = 13,
+ TRC_BT2020_10 = 14,
+ TRC_BT2020_12 = 15,
+ TRC_SMPTEST2084 = 16,
+ TRC_SMPTEST428_1 = 17,
+
+ // Chrome-specific values start at 1000.
+ TRC_GAMMA24 = 1000,
+
+ // TODO(hubbe): Need to store an approximation of the gamma function(s).
+ TRC_CUSTOM = 1001,
+ TRC_LAST = TRC_GAMMA24,
+ };
+
+ enum MatrixID : int16_t {
+ // The first 0-255 values should match the H264 specification.
ccameron 2016/07/27 17:10:29 (& again)
hubbe 2016/07/27 17:44:04 Done.
+ SPC_RGB = 0,
+ SPC_BT709 = 1,
+ SPC_UNSPECIFIED = 2,
+ SPC_RESERVED = 3,
+ SPC_FCC = 4,
+ SPC_BT470BG = 5,
+ SPC_SMPTE170M = 6,
+ SPC_SMPTE240M = 7,
+ SPC_YCOCG = 8,
+ SPC_BT2020_NCL = 9,
+ SPC_BT2020_CL = 10,
+ SPC_YDZDX = 11,
+
+ // Chrome-specific values start at 1000
+ SPC_LAST = SPC_BT2020_CL
+ };
+
ColorSpace();
+ ColorSpace(PrimaryID primaries,
+ TransferID transfer,
+ MatrixID matrix,
+ bool full_range);
+
+ bool isValid() const;
ccameron 2016/07/27 17:10:30 Remove isValid cause it has no callers now (with t
hubbe 2016/07/27 17:44:04 Done.
+
static ColorSpace CreateSRGB();
// TODO: Remove these, and replace with more generic constructors.
@@ -36,7 +114,14 @@ class GFX_EXPORT ColorSpace {
bool operator==(const ColorSpace& other) const;
private:
- bool valid_ = false;
+ PrimaryID primaries_;
+ TransferID transfer_;
+ MatrixID matrix_;
+
+ // TODO(hubbe): Range might be different depending on bit depth, if so,
ccameron 2016/07/27 17:10:30 I'd go for putting this in an enum from the get-go
hubbe 2016/07/27 17:44:04 Done.
+ // convert this to an enum.
+ bool full_range_;
+
// This is used to look up the ICCProfile from which this ColorSpace was
// created, if possible.
uint64_t icc_profile_id_ = 0;
« no previous file with comments | « no previous file | ui/gfx/color_space.cc » ('j') | ui/gfx/icc_profile.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698