39ColorTableEffect::ColorTableEffect(std::unique_ptr<GrFragmentProcessor> inputFP,
45 this->registerChild(std::move(inputFP));
50std::unique_ptr<GrFragmentProcessor::ProgramImpl> ColorTableEffect::onMakeProgramImpl()
const {
53 void emitCode(EmitArgs&
args)
override {
61 "half4 coord = 255 * unpremul(%s) + 0.5;\n"
62 "half4 color = half4(%s.a, %s.a, %s.a, 1);\n"
63 "return color * %s.a;\n",
72 return std::make_unique<Impl>();
76 std::unique_ptr<GrFragmentProcessor> inputFP,
84 "MakeColorTableEffect",
90 return std::unique_ptr<GrFragmentProcessor>(
98#if defined(GR_TEST_UTILS)
99std::unique_ptr<GrFragmentProcessor> ColorTableEffect::TestCreate(GrProcessorTestData*
d) {
101 uint8_t luts[256][4];
103 for (
int i = 0;
i < 4; ++
i) {
104 flags |=
d->fRandom->nextBool() ? (1 <<
i) : 0;
107 for (
int i = 0;
i < 4; ++
i) {
109 for (
int j = 0; j < 256; ++j) {
110 luts[j][
i] =
SkToU8(
d->fRandom->nextBits(8));
115 (
flags & (1 << 1)) ? luts[1] :
nullptr,
116 (
flags & (1 << 2)) ? luts[2] :
nullptr,
117 (
flags & (1 << 3)) ? luts[3] :
nullptr));
127 return std::move(
fp);
#define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(...)
@ kUnknown_SkAlphaType
uninitialized
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeCachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, std::string_view label, skgpu::Mipmapped mipmapped)
constexpr uint8_t SkToU8(S x)
static constexpr int kInputFPIndex
static std::unique_ptr< GrFragmentProcessor > Make(std::unique_ptr< GrFragmentProcessor > inputFP, GrRecordingContext *context, const SkBitmap &bitmap)
static constexpr int kTexEffectFPIndex
void codeAppendf(const char format[],...) SK_PRINTF_LIKE(2
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
static sk_sp< SkColorFilter > TableARGB(const uint8_t tableA[256], const uint8_t tableR[256], const uint8_t tableG[256], const uint8_t tableB[256])
static SampleUsage Explicit()
const char * c_str() const
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
std::unique_ptr< GrFragmentProcessor > Make(const SkMaskFilter *maskfilter, const GrFPArgs &args, const SkMatrix &ctm)
const myers::Point & get< 0 >(const myers::Segment &s)