45SkPicture::SkPicture() {
46 static std::atomic<uint32_t> nextID{1};
48 fUniqueID = nextID.fetch_add(+1, std::memory_order_relaxed);
49 }
while (fUniqueID == 0);
53 if (fAddedToCache.load()) {
58static const char kMagic[] = {
's',
'k',
'i',
'a',
'p',
'i',
'c',
't' };
63 static_assert(
sizeof(
kMagic) == 8,
"");
64 static_assert(
sizeof(
kMagic) ==
sizeof(
info.fMagic),
"");
98 if (!
stream->readScalar(&
info.fCullRect.fLeft )) {
return false; }
99 if (!
stream->readScalar(&
info.fCullRect.fTop )) {
return false; }
100 if (!
stream->readScalar(&
info.fCullRect.fRight )) {
return false; }
101 if (!
stream->readScalar(&
info.fCullRect.fBottom)) {
return false; }
106 return IsValidPictInfo(
info);
110 return SkPicture::StreamIsSKP(
stream, pInfo);
123 if (IsValidPictInfo(
info)) {
124 if (pInfo) { *pInfo =
info; }
136 if (!
data->opData()) {
170 if (recursionLimit <= 0) {
183 uint8_t trailingStreamByteAfterPictInfo;
184 if (!
stream->readU8(&trailingStreamByteAfterPictInfo)) {
return nullptr; }
185 switch (trailingStreamByteAfterPictInfo) {
187 std::unique_ptr<SkPictureData>
data(
190 return Forwardport(
info,
data.get(),
nullptr);
215 if (!SkPicture::BufferIsSKP(&
buffer, &
info)) {
219 int32_t ssize =
buffer.read32();
239 rec.beginRecording();
251 this->
serialize(&stream, procs,
nullptr);
252 return stream.detachAsData();
260 if (!SkTFitsIn<int32_t>(
size) ||
size <= 1) {
284 SkRefCntSet* typefaceSet,
bool textBlobsOnly)
const {
305 std::unique_ptr<SkPictureData>
data(this->backport());
308 data->serialize(
stream, procs, typefaceSet, textBlobsOnly);
316 std::unique_ptr<SkPictureData>
data(
picture->backport());
339 explicit Placeholder(
SkRect cull) : fCull(cull) {}
353 return sk_make_sp<Placeholder>(cull);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
constexpr int kMaxPictureOpsToUnrollInsteadOfRef
static size_t sk_negate_to_size_t(int32_t value)
static bool write_pad32(SkWStream *stream, const void *data, size_t size)
bool SkPicture_StreamIsSKP(SkStream *stream, SkPictInfo *pInfo)
@ kCustom_TrailingStreamByteAfterPictInfo
@ kFailure_TrailingStreamByteAfterPictInfo
@ kPictureData_TrailingStreamByteAfterPictInfo
static sk_sp< SkData > custom_serialize(const SkPicture *picture, const SkSerialProcs &procs)
static const int kNestedSKPLimit
static const char kMagic[]
bool StreamRemainingLengthIsBelow(SkStream *stream, size_t len)
constexpr int32_t SkToS32(S x)
static sk_sp< SkData > MakeUninitialized(size_t length)
static sk_sp< SkData > MakeEmpty()
static SkPictureData * CreateFromStream(SkStream *, const SkPictInfo &, const SkDeserialProcs &, SkTypefacePlayback *, int recursionLimit)
static SkPictureData * CreateFromBuffer(SkReadBuffer &, const SkPictInfo &)
static uint64_t MakeSharedID(uint32_t pictureID)
static void Flatten(const sk_sp< const SkPicture >, SkWriteBuffer &buffer)
static sk_sp< SkPicture > MakeFromBuffer(SkReadBuffer &buffer)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
friend class SkPictureData
sk_sp< SkData > serialize(const SkSerialProcs *procs=nullptr) const
virtual SkRect cullRect() const =0
static sk_sp< SkPicture > MakeFromData(const SkData *data, const SkDeserialProcs *procs=nullptr)
virtual void playback(SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
virtual size_t approximateBytesUsed() const =0
static sk_sp< SkPicture > MakePlaceholder(SkRect cull)
static sk_sp< SkPicture > MakeFromStream(SkStream *stream, const SkDeserialProcs *procs=nullptr)
virtual int approximateOpCount(bool nested=false) const =0
static void PostPurgeSharedID(uint64_t sharedID)
sk_sp< const SkPicture > picture
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
SkDeserialPictureProc fPictureProc
SkSerialPictureProc fPictureProc
std::shared_ptr< const fml::Mapping > data