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 SkASSERT(3 == inputChannels); |
| 20 memcpy(fGridPoints, gridPoints, 3 * sizeof(uint8_t)); |
| 21 } |
| 22 |
| 23 void interp3D(float dst[3], float src[3]) const; |
| 24 |
| 25 private: |
| 26 const float* table() const { |
| 27 return SkTAddOffset<const float>(this, sizeof(SkColorLookUpTable)); |
| 28 } |
| 29 |
| 30 uint8_t fGridPoints[3]; |
| 31 |
| 32 public: |
| 33 // Objects of this type are created in a custom fashion using sk_malloc_thro
w |
| 34 // and therefore must be sk_freed. |
| 35 void* operator new(size_t size) = delete; |
| 36 void* operator new(size_t, void* p) { return p; } |
| 37 void operator delete(void* p) { sk_free(p); } |
| 38 }; |
| 39 |
| 40 #endif |
OLD | NEW |