OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef SkColorLookUpTable_DEFINED |
| 9 #define SkColorLookUpTable_DEFINED |
| 10 |
| 11 #include "SkRefCnt.h" |
| 12 #include "SkTemplates.h" |
| 13 |
| 14 class SkColorLookUpTable : public SkRefCnt { |
| 15 public: |
| 16 static constexpr uint8_t kOutputChannels = 3; |
| 17 |
| 18 SkColorLookUpTable(uint8_t inputChannels, const uint8_t gridPoints[3]) |
| 19 : fInputChannels(inputChannels) { |
| 20 SkASSERT(3 == inputChannels); |
| 21 memcpy(fGridPoints, gridPoints, 3 * sizeof(uint8_t)); |
| 22 } |
| 23 |
| 24 void interp3D(float dst[3], float src[3]) const; |
| 25 |
| 26 private: |
| 27 const float* table() const { |
| 28 return SkTAddOffset<const float>(this, sizeof(SkColorLookUpTable)); |
| 29 } |
| 30 |
| 31 uint8_t fInputChannels; |
| 32 uint8_t fGridPoints[3]; |
| 33 |
| 34 public: |
| 35 // Objects of this type are created in a custom fashion using sk_malloc_thro
w |
| 36 // and therefore must be sk_freed. |
| 37 void* operator new(size_t size) = delete; |
| 38 void* operator new(size_t, void* p) { return p; } |
| 39 void operator delete(void* p) { sk_free(p); } |
| 40 }; |
| 41 |
| 42 #endif |
OLD | NEW |