Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkImageFilter_Base::Common Class Reference

#include <SkImageFilter_Base.h>

Public Member Functions

bool unflatten (SkReadBuffer &, int expectedInputs)
 
std::optional< SkRectcropRect () const
 
int inputCount () const
 
sk_sp< SkImageFilter > * inputs ()
 
sk_sp< SkImageFiltergetInput (int index)
 

Detailed Description

Definition at line 147 of file SkImageFilter_Base.h.

Member Function Documentation

◆ cropRect()

std::optional< SkRect > SkImageFilter_Base::Common::cropRect ( ) const
inline

Definition at line 159 of file SkImageFilter_Base.h.

159{ return fCropRect; }

◆ getInput()

sk_sp< SkImageFilter > SkImageFilter_Base::Common::getInput ( int  index)
inline

Definition at line 164 of file SkImageFilter_Base.h.

164{ return fInputs[index]; }

◆ inputCount()

int SkImageFilter_Base::Common::inputCount ( ) const
inline

Definition at line 161 of file SkImageFilter_Base.h.

161{ return fInputs.size(); }
int size() const
Definition: SkTArray.h:421

◆ inputs()

sk_sp< SkImageFilter > * SkImageFilter_Base::Common::inputs ( )
inline

Definition at line 162 of file SkImageFilter_Base.h.

162{ return fInputs.begin(); }

◆ unflatten()

bool SkImageFilter_Base::Common::unflatten ( SkReadBuffer buffer,
int  expectedInputs 
)

Attempt to unflatten the expected number of input filters. If any number of input filters is valid, pass -1. If this fails (i.e. corrupt buffer or contents) then return false and common will be left uninitialized. If this returns true, then inputCount() is the number of found input filters, each of which may be NULL or a valid imagefilter.

Definition at line 177 of file SkImageFilter.cpp.

177 {
178 const int count = buffer.readInt();
179 if (!buffer.validate(count >= 0)) {
180 return false;
181 }
182 if (!buffer.validate(expectedCount < 0 || count == expectedCount)) {
183 return false;
184 }
185
186#if defined(SK_BUILD_FOR_FUZZER)
187 if (count > 4) {
188 return false;
189 }
190#endif
191
192 SkASSERT(fInputs.empty());
193 for (int i = 0; i < count; i++) {
194 fInputs.push_back(buffer.readBool() ? buffer.readImageFilter() : nullptr);
195 if (!buffer.isValid()) {
196 return false;
197 }
198 }
199
201 static constexpr uint32_t kHasAll_CropEdge = 0x0F;
202 SkRect rect;
203 buffer.readRect(&rect);
204 if (!buffer.isValid() || !buffer.validate(SkIsValidRect(rect))) {
205 return false;
206 }
207
208 uint32_t flags = buffer.readUInt();
209 if (!buffer.isValid() ||
210 !buffer.validate(flags == 0x0 || flags == kHasAll_CropEdge)) {
211 return false;
212 }
213 if (flags == kHasAll_CropEdge) {
214 fCropRect = rect;
215 }
216 }
217 return buffer.isValid();
218}
int count
Definition: FontMgrTest.cpp:50
#define SkASSERT(cond)
Definition: SkAssert.h:116
static bool SkIsValidRect(const SkRect &rect)
bool empty() const
Definition: SkTArray.h:199
FlutterSemanticsFlag flags
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

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