Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
skottie::internal::EffectBuilder Class Referencefinal

#include <Effects.h>

Inheritance diagram for skottie::internal::EffectBuilder:
SkNoncopyable

Public Member Functions

 EffectBuilder (const AnimationBuilder *, const SkSize &, CompositionBuilder *)
 
sk_sp< sksg::RenderNodeattachEffects (const skjson::ArrayValue &, sk_sp< sksg::RenderNode >) const
 
sk_sp< sksg::RenderNodeattachStyles (const skjson::ArrayValue &, sk_sp< sksg::RenderNode >) const
 
LayerBuildergetLayerBuilder (int layer_index) const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Static Public Member Functions

static const skjson::ValueGetPropValue (const skjson::ArrayValue &jprops, size_t prop_index)
 

Detailed Description

Definition at line 31 of file Effects.h.

Constructor & Destructor Documentation

◆ EffectBuilder()

skottie::internal::EffectBuilder::EffectBuilder ( const AnimationBuilder abuilder,
const SkSize layer_size,
CompositionBuilder cbuilder 
)

Definition at line 27 of file Effects.cpp.

30 : fBuilder(abuilder)
31 , fCompBuilder(cbuilder)
32 , fLayerSize(layer_size) {}

Member Function Documentation

◆ attachEffects()

sk_sp< sksg::RenderNode > skottie::internal::EffectBuilder::attachEffects ( const skjson::ArrayValue jeffects,
sk_sp< sksg::RenderNode layer 
) const

Definition at line 112 of file Effects.cpp.

113 {
114 if (!layer) {
115 return nullptr;
116 }
117
118 for (const skjson::ObjectValue* jeffect : jeffects) {
119 if (!jeffect) {
120 continue;
121 }
122
123 const auto builder = this->findBuilder(*jeffect);
124 const skjson::ArrayValue* jprops = (*jeffect)["ef"];
125 if (!builder || !jprops) {
126 continue;
127 }
128
129 const AnimationBuilder::AutoPropertyTracker apt(fBuilder, *jeffect, PropertyObserver::NodeType::EFFECT);
130 layer = (this->*builder)(*jprops, std::move(layer));
131
132 if (!layer) {
133 fBuilder->log(Logger::Level::kError, jeffect, "Invalid layer effect.");
134 return nullptr;
135 }
136 }
137
138 return layer;
139}
void log(Logger::Level, const skjson::Value *, const char fmt[],...) const SK_PRINTF_LIKE(4
Definition: Skottie.cpp:71

◆ attachStyles()

sk_sp< sksg::RenderNode > skottie::internal::EffectBuilder::attachStyles ( const skjson::ArrayValue jstyles,
sk_sp< sksg::RenderNode layer 
) const

Definition at line 141 of file Effects.cpp.

142 {
143#if !defined(SKOTTIE_DISABLE_STYLES)
144 if (!layer) {
145 return nullptr;
146 }
147
148 using StyleBuilder =
151 static constexpr StyleBuilder gStyleBuilders[] = {
152 nullptr, // 'ty': 0 -> stroke
153 &EffectBuilder::attachDropShadowStyle, // 'ty': 1 -> drop shadow
154 &EffectBuilder::attachInnerShadowStyle, // 'ty': 2 -> inner shadow
155 &EffectBuilder::attachOuterGlowStyle, // 'ty': 3 -> outer glow
156 &EffectBuilder::attachInnerGlowStyle, // 'ty': 4 -> inner glow
157 };
158
159 for (const skjson::ObjectValue* jstyle : jstyles) {
160 if (!jstyle) {
161 continue;
162 }
163
164 const auto style_type =
165 ParseDefault<size_t>((*jstyle)["ty"], std::numeric_limits<size_t>::max());
166 auto builder = style_type < std::size(gStyleBuilders) ? gStyleBuilders[style_type]
167 : nullptr;
168
169 if (!builder) {
170 fBuilder->log(Logger::Level::kWarning, jstyle, "Unsupported layer style.");
171 continue;
172 }
173
174 layer = (this->*builder)(*jstyle, std::move(layer));
175 }
176#endif // !defined(SKOTTIE_DISABLE_STYLES)
177
178 return layer;
179}
EffectBuilder(const AnimationBuilder *, const SkSize &, CompositionBuilder *)
Definition: Effects.cpp:27
static float max(float r, float g, float b)
Definition: hsl.cpp:49
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ getLayerBuilder()

LayerBuilder * skottie::internal::EffectBuilder::getLayerBuilder ( int  layer_index) const
inline

Definition at line 43 of file Effects.h.

43 {
44 return fCompBuilder->layerBuilder(layer_index);
45 }
LayerBuilder * layerBuilder(int layer_index)

◆ GetPropValue()

const skjson::Value & skottie::internal::EffectBuilder::GetPropValue ( const skjson::ArrayValue jprops,
size_t  prop_index 
)
static

Definition at line 181 of file Effects.cpp.

182 {
184
185 if (prop_index >= jprops.size()) {
186 return kNull;
187 }
188
189 const skjson::ObjectValue* jprop = jprops[prop_index];
190
191 return jprop ? (*jprop)["v"] : kNull;
192}
size_t size() const
Definition: SkJSON.h:262
@ kNull
Definition: paint.cc:59

The documentation for this class was generated from the following files: