diff options
author | Brian Osman <brianosman@google.com> | 2017-12-22 16:22:21 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-27 14:41:25 +0000 |
commit | 68c8156cdfd115beec575bcd14365a330da28859 (patch) | |
tree | c399ab29e4f303f85a60d59c7d21ebff9d375256 /src | |
parent | 7557bbbe19b0d56484fe039171e4d97b75f209b3 (diff) |
Remove usage of SkGammas in SkColorSpace serialization
Bug: skia:7419
Change-Id: I613d9d19eaa05402aadff12d022a4471605d7ec0
Reviewed-on: https://skia-review.googlesource.com/89183
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkColorSpace.cpp | 26 | ||||
-rw-r--r-- | src/core/SkColorSpace_Base.h | 5 |
2 files changed, 10 insertions, 21 deletions
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp index a1859fb2a5..6dc9be6a8f 100644 --- a/src/core/SkColorSpace.cpp +++ b/src/core/SkColorSpace.cpp @@ -337,8 +337,7 @@ size_t SkColorSpace::writeToMemory(void* memory) const { // we must have a profile that we can serialize easily. if (!this->onProfileData()) { // Profile data is mandatory for A2B0 color spaces. - SkASSERT(SkColorSpace_Base::Type::kXYZ == as_CSB(this)->type()); - const SkColorSpace_XYZ* thisXYZ = static_cast<const SkColorSpace_XYZ*>(this); + SkASSERT(SkColorSpace_Base::Type::kA2B != as_CSB(this)->type()); // If we have a named profile, only write the enum. const SkGammaNamed gammaNamed = this->gammaNamed(); if (this == srgb()) { @@ -370,13 +369,8 @@ size_t SkColorSpace::writeToMemory(void* memory) const { return sizeof(ColorSpaceHeader) + 12 * sizeof(float); } default: { - const SkGammas* gammas = thisXYZ->gammas(); - SkASSERT(gammas); - SkASSERT(gammas->isParametric(0)); - SkASSERT(gammas->isParametric(1)); - SkASSERT(gammas->isParametric(2)); - SkASSERT(gammas->data(0) == gammas->data(1)); - SkASSERT(gammas->data(0) == gammas->data(2)); + SkColorSpaceTransferFn transferFn; + SkAssertResult(this->isNumericalTransferFn(&transferFn)); if (memory) { *((ColorSpaceHeader*) memory) = @@ -384,13 +378,13 @@ size_t SkColorSpace::writeToMemory(void* memory) const { ColorSpaceHeader::kTransferFn_Flag); memory = SkTAddOffset<void>(memory, sizeof(ColorSpaceHeader)); - *(((float*) memory) + 0) = gammas->params(0).fA; - *(((float*) memory) + 1) = gammas->params(0).fB; - *(((float*) memory) + 2) = gammas->params(0).fC; - *(((float*) memory) + 3) = gammas->params(0).fD; - *(((float*) memory) + 4) = gammas->params(0).fE; - *(((float*) memory) + 5) = gammas->params(0).fF; - *(((float*) memory) + 6) = gammas->params(0).fG; + *(((float*) memory) + 0) = transferFn.fA; + *(((float*) memory) + 1) = transferFn.fB; + *(((float*) memory) + 2) = transferFn.fC; + *(((float*) memory) + 3) = transferFn.fD; + *(((float*) memory) + 4) = transferFn.fE; + *(((float*) memory) + 5) = transferFn.fF; + *(((float*) memory) + 6) = transferFn.fG; memory = SkTAddOffset<void>(memory, 7 * sizeof(float)); this->toXYZD50()->as3x4RowMajorf((float*) memory); diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h index 39522f71de..7cf7565600 100644 --- a/src/core/SkColorSpace_Base.h +++ b/src/core/SkColorSpace_Base.h @@ -131,7 +131,6 @@ struct SkGammas : SkRefCnt { class SkColorSpace_Base : public SkColorSpace { public: - enum class Type : uint8_t { kXYZ, kA2B @@ -140,10 +139,6 @@ public: virtual Type type() const = 0; private: - friend class SkColorSpace; - friend class SkColorSpace_XYZ; - friend class ColorSpaceXformTest; - friend class ColorSpaceTest; typedef SkColorSpace INHERITED; }; |