| 1 |
/* |
| 2 |
* Copyright 2023 Google LLC |
| 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 GrColorTableEffect_DEFINED |
| 9 |
#define GrColorTableEffect_DEFINED |
| 10 |
|
| 11 |
#include "src/gpu/ganesh/GrFragmentProcessor.h" |
| 12 |
#include "src/gpu/ganesh/GrProcessorUnitTest.h" |
| 13 |
|
| 14 |
#include <memory> |
| 15 |
|
| 16 |
class GrMippedBitmap; |
| 17 |
class GrRecordingContext; |
| 18 |
class GrSurfaceProxyView; |
| 19 |
class SkBitmap; |
| 20 |
struct GrShaderCaps; |
| 21 |
|
| 22 |
namespace skgpu { |
| 23 |
class KeyBuilder; |
| 24 |
} |
| 25 |
|
| 26 |
class ColorTableEffect : public GrFragmentProcessor { |
| 27 |
public: |
| 28 |
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> inputFP, |
| 29 |
GrRecordingContext* context, |
| 30 |
const GrMippedBitmap&); |
| 31 |
|
| 32 |
~ColorTableEffect() override {} |
| 33 |
|
| 34 |
const char* name() const override { return "ColorTableEffect"; } |
| 35 |
|
| 36 |
std::unique_ptr<GrFragmentProcessor> clone() const override { |
| 37 |
return std::unique_ptr<GrFragmentProcessor>(new ColorTableEffect(*this)); |
| 38 |
} |
| 39 |
|
| 40 |
inline static constexpr int kTexEffectFPIndex = 0; |
| 41 |
inline static constexpr int kInputFPIndex = 1; |
| 42 |
|
| 43 |
private: |
| 44 |
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override; |
| 45 |
|
| 46 |
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {} |
| 47 |
|
| 48 |
bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
| 49 |
|
| 50 |
ColorTableEffect(std::unique_ptr<GrFragmentProcessor> inputFP, GrSurfaceProxyView view); |
| 51 |
|
| 52 |
explicit ColorTableEffect(const ColorTableEffect& that); |
| 53 |
|
| 54 |
GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
| 55 |
}; |
| 56 |
|
| 57 |
#endif |