37 return obj ? obj->size() : 0;
43void SkPictureData::initForPlayback()
const {
45 for (
int i = 0;
i < fPaths.
size();
i++) {
46 fPaths[
i].updateBoundsCache();
52 : fPictures(record.getPictures())
53 , fDrawables(record.getDrawables())
54 , fTextBlobs(record.getTextBlobs())
55 , fVertices(record.getVertices())
56 , fImages(record.getImages())
57 , fSlugs(record.getSlugs())
62 fPaints = record.fPaints;
71 this->initForPlayback();
120 if (
nullptr ==
name || 0 == *
name) {
121 stream->writePackedUInt(0);
160 if (!textBlobsOnly) {
161 int numPaints = fPaints.
size();
169 int numPaths = fPaths.
size();
172 buffer.writeInt(numPaths);
179 if (!fTextBlobs.
empty()) {
181 for (
const auto& blob : fTextBlobs) {
186 if (!textBlobsOnly) {
188 for (
const auto& slug : fSlugs) {
193 if (!textBlobsOnly) {
194 if (!fVertices.
empty()) {
196 for (
const auto& vert : fVertices) {
197 vert->priv().encode(
buffer);
201 if (!fImages.
empty()) {
203 for (
const auto& img : fImages) {
204 buffer.writeImage(img.get());
228 SkRefCntSet* topLevelTypeFaceSet,
bool textBlobsOnly)
const {
235 SkRefCntSet* typefaceSet = topLevelTypeFaceSet ? topLevelTypeFaceSet : &localTypefaceSet;
243 this->flattenToBuffer(
buffer, textBlobsOnly);
248 DevNull() : fBytesWritten(0) {}
249 size_t fBytesWritten;
250 bool write(
const void*,
size_t size)
override { fBytesWritten +=
size;
return true; }
251 size_t bytesWritten()
const override {
return fBytesWritten; }
253 for (
const auto& pic : fPictures) {
254 pic->serialize(&devnull,
nullptr, typefaceSet,
true);
256 if (textBlobsOnly) {
return; }
260 WriteFactories(
stream, factSet);
264 WriteTypefaces(
stream, *typefaceSet, procs);
271 if (!fPictures.empty()) {
273 for (
const auto& pic : fPictures) {
274 pic->serialize(
stream, &procs, typefaceSet,
false);
285 if (!fPictures.
empty()) {
287 for (
const auto& pic : fPictures) {
292 if (!fDrawables.
empty()) {
294 for (
const auto&
draw : fDrawables) {
300 this->flattenToBuffer(
buffer,
false);
311 int recursionLimit) {
321 if (!
stream->readU32(&
size)) {
return false; }
325 fFactoryPlayback = std::make_unique<SkFactoryPlayback>(
size);
326 for (
size_t i = 0;
i <
size;
i++) {
329 if (!
stream->readPackedUInt(&
len)) {
return false; }
345 for (uint32_t
i = 0;
i <
size; ++
i) {
361 fTFPlayback[
i] = std::move(tf);
371 for (uint32_t
i = 0;
i <
size;
i++) {
372 auto pic = SkPicture::MakeFromStreamPriv(
stream, &procs,
373 topLevelTFPlayback, recursionLimit - 1);
392 if (!fFactoryPlayback) {
395 fFactoryPlayback->setupBuffer(
buffer);
396 buffer.setDeserialProcs(procs);
398 if (fTFPlayback.
count() > 0) {
420 return buffer.readImage();
428template <
typename T,
typename U>
431 if (!
buffer.validate(array.empty() && SkTFitsIn<int>(inCount))) {
438 for (uint32_t
i = 0;
i < inCount; ++
i) {
439 auto obj = factory(
buffer);
441 if (!
buffer.validate(obj !=
nullptr)) {
446 array.push_back(std::move(obj));
461 fPaints.push_back(
buffer.readPaint());
495 if (!
buffer.validateCanReadN<uint8_t>(
size)) {
500 !
buffer.validate(
nullptr == fOpData)) {
504 fOpData = std::move(
data);
522 int recursionLimit) {
524 if (!topLevelTFPlayback) {
525 topLevelTFPlayback = &
data->fTFPlayback;
528 if (!
data->parseStream(
stream, procs, topLevelTFPlayback, recursionLimit)) {
531 return data.release();
542 return data.release();
548 int recursionLimit) {
551 if (!
stream->readU32(&tag)) {
return false; }
557 if (!
stream->readU32(&
size)) {
return false; }
558 if (!this->parseStreamTag(
stream, tag,
size, procs, topLevelTFPlayback, recursionLimit)) {
566 while (
buffer.isValid()) {
567 uint32_t tag =
buffer.readUInt();
575 if (!
buffer.validate(this->opData() !=
nullptr)) {
588 return reader->
validate(index > 0 && index <= fPaints.size()) ?
589 &fPaints[index - 1] :
nullptr;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static SkSerialProcs skip_typeface_proc(const SkSerialProcs &procs)
static void write_tag_size(SkWriteBuffer &buffer, uint32_t tag, size_t size)
bool new_array_from_buffer(SkReadBuffer &buffer, uint32_t inCount, TArray< sk_sp< T > > &array, sk_sp< U >(*factory)(SkReadBuffer &))
static sk_sp< SkImage > create_image_from_buffer(SkReadBuffer &buffer)
int SafeCount(const T *obj)
static sk_sp< SkDrawable > create_drawable_from_buffer(SkReadBuffer &buffer)
static size_t compute_chunk_size(SkFlattenable::Factory *array, int count)
#define SK_PICT_PICTURE_TAG
#define SK_PICT_TEXTBLOB_BUFFER_TAG
#define SK_PICT_PATH_BUFFER_TAG
#define SK_PICT_FACTORY_TAG
#define SK_PICT_IMAGE_BUFFER_TAG
#define SK_PICT_VERTICES_BUFFER_TAG
#define SK_PICT_BUFFER_SIZE_TAG
#define SK_PICT_SLUG_BUFFER_TAG
#define SK_PICT_DRAWABLE_TAG
#define SK_PICT_PAINT_BUFFER_TAG
#define SK_PICT_READER_TAG
#define SK_PICT_TYPEFACE_TAG
sk_sp< T > sk_ref_sp(T *obj)
bool StreamRemainingLengthIsBelow(SkStream *stream, size_t len)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr int SkToInt(S x)
constexpr uint32_t SkToU32(S x)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
const uint8_t * bytes() const
static sk_sp< SkData > MakeUninitialized(size_t length)
static sk_sp< SkData > MakeFromStream(SkStream *, size_t size)
sk_sp< SkFlattenable >(* Factory)(SkReadBuffer &)
static const char * FactoryToName(Factory)
static Factory NameToFactory(const char name[])
bool parseBuffer(SkReadBuffer &buffer)
static SkPictureData * CreateFromStream(SkStream *, const SkPictInfo &, const SkDeserialProcs &, SkTypefacePlayback *, int recursionLimit)
static SkPictureData * CreateFromBuffer(SkReadBuffer &, const SkPictInfo &)
bool parseStream(SkStream *, const SkDeserialProcs &, SkTypefacePlayback *, int recursionLimit)
const SkPaint * optionalPaint(SkReadBuffer *reader) const
const SkPaint & requiredPaint(SkReadBuffer *reader) const
void flatten(SkWriteBuffer &) const
SkPictureData(const SkPictureRecord &record, const SkPictInfo &)
void serialize(SkWStream *, const SkSerialProcs &, SkRefCntSet *, bool textBlobsOnly=false) const
const SkPictInfo & info() const
static void Flatten(const sk_sp< const SkPicture >, SkWriteBuffer &buffer)
static sk_sp< SkPicture > MakeFromBuffer(SkReadBuffer &buffer)
sk_sp< SkData > opData() const
bool validate(bool isValid)
const char * data() const
const char * c_str() const
void copyToArray(T *array) const
static void Flatten(const SkTextBlob &, SkWriteBuffer &)
static sk_sp< SkTextBlob > MakeFromBuffer(SkReadBuffer &)
void setupBuffer(SkReadBuffer &buffer) const
void setCount(size_t count)
void serialize(SkWStream *, SerializeBehavior=SerializeBehavior::kIncludeDataIfLocal) const
static sk_sp< SkTypeface > MakeDeserialize(SkStream *, sk_sp< SkFontMgr > lastResortMgr)
static sk_sp< SkTypeface > MakeEmpty()
static sk_sp< SkVertices > Decode(SkReadBuffer &)
static int SizeOfPackedUInt(size_t value)
void reserve_exact(int n)
static sk_sp< Slug > MakeFromBuffer(SkReadBuffer &buffer)
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
DEF_SWITCHES_START aot vmservice shared library name
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
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
void write(SkWStream *wStream, const T &text)
SkDeserialTypefaceProc fTypefaceProc
uint32_t getVersion() const
SkSerialTypefaceProc fTypefaceProc
std::shared_ptr< const fml::Mapping > data