Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
JsonWriteBuffer Class Referencefinal

#include <JsonWriteBuffer.h>

Inheritance diagram for JsonWriteBuffer:
SkWriteBuffer

Public Member Functions

 JsonWriteBuffer (SkJSONWriter *writer, UrlDataManager *urlDataManager)
 
void writePad32 (const void *buffer, size_t bytes) override
 
void writeByteArray (const void *data, size_t size) override
 
void writeBool (bool value) override
 
void writeScalar (SkScalar value) override
 
void writeScalarArray (const SkScalar *value, uint32_t count) override
 
void writeInt (int32_t value) override
 
void writeIntArray (const int32_t *value, uint32_t count) override
 
void writeUInt (uint32_t value) override
 
void writeString (std::string_view value) override
 
void writeFlattenable (const SkFlattenable *flattenable) override
 
void writeColor (SkColor color) override
 
void writeColorArray (const SkColor *color, uint32_t count) override
 
void writeColor4f (const SkColor4f &color) override
 
void writeColor4fArray (const SkColor4f *color, uint32_t count) override
 
void writePoint (const SkPoint &point) override
 
void writePointArray (const SkPoint *point, uint32_t count) override
 
void writePoint3 (const SkPoint3 &point) override
 
void write (const SkM44 &) override
 
void writeMatrix (const SkMatrix &matrix) override
 
void writeIRect (const SkIRect &rect) override
 
void writeRect (const SkRect &rect) override
 
void writeRegion (const SkRegion &region) override
 
void writePath (const SkPath &path) override
 
void writeSampling (const SkSamplingOptions &) override
 
size_t writeStream (SkStream *stream, size_t length) override
 
void writeImage (const SkImage *) override
 
void writeTypeface (SkTypeface *typeface) override
 
void writePaint (const SkPaint &paint) override
 
- Public Member Functions inherited from SkWriteBuffer
 SkWriteBuffer (const SkSerialProcs &p)
 
virtual ~SkWriteBuffer ()
 
virtual void writePad32 (const void *buffer, size_t bytes)=0
 
virtual void writeByteArray (const void *data, size_t size)=0
 
void writeDataAsByteArray (const SkData *data)
 
virtual void writeBool (bool value)=0
 
virtual void writeScalar (SkScalar value)=0
 
virtual void writeScalarArray (const SkScalar *value, uint32_t count)=0
 
virtual void writeInt (int32_t value)=0
 
virtual void writeIntArray (const int32_t *value, uint32_t count)=0
 
virtual void writeUInt (uint32_t value)=0
 
void write32 (int32_t value)
 
virtual void writeString (std::string_view value)=0
 
virtual void writeFlattenable (const SkFlattenable *flattenable)=0
 
virtual void writeColor (SkColor color)=0
 
virtual void writeColorArray (const SkColor *color, uint32_t count)=0
 
virtual void writeColor4f (const SkColor4f &color)=0
 
virtual void writeColor4fArray (const SkColor4f *color, uint32_t count)=0
 
virtual void writePoint (const SkPoint &point)=0
 
virtual void writePointArray (const SkPoint *point, uint32_t count)=0
 
virtual void writePoint3 (const SkPoint3 &point)=0
 
virtual void write (const SkM44 &)=0
 
virtual void writeMatrix (const SkMatrix &matrix)=0
 
virtual void writeIRect (const SkIRect &rect)=0
 
virtual void writeRect (const SkRect &rect)=0
 
virtual void writeRegion (const SkRegion &region)=0
 
virtual void writeSampling (const SkSamplingOptions &)=0
 
virtual void writePath (const SkPath &path)=0
 
virtual size_t writeStream (SkStream *stream, size_t length)=0
 
virtual void writeImage (const SkImage *)=0
 
virtual void writeTypeface (SkTypeface *typeface)=0
 
virtual void writePaint (const SkPaint &paint)=0
 
const SkSerialProcsserialProcs () const
 

Additional Inherited Members

- Protected Attributes inherited from SkWriteBuffer
SkSerialProcs fProcs
 

Detailed Description

Definition at line 37 of file JsonWriteBuffer.h.

Constructor & Destructor Documentation

◆ JsonWriteBuffer()

