67public:
69
71
73 return fPictures;
74 }
75
77 return fDrawables;
78 }
79
81 return fTextBlobs;
82 }
83
85 return fSlugs;
86 }
87
89 return fVertices;
90 }
91
93 return fImages;
94 }
95
97 this->validate(fWriter.bytesWritten(), 0);
98
99 if (fWriter.bytesWritten() == 0) {
101 }
102 return fWriter.snapshotAsData();
103 }
104
105 void setFlags(uint32_t recordFlags) {
106 fRecordFlags = recordFlags;
107 }
108
110 return fWriter;
111 }
112
113 void beginRecording();
114 void endRecording();
115
116protected:
117 void addNoOp();
118
119private:
120 void handleOptimization(int opt);
121 size_t recordRestoreOffsetPlaceholder();
122 void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset);
123
125
127
128
129
130
131
132
133
134
135
136
137
138
139
140 size_t addDraw(
DrawType drawType,
size_t* size) {
141 size_t offset = fWriter.bytesWritten();
142
144
146 SkASSERT(((uint8_t) drawType) == drawType);
147
151 fWriter.writeInt(
SkToU32(*size));
152 } else {
154 }
155
157 }
158
159 void addInt(int value) {
160 fWriter.writeInt(value);
161 }
163 fWriter.writeScalar(scalar);
164 }
165
167 void addMatrix(
const SkMatrix& matrix);
170 void addPatch(
const SkPoint cubics[12]);
171 void addPath(
const SkPath& path);
172 void addPicture(
const SkPicture* picture);
174 void addPoint(
const SkPoint& point);
176 void addRect(
const SkRect& rect);
177 void addRectPtr(
const SkRect* rect);
178 void addIRect(
const SkIRect& rect);
179 void addIRectPtr(
const SkIRect* rect);
181 void addRegion(
const SkRegion& region);
183 void addText(
const void*
text,
size_t byteLength);
187
189
190protected:
191 void validate(size_t initialOffset, size_t size) const {
192 SkASSERT(fWriter.bytesWritten() == initialOffset + size);
193 }
194
196 bool onPeekPixels(
SkPixmap*)
override {
return false; }
197
198 void willSave() override;
199 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
200 bool onDoSaveBehind(
const SkRect*)
override;
201 void willRestore() override;
202
203 void didConcat44(
const SkM44&)
override;
204 void didSetM44(
const SkM44&)
override;
207
209
213 void onDrawPatch(
const SkPoint cubics[12],
const SkColor colors[4],
215
216 void onDrawPaint(
const SkPaint&)
override;
217 void onDrawBehind(
const SkPaint&)
override;
225
229 const SkPaint*, SrcRectConstraint)
override;
234
237
243 void onResetClip() override;
244
246
248 void onDrawAnnotation(
const SkRect&,
const char[],
SkData*)
override;
249
254
255 int addPathToHeap(
const SkPath& path);
256
257
258
259
260 void recordConcat(
const SkMatrix& matrix);
261 void recordTranslate(
const SkMatrix& matrix);
262 void recordScale(
const SkMatrix& matrix);
263 size_t recordClipRect(
const SkRect& rect,
SkClipOp op,
bool doAA);
265 size_t recordClipPath(
int pathID,
SkClipOp op,
bool doAA);
267 void recordSave();
268 void recordSaveLayer(const SaveLayerRec&);
269 void recordRestore(bool fillInSkips = true);
270
271private:
273
274 struct PathHash {
275 uint32_t operator()(
const SkPath& p) {
return p.getGenerationID(); }
276 };
278
280
287
288 uint32_t fRecordFlags;
289 int fInitialSaveCount;
290
292};
293
294#endif
#define SkASSERT_RELEASE(cond)
#define PACK_8_24(small, large)
constexpr uint32_t SkToU32(S x)
int find(T *array, int N, T item)
static sk_sp< SkData > MakeEmpty()
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