Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
SkFlattenable Class Referenceabstract

#include <SkFlattenable.h>

Inheritance diagram for SkFlattenable:
SkRefCnt SkRefCntBase SkBlender SkColorFilter SkDrawable SkImageFilter SkMaskFilter SkPathEffect SkShader SkBlenderBase SkColorFilterBase SkColorMatrixFilter CompoundDrawable DrawAtlasDrawable IntDrawable ModeDrawable MyDrawable PaintDrawable RootDrawable SkAnimatedImage SkPictureBackedGlyphDrawable SkRecordedDrawable SkImageFilter_Base SkMaskFilterBase sktext::gpu::SDFMaskFilter SkPathEffectBase SkShaderBase

Classes

class  PrivateInitializer
 

Public Types

enum  Type {
  kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type ,
  kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 

Public Member Functions

 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
virtual void flatten (SkWriteBuffer &) const
 
virtual Type getFlattenableType () const =0
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 

Friends

class SkGraphics
 

Detailed Description

SkFlattenable is the base class for objects that need to be flattened into a data stream for either transport or as part of the key to the font cache.

Definition at line 28 of file SkFlattenable.h.

Member Typedef Documentation

◆ Factory

typedef sk_sp< SkFlattenable >(* SkFlattenable::Factory) (SkReadBuffer &)

Definition at line 41 of file SkFlattenable.h.

Member Enumeration Documentation

◆ Type

Enumerator
kSkColorFilter_Type 
kSkBlender_Type 
kSkDrawable_Type 
kSkDrawLooper_Type 
kSkImageFilter_Type 
kSkMaskFilter_Type 
kSkPathEffect_Type 
kSkShader_Type 

Definition at line 30 of file SkFlattenable.h.

Constructor & Destructor Documentation

◆ SkFlattenable()

SkFlattenable::SkFlattenable ( )
inline

Definition at line 43 of file SkFlattenable.h.

43{}

Member Function Documentation

◆ Deserialize()

sk_sp< SkFlattenable > SkFlattenable::Deserialize ( SkFlattenable::Type  type,
const void *  data,
size_t  length,
const SkDeserialProcs procs = nullptr 
)
static

Definition at line 151 of file SkFlattenable.cpp.

152 {
154 if (procs) {
155 buffer.setDeserialProcs(*procs);
156 }
157 return sk_sp<SkFlattenable>(buffer.readFlattenable(type));
158}
GLenum type
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
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
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ FactoryToName()

const char * SkFlattenable::FactoryToName ( Factory  fact)
static

Definition at line 112 of file SkFlattenable.cpp.

112 {
113 RegisterFlattenablesIfNeeded();
114
115 const Entry* entries = gEntries;
116 for (int i = gCount - 1; i >= 0; --i) {
117 if (entries[i].fFactory == fact) {
118 return entries[i].fName;
119 }
120 }
121 return nullptr;
122}

◆ flatten()

virtual void SkFlattenable::flatten ( SkWriteBuffer ) const
inlinevirtual

◆ getFactory()

virtual Factory SkFlattenable::getFactory ( ) const
pure virtual

Implement this to return a factory function pointer that can be called to recreate your class given a buffer (previously written to by your override of flatten().

Implemented in SkDrawable, SkPath1DPathEffectImpl, SkLine2DPathEffectImpl, SkPath2DPathEffectImpl, SkCornerPathEffectImpl, SkDiscretePathEffectImpl, SkTransformShader, FailureColorFilter, IntDrawable, PaintDrawable, CompoundDrawable, and RootDrawable.

◆ getFlattenableType()

virtual Type SkFlattenable::getFlattenableType ( ) const
pure virtual

◆ getTypeName()

virtual const char * SkFlattenable::getTypeName ( ) const
pure virtual

◆ NameToFactory()

SkFlattenable::Factory SkFlattenable::NameToFactory ( const char  name[])
static

Definition at line 101 of file SkFlattenable.cpp.

101 {
102 RegisterFlattenablesIfNeeded();
103
104 SkASSERT(std::is_sorted(gEntries, gEntries + gCount, EntryComparator()));
105 auto pair = std::equal_range(gEntries, gEntries + gCount, name, EntryComparator());
106 if (pair.first == pair.second) {
107 return nullptr;
108 }
109 return pair.first->fFactory;
110}
#define SkASSERT(cond)
Definition: SkAssert.h:116
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ Register()

void SkFlattenable::Register ( const char  name[],
Factory  factory 
)
static

Definition at line 91 of file SkFlattenable.cpp.

91 {
93 SkASSERT(factory);
94 SkASSERT(gCount < (int)std::size(gEntries));
95
96 gEntries[gCount].fName = name;
97 gEntries[gCount].fFactory = factory;
98 gCount += 1;
99}

◆ serialize() [1/2]

sk_sp< SkData > SkFlattenable::serialize ( const SkSerialProcs procs = nullptr) const

Definition at line 126 of file SkFlattenable.cpp.

126 {
128 if (procs) {
129 p = *procs;
130 }
131 SkBinaryWriteBuffer writer(p);
132
133 writer.writeFlattenable(this);
134 size_t size = writer.bytesWritten();
136 writer.writeToMemory(data->writable_data());
137 return data;
138}
static sk_sp< SkData > MakeUninitialized(size_t length)
Definition: SkData.cpp:116

◆ serialize() [2/2]

size_t SkFlattenable::serialize ( void *  memory,
size_t  memory_size,
const SkSerialProcs procs = nullptr 
) const

Definition at line 140 of file SkFlattenable.cpp.

141 {
143 if (procs) {
144 p = *procs;
145 }
146 SkBinaryWriteBuffer writer(memory, memory_size, p);
147 writer.writeFlattenable(this);
148 return writer.usingInitialStorage() ? writer.bytesWritten() : 0u;
149}

Friends And Related Function Documentation

◆ SkGraphics

friend class SkGraphics
friend

Definition at line 91 of file SkFlattenable.h.


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