Chromium Code Reviews| Index: src/core/SkColorSpace_Base.h |
| diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h |
| index d18b631072d928932f5dc381c19fdc70aadd76c0..6cfbb8c837bf4b3a398e59523d551cb795f3b8bb 100644 |
| --- a/src/core/SkColorSpace_Base.h |
| +++ b/src/core/SkColorSpace_Base.h |
| @@ -129,18 +129,27 @@ struct SkGammas : SkRefCnt { |
| }; |
| struct SkColorLookUpTable : public SkRefCnt { |
| + static constexpr uint8_t kOutputChannels = 3; |
| + |
| uint8_t fInputChannels; |
|
mtklein
2016/07/21 19:46:45
Is this one ever going to be not 3?
msarett
2016/07/21 19:49:28
Once we support CMYK, yes. That's why I'm letting
|
| - uint8_t fOutputChannels; |
| uint8_t fGridPoints[3]; |
| - std::unique_ptr<float[]> fTable; |
| - SkColorLookUpTable() |
| - : fInputChannels(0) |
| - , fOutputChannels(0) |
| - , fTable(nullptr) |
| + const float* table() const { |
| + return SkTAddOffset<const float>(this, sizeof(SkColorLookUpTable)); |
| + } |
| + |
| + SkColorLookUpTable(uint8_t inputChannels, uint8_t gridPoints[3]) |
| + : fInputChannels(inputChannels) |
| { |
| - fGridPoints[0] = fGridPoints[1] = fGridPoints[2] = 0; |
| + SkASSERT(3 == inputChannels); |
| + memcpy(fGridPoints, gridPoints, 3 * sizeof(uint8_t)); |
|
mtklein
2016/07/21 19:46:45
a.k.a, 3
msarett
2016/07/21 19:49:28
True.
|
| } |
| + |
| + // Objects of this type are created in a custom fashion using sk_malloc_throw |
| + // and therefore must be sk_freed. |
| + void* operator new(size_t size) = delete; |
| + void* operator new(size_t, void* p) { return p; } |
| + void operator delete(void* p) { sk_free(p); } |
| }; |
| class SkColorSpace_Base : public SkColorSpace { |