JsonWriteBuffer::JsonWriteBuffer ( SkJSONWriter writer,
UrlDataManager urlDataManager 
)
inline

Definition at line 39 of file JsonWriteBuffer.h.

40 : SkWriteBuffer({}), fUrlDataManager(urlDataManager), fWriter(writer), fCount(0) {}
SkWriteBuffer(const SkSerialProcs &p)
Definition: SkWriteBuffer.h:43

Member Function Documentation

◆ write()

void JsonWriteBuffer::write ( const SkM44 matrix)
overridevirtual

Implements SkWriteBuffer.

Definition at line 156 of file JsonWriteBuffer.cpp.

156 {
157 this->append("matrix");
158 fWriter->beginArray();
159 for (int r = 0; r < 4; ++r) {
160 fWriter->beginArray(nullptr, false);
161 SkV4 v = matrix.row(r);
162 for (int c = 0; c < 4; ++c) {
163 fWriter->appendFloat(v[c]);
164 }
165 fWriter->endArray();
166 }
167 fWriter->endArray();
168}
void beginArray(const char *name=nullptr, bool multiline=true)
Definition: SkJSONWriter.h:146
void appendFloat(float value)
Definition: SkJSONWriter.h:241
void endArray()
Definition: SkJSONWriter.h:158
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
Definition: SkM44.h:98

◆ writeBool()

void JsonWriteBuffer::writeBool ( bool  value)
overridevirtual

Implements SkWriteBuffer.

Definition at line 53 of file JsonWriteBuffer.cpp.

53 {
54 this->append("bool");
55 fWriter->appendBool(value);
56}
void appendBool(bool value)
Definition: SkJSONWriter.h:229
uint8_t value

◆ writeByteArray()

