diff options
author | Brian Osman <brianosman@google.com> | 2019-01-16 13:13:36 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2019-01-21 18:12:28 +0000 |
commit | 9c6ee015c352e0172d1707f260e02d3d19739cd4 (patch) | |
tree | 898314af4790189fff8abd6a40bbec855b58ec9c /include | |
parent | 226ba98668f7016c18e1833f435dfc795b30fb38 (diff) | |
download | skqp-9c6ee015c352e0172d1707f260e02d3d19739cd4.tar.gz |
SkColorSpace API cleanup
Previously:
- Gamut could be a 4x4 matrix (overspecified), or an enum.
- Transfer function could be a struct with 7 floats, or one of two
different enums.
- We had 5 of the 6 possible factories covering those [3 x 2] options.
Recently we added a single new factory that takes the skcms 7-float
struct, and the skcms 3x3 matrix. This is the exact, minimal set of
information needed to specify an SkColorSpace.
Major clients have been moved to that factory, so the other five are
being removed. The enums are also being removed, as they are no longer
part of the API. All transfer functions and gamuts covered by the old
enums are available as constexpr values (of the skcms types) in the
header (SkNamedTransferFn and SkNamedGamut).
Bug: skia:
Change-Id: I1fbbacec6997b966dd92000ab67513e7f1a9d023
Reviewed-on: https://skia-review.googlesource.com/c/184067
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkColorSpace.h | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h index 50db2489d0..7b68fadd4e 100644 --- a/include/core/SkColorSpace.h +++ b/include/core/SkColorSpace.h @@ -41,8 +41,6 @@ struct SK_API SkColorSpacePrimaries { * Convert primaries and a white point to a toXYZD50 matrix, the preferred color gamut * representation of SkColorSpace. */ - bool toXYZD50(SkMatrix44* toXYZD50) const; - bool toXYZD50(skcms_Matrix3x3* toXYZD50) const; }; @@ -129,43 +127,18 @@ public: static sk_sp<SkColorSpace> MakeSRGB(); /** - * Colorspace with the sRGB primaries, but a linear (1.0) gamma. Commonly used for - * half-float surfaces, and high precision individual colors (gradient stops, etc...) + * Colorspace with the sRGB primaries, but a linear (1.0) gamma. */ static sk_sp<SkColorSpace> MakeSRGBLinear(); - enum RenderTargetGamma : uint8_t { - kLinear_RenderTargetGamma, - - /** - * Transfer function is the canonical sRGB curve, which has a short linear segment - * followed by a 2.4f exponential. - */ - kSRGB_RenderTargetGamma, - }; - + // DEPRECATED + // Keeping this around until Android stops using it. enum Gamut { kSRGB_Gamut, - kAdobeRGB_Gamut, kDCIP3_D65_Gamut, - kRec2020_Gamut, }; /** - * Create an SkColorSpace from a transfer function and a color gamut. - * - * Transfer function can be specified as an enum or as the coefficients to an equation. - * Gamut can be specified as an enum or as the matrix transformation to XYZ D50. - */ - static sk_sp<SkColorSpace> MakeRGB(RenderTargetGamma gamma, Gamut gamut); - static sk_sp<SkColorSpace> MakeRGB(RenderTargetGamma gamma, const SkMatrix44& toXYZD50); - static sk_sp<SkColorSpace> MakeRGB(const SkColorSpaceTransferFn& coeffs, Gamut gamut); - static sk_sp<SkColorSpace> MakeRGB(const SkColorSpaceTransferFn& coeffs, - const SkMatrix44& toXYZD50); - - static sk_sp<SkColorSpace> MakeRGB(SkGammaNamed gammaNamed, const SkMatrix44& toXYZD50); - - /** * Create an SkColorSpace from a transfer function and a row-major 3x3 transformation to XYZ. */ static sk_sp<SkColorSpace> MakeRGB(const skcms_TransferFunction& transferFn, @@ -287,7 +260,7 @@ private: SkColorSpace(SkGammaNamed gammaNamed, const float transferFn[7], - const SkMatrix44& toXYZ); + const skcms_Matrix3x3& toXYZ); void computeLazyDstFields() const; |