42class InvalidationController;
48#if defined(SK_ENABLE_SKOTTIE_SKSLEFFECT)
58 const auto& child = this->children()[0];
59 return child->revalidate(ic, ctm);
62 void onRender(
SkCanvas* canvas,
const RenderContext* ctx)
const override {
64 const auto local_ctx = ScopedRenderContext(canvas, ctx)
68 this->children()[0]->render(canvas, local_ctx);
77 const RenderNode* onNodeAt(
const SkPoint&)
const override {
return nullptr; }
87 const AnimationBuilder& abuilder)
89 if (jprops.
size() < 1) {
104 result.errorText.c_str());
107 fEffect = std::move(
result.effect);
112 kFirstUniform_index = 1,
116 const AnimationBuilder& abuilder,
117 AnimatablePropertyContainer *
const &container) {
119 for (
size_t i = kFirstUniform_index;
i < jprops.
size();
i++) {
121 if (!jprop) {
continue; }
123 if (!uniformName) {
continue; }
124 auto uniformTuple = std::make_tuple(
SkString(uniformName->
begin(),
125 uniformName->
size()),
126 std::make_unique<VectorValue>());
127 fUniforms.push_back(std::move(uniformTuple));
128 container->bind(abuilder, (*jprop)[
"v"],
std::get<1>(fUniforms.back()).get());
135 sk_bzero(uniformData->writable_data(), uniformData->size());
136 for (
const auto& uniform : fUniforms) {
140 if (metadata && metadata->count ==
static_cast<int>(
data->size())) {
141 auto dst =
reinterpret_cast<uint8_t*
>(uniformData->writable_data()) + metadata->offset;
142 memcpy(
reinterpret_cast<void*
>(
dst),
data->data(),
data->size() *
sizeof(
float));
144 SkDebugf(
"cannot set malformed uniform: %s",
name.c_str());
150 std::vector<std::tuple<SkString, std::unique_ptr<VectorValue>>> fUniforms;
153class SkSLShaderAdapter final :
public DiscardableAdapterBase<SkSLShaderAdapter,
155 public SkSLEffectBase {
158 const AnimationBuilder& abuilder,
160 : DiscardableAdapterBase<SkSLShaderAdapter, SkSLShaderNode>(
std::move(node))
161 , SkSLEffectBase(jprops, abuilder)
163 this->bindUniforms(jprops, abuilder,
this);
167 void onSync()
override {
173 this->node()->setShader(std::move(shader));
177class SkSLColorFilterAdapter final :
public DiscardableAdapterBase<SkSLColorFilterAdapter,
178 sksg::ExternalColorFilter>
179 ,
public SkSLEffectBase {
182 const AnimationBuilder& abuilder,
184 : DiscardableAdapterBase<SkSLColorFilterAdapter,
sksg::ExternalColorFilter>(
std::move(node))
185 , SkSLEffectBase(jprops, abuilder)
187 this->bindUniforms(jprops, abuilder,
this);
191 void onSync()
override {
196 this->node()->setColorFilter(std::move(cf));
206#if defined(SK_ENABLE_SKOTTIE_SKSLEFFECT)
207 auto shaderNode = sk_make_sp<SkSLShaderNode>(std::move(layer));
209 std::move(shaderNode));
217#if defined(SK_ENABLE_SKOTTIE_SKSLEFFECT)
sk_bzero(glyphs, sizeof(glyphs))
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define INHERITED(method,...)
#define SG_ATTRIBUTE(attr_name, attr_type, attr_container)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawPaint(const SkPaint &paint)
SkMatrix getTotalMatrix() const
static sk_sp< SkData > MakeUninitialized(size_t length)
void setShader(sk_sp< SkShader > shader)
void setBlendMode(SkBlendMode mode)
size_t uniformSize() const
sk_sp< SkShader > makeShader(sk_sp< const SkData > uniforms, sk_sp< SkShader > children[], size_t childCount, const SkMatrix *localMatrix=nullptr) const
static Result MakeForShader(SkString sksl, const Options &)
sk_sp< SkColorFilter > makeColorFilter(sk_sp< const SkData > uniforms) const
const Uniform * findUniform(std::string_view name) const
const char * begin() const
void attachDiscardableAdapter(sk_sp< T > adapter) const
static sk_sp< ExternalColorFilter > Make(sk_sp< RenderNode > child)
Optional< SkRect > bounds
DEF_SWITCHES_START aot vmservice shared library name
const myers::Point & get< 1 >(const myers::Segment &s)
const myers::Point & get< 0 >(const myers::Segment &s)
std::shared_ptr< const fml::Mapping > data