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>
This commit is contained in:
Brian Osman 2017-12-22 16:22:21 -05:00 committed by Skia Commit-Bot
parent 7557bbbe19
commit 68c8156cdf
2 changed files with 10 additions and 21 deletions

View File

@ -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);

View File

@ -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;
};