49static constexpr char kMagic[] =
"Skia Multi-Picture Doc\n\n";
51static constexpr char kEndPage[] =
"SkMultiPictureEndPage";
53const uint32_t kVersion = 2;
63struct MultiPictureDocument final :
public SkDocument {
75 , fOnEndPage(
std::move(onEndPage)) {}
77 ~MultiPictureDocument()
override { this->
close(); }
80 fCurrentPageSize.
set(
w,
h);
88 fOnEndPage(lastPage.
get());
108 p->serialize(wStream, &fProcs);
134 if (0 == strcmp(
key, kEndPage)) {
153 return sk_make_sp<MultiPictureDocument>(
dst, procs, std::move(onEndPage));
167 uint32_t versionNumber;
168 if (!
src->readU32(&versionNumber) || versionNumber != kVersion) {
172 if (!
src->readU32(&pageCount) || pageCount > INT_MAX) {
176 return SkTo<int>(pageCount);
182 if (!dstArray || dstArrayCount < 1) {
186 if (pageCount < 1 || pageCount != dstArrayCount) {
189 for (
int i = 0;
i < pageCount; ++
i) {
191 if (
sizeof(
s) !=
stream->read(&
s,
sizeof(
s))) {
206 SkSize joined = {0.0f, 0.0f};
207 for (
int i = 0;
i < dstArrayCount; ++
i) {
217 PagerCanvas canvas(joined.
toCeil(), dstArray, dstArrayCount);
221 if (canvas.fIndex != dstArrayCount) {
222 SkDEBUGF(
"Malformed SkMultiPictureDocument: canvas.fIndex=%d dstArrayCount=%d\n",
223 canvas.fIndex, dstArrayCount);
static const char kMagic[]
constexpr uint32_t SkToU32(S x)
void drawAnnotation(const SkRect &rect, const char key[], SkData *value)
void drawPicture(const SkPicture *picture)
static sk_sp< SkData > MakeWithCString(const char cstr[])
virtual void onClose(SkWStream *)=0
virtual SkCanvas * onBeginPage(SkScalar width, SkScalar height)=0
virtual void onEndPage()=0
virtual void addCanvas(SkCanvas *)
void onDrawAnnotation(const SkRect &, const char[], SkData *) override
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
virtual void playback(SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
static sk_sp< SkPicture > MakeFromStream(SkStream *stream, const SkDeserialProcs *procs=nullptr)
virtual bool write(const void *buffer, size_t size)=0
virtual size_t bytesWritten() const =0
bool writeText(const char text[])
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Dart_NativeFunction function
static float max(float r, float g, float b)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
SK_API bool Read(SkStreamSeekable *src, SkDocumentPage *dstArray, int dstArrayCount, const SkDeserialProcs *=nullptr)
SK_API int ReadPageCount(SkStreamSeekable *src)
bool ReadPageSizes(SkStreamSeekable *stream, SkDocumentPage *dstArray, int dstArrayCount)
Optional< SkRect > bounds
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
static SkString join(const CommandLineFlags::StringArray &)
static constexpr SkRect MakeEmpty()
static constexpr SkRect MakeSize(const SkSize &size)
void set(SkScalar w, SkScalar h)