void JsonWriteBuffer::writeByteArray ( const void *  data,
size_t  size 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 42 of file JsonWriteBuffer.cpp.

42 {
43 this->append("byteArray");
44 fWriter->beginArray();
45 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
46 for (size_t i = 0; i < size; ++i) {
47 SkString hexByte = SkStringPrintf("%02x", bytes[i]);
48 fWriter->appendString(hexByte);
49 }
50 fWriter->endArray();
51}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
void appendString(const char *value, size_t size)
Definition: SkJSONWriter.h:176
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

◆ writeColor()

void JsonWriteBuffer::writeColor ( SkColor  color)
overridevirtual

Implements SkWriteBuffer.

Definition at line 109 of file JsonWriteBuffer.cpp.

109 {
110 this->append("color");
112}
static void MakeJsonColor(SkJSONWriter &, const SkColor color)
DlColor color

◆ writeColor4f()

void JsonWriteBuffer::writeColor4f ( const SkColor4f color)
overridevirtual

Implements SkWriteBuffer.

Definition at line 123 of file JsonWriteBuffer.cpp.

123 {
124 this->append("color");
126}
static void MakeJsonColor4f(SkJSONWriter &, const SkColor4f &color)

◆ writeColor4fArray()

void JsonWriteBuffer::writeColor4fArray ( const SkColor4f color,
uint32_t  count 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 128 of file JsonWriteBuffer.cpp.

128 {
129 this->append("colorArray");
130 fWriter->beginArray();
131 for (uint32_t i = 0; i < count; ++i) {
133 }
134 fWriter->endArray();
135}
int count
Definition: FontMgrTest.cpp:50

◆ writeColorArray()

void JsonWriteBuffer::writeColorArray ( const SkColor color,
uint32_t  count 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 114 of file JsonWriteBuffer.cpp.

114 {
115 this->append("colorArray");
116 fWriter->beginArray();
117 for (uint32_t i = 0; i < count; ++i) {
119 }
120 fWriter->endArray();
121}

◆ writeFlattenable()

void JsonWriteBuffer::writeFlattenable ( const SkFlattenable flattenable)
overridevirtual

Implements SkWriteBuffer.

Definition at line 96 of file JsonWriteBuffer.cpp.

96 {
97 if (flattenable) {
98 this->append(flattenable->getTypeName());
99 fWriter->beginObject();
100 JsonWriteBuffer flattenableBuffer(fWriter, fUrlDataManager);
101 flattenable->flatten(flattenableBuffer);
102 fWriter->endObject();
103 } else {
104 this->append("flattenable");
105 fWriter->appendPointer(nullptr);
106 }
107}
virtual void flatten(SkWriteBuffer &) const
Definition: SkFlattenable.h:67
virtual const char * getTypeName() const =0
void beginObject(const char *name=nullptr, bool multiline=true)
Definition: SkJSONWriter.h:114
void appendPointer(const void *value)
Definition: SkJSONWriter.h:228
void endObject()
Definition: SkJSONWriter.h:126

◆ writeImage()

void JsonWriteBuffer::writeImage ( const SkImage image)
overridevirtual

Implements SkWriteBuffer.

Definition at line 207 of file JsonWriteBuffer.cpp.

207 {
208 this->append("image");
209 fWriter->beginObject();
210 DrawCommand::flatten(*image, *fWriter, *fUrlDataManager);
211 fWriter->endObject();
212}
static void flatten(const SkFlattenable *flattenable, SkJSONWriter &writer, UrlDataManager &urlDataManager)
sk_sp< const SkImage > image
Definition: SkRecords.h:269

◆ writeInt()

void JsonWriteBuffer::writeInt ( int32_t  value)
overridevirtual

Implements SkWriteBuffer.

Definition at line 72 of file JsonWriteBuffer.cpp.

72 {
73 this->append("int");
74 fWriter->appendS32(value);
75}
void appendS32(int32_t value)
Definition: SkJSONWriter.h:237

◆ writeIntArray()

void JsonWriteBuffer::writeIntArray ( const int32_t *  value,
uint32_t  count 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 77 of file JsonWriteBuffer.cpp.

77 {
78 this->append("intArray");
79 fWriter->beginArray();
80 for (uint32_t i = 0; i < count; ++i) {
81 fWriter->appendS32(value[i]);
82 }
83 fWriter->endArray();
84}

◆ writeIRect()

void JsonWriteBuffer::writeIRect ( const SkIRect rect)
overridevirtual

Implements SkWriteBuffer.

Definition at line 175 of file JsonWriteBuffer.cpp.

175 {
176 this->append("irect");
178}
static void MakeJsonIRect(SkJSONWriter &, const SkIRect &)
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ writeMatrix()

void JsonWriteBuffer::writeMatrix ( const SkMatrix matrix)
overridevirtual

Implements SkWriteBuffer.

Definition at line 170 of file JsonWriteBuffer.cpp.

170 {
171 this->append("matrix");
173}
static void MakeJsonMatrix(SkJSONWriter &, const SkMatrix &)

◆ writePad32()

void JsonWriteBuffer::writePad32 ( const void *  buffer,
size_t  bytes 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 31 of file JsonWriteBuffer.cpp.

31 {
32 this->append("rawBytes");
33 fWriter->beginArray();
34 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
35 for (size_t i = 0; i < size; ++i) {
36 SkString hexByte = SkStringPrintf("%02x", bytes[i]);
37 fWriter->appendString(hexByte);
38 }
39 fWriter->endArray();
40}

◆ writePaint()

void JsonWriteBuffer::writePaint ( const SkPaint paint)
overridevirtual

Implements SkWriteBuffer.

Definition at line 220 of file JsonWriteBuffer.cpp.

220 {
221 this->append("paint");
222 DrawCommand::MakeJsonPaint(*fWriter, paint, *fUrlDataManager);
223}
static void MakeJsonPaint(SkJSONWriter &, const SkPaint &paint, UrlDataManager &urlDataManager)
const Paint & paint
Definition: color_source.cc:38

◆ writePath()

void JsonWriteBuffer::writePath ( const SkPath path)
overridevirtual

Implements SkWriteBuffer.

Definition at line 190 of file JsonWriteBuffer.cpp.

190 {
191 this->append("path");
193}
static void MakeJsonPath(SkJSONWriter &, const SkPath &path)
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
Definition: switches.h:57

◆ writePoint()

void JsonWriteBuffer::writePoint ( const SkPoint point)
overridevirtual

Implements SkWriteBuffer.

Definition at line 137 of file JsonWriteBuffer.cpp.

137 {
138 this->append("point");
139 DrawCommand::MakeJsonPoint(*fWriter, point);
140}
static void MakeJsonPoint(SkJSONWriter &, const SkPoint &point)

◆ writePoint3()

void JsonWriteBuffer::writePoint3 ( const SkPoint3 point)
overridevirtual

Implements SkWriteBuffer.

Definition at line 142 of file JsonWriteBuffer.cpp.

142 {
143 this->append("point3");
144 DrawCommand::MakeJsonPoint3(*fWriter, point);
145}
static void MakeJsonPoint3(SkJSONWriter &, const SkPoint3 &point)

◆ writePointArray()

void JsonWriteBuffer::writePointArray ( const SkPoint point,
uint32_t  count 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 147 of file JsonWriteBuffer.cpp.

147 {
148 this->append("pointArray");
149 fWriter->beginArray();
150 for (uint32_t i = 0; i < count; ++i) {
151 DrawCommand::MakeJsonPoint(*fWriter, point[i]);
152 }
153 fWriter->endArray();
154}

◆ writeRect()

void JsonWriteBuffer::writeRect ( const SkRect rect)
overridevirtual

Implements SkWriteBuffer.

Definition at line 180 of file JsonWriteBuffer.cpp.

180 {
181 this->append("rect");
183}
static void MakeJsonRect(SkJSONWriter &, const SkRect &rect)

◆ writeRegion()

void JsonWriteBuffer::writeRegion ( const SkRegion region)
overridevirtual

Implements SkWriteBuffer.

Definition at line 185 of file JsonWriteBuffer.cpp.

185 {
186 this->append("region");
188}
static void MakeJsonRegion(SkJSONWriter &, const SkRegion &region)
ClipOpAndAA opAA SkRegion region
Definition: SkRecords.h:238

◆ writeSampling()

void JsonWriteBuffer::writeSampling ( const SkSamplingOptions sampling)
overridevirtual

Implements SkWriteBuffer.

Definition at line 195 of file JsonWriteBuffer.cpp.

195 {
196 this->append("sampling");
198}
static void MakeJsonSampling(SkJSONWriter &, const SkSamplingOptions &sampling)
SkSamplingOptions sampling
Definition: SkRecords.h:337

◆ writeScalar()

void JsonWriteBuffer::writeScalar ( SkScalar  value)
overridevirtual

Implements SkWriteBuffer.

Definition at line 58 of file JsonWriteBuffer.cpp.

58 {
59 this->append("scalar");
60 fWriter->appendFloat(value);
61}

◆ writeScalarArray()

void JsonWriteBuffer::writeScalarArray ( const SkScalar value,
uint32_t  count 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 63 of file JsonWriteBuffer.cpp.

63 {
64 this->append("scalarArray");
65 fWriter->beginArray();
66 for (uint32_t i = 0; i < count; ++i) {
67 fWriter->appendFloat(value[i]);
68 }
69 fWriter->endArray();
70}

◆ writeStream()

size_t JsonWriteBuffer::writeStream ( SkStream stream,
size_t  length 
)
overridevirtual

Implements SkWriteBuffer.

Definition at line 200 of file JsonWriteBuffer.cpp.

200 {
201 // Contents not supported
202 this->append("stream");
203 fWriter->appendU64(static_cast<uint64_t>(length));
204 return 0;
205}
void appendU64(uint64_t value)
size_t length

◆ writeString()

void JsonWriteBuffer::writeString ( std::string_view  value)
overridevirtual

Implements SkWriteBuffer.

Definition at line 91 of file JsonWriteBuffer.cpp.

91 {
92 this->append("string");
93 fWriter->appendString(value.data(), value.size());
94}

◆ writeTypeface()

void JsonWriteBuffer::writeTypeface ( SkTypeface typeface)
overridevirtual

Implements SkWriteBuffer.

Definition at line 214 of file JsonWriteBuffer.cpp.

214 {
215 // Unsupported
216 this->append("typeface");
217 fWriter->appendPointer(typeface);
218}

◆ writeUInt()

void JsonWriteBuffer::writeUInt ( uint32_t  value)
overridevirtual

Implements SkWriteBuffer.

Definition at line 86 of file JsonWriteBuffer.cpp.

86 {
87 this->append("uint");
88 fWriter->appendU32(value);
89}
void appendU32(uint32_t value)
Definition: SkJSONWriter.h:239

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