diff options
author | msarett <msarett@google.com> | 2016-05-18 06:28:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-18 06:28:43 -0700 |
commit | 61a999ca3e2c865a121a6eb378ff85a837b87a44 (patch) | |
tree | a26f61c68ee7b2e8f359482f1280cc41fce0b1f6 /src/core/SkColorSpacePriv.h | |
parent | d1227a7417922ce26252d55815d0d1e98f0eb070 (diff) |
Parse parametric gamma curves
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1972403002
Review-Url: https://codereview.chromium.org/1972403002
Diffstat (limited to 'src/core/SkColorSpacePriv.h')
-rw-r--r-- | src/core/SkColorSpacePriv.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h index 47fab647ff..a6274c7823 100644 --- a/src/core/SkColorSpacePriv.h +++ b/src/core/SkColorSpacePriv.h @@ -12,17 +12,24 @@ struct SkGammaCurve { bool isValue() const { bool result = (0.0f != fValue); SkASSERT(!result || (0 == fTableSize)); + SkASSERT(!result || (0.0f == fG)); return result; } bool isTable() const { bool result = (0 != fTableSize); SkASSERT(!result || (0.0f == fValue)); + SkASSERT(!result || (0.0f == fG)); SkASSERT(!result || fTable); return result; } - bool isParametric() const { return false; } + bool isParametric() const { + bool result = (0.0f != fG); + SkASSERT(!result || (0.0f == fValue)); + SkASSERT(!result || (0 == fTableSize)); + return result; + } // We have three different ways to represent gamma. // (1) A single value: @@ -33,7 +40,15 @@ struct SkGammaCurve { std::unique_ptr<float[]> fTable; // (3) Parameters for a curve: - // FIXME (msarett): Handle parametric curves. + // Y = (aX + b)^g + c for X >= d + // Y = eX + f otherwise + float fG; + float fA; + float fB; + float fC; + float fD; + float fE; + float fF; SkGammaCurve() { memset(this, 0, sizeof(struct SkGammaCurve)); @@ -43,6 +58,13 @@ struct SkGammaCurve { : fValue(value) , fTableSize(0) , fTable(nullptr) + , fG(0.0f) + , fA(0.0f) + , fB(0.0f) + , fC(0.0f) + , fD(0.0f) + , fE(0.0f) + , fF(0.0f) {} }; |