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

Unified Diff: src/core/SkColorSpacePriv.h

Issue 1972403002: Parse parametric gamma curves (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 7 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 | « src/core/SkColorSpace.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpacePriv.h
diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h
index 47fab647ff19ac5b13564cc0e7b8735a043f6cd0..a6274c7823ad4438ef996e338dc89e6b522282b5 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;
scroggo 2016/05/18 12:49:15 Why does G come first?
msarett 2016/05/18 13:14:01 In my mind it makes sense because g is the "most i
+ 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)
{}
};
« no previous file with comments | « src/core/SkColorSpace.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698