8#ifndef SkStream_DEFINED
9#define SkStream_DEFINED
37 static std::unique_ptr<SkStreamAsset> MakeFromFile(
const char path[]);
52 return this->
read(
nullptr, size);
68 virtual size_t peek(
void* ,
size_t )
const {
return 0; }
79 [[nodiscard]]
bool readS8(int8_t*);
80 [[nodiscard]]
bool readS16(int16_t*);
81 [[nodiscard]]
bool readS32(int32_t*);
83 [[nodiscard]]
bool readU8(uint8_t*
i) {
return this->readS8((int8_t*)
i); }
84 [[nodiscard]]
bool readU16(uint16_t*
i) {
return this->readS16((int16_t*)
i); }
85 [[nodiscard]]
bool readU32(uint32_t*
i) {
return this->readS32((int32_t*)
i); }
89 if (!this->readU8(&
i)) {
return false; }
93 [[nodiscard]]
bool readScalar(
SkScalar*);
94 [[nodiscard]]
bool readPackedUInt(
size_t*);
106 return std::unique_ptr<SkStream>(this->onDuplicate());
111 std::unique_ptr<SkStream>
fork()
const {
112 return std::unique_ptr<SkStream>(this->onFork());
125 virtual bool seek(
size_t ) {
return false; }
131 virtual bool move(
long ) {
return false; }
159 return std::unique_ptr<SkStreamRewindable>(this->onDuplicate());
169 return std::unique_ptr<SkStreamSeekable>(this->onDuplicate());
174 bool seek(
size_t position)
override = 0;
177 std::unique_ptr<SkStreamSeekable>
fork()
const {
178 return std::unique_ptr<SkStreamSeekable>(this->onFork());
192 return std::unique_ptr<SkStreamAsset>(this->onDuplicate());
194 std::unique_ptr<SkStreamAsset>
fork()
const {
195 return std::unique_ptr<SkStreamAsset>(this->onFork());
208 return std::unique_ptr<SkStreamMemory>(this->onDuplicate());
210 std::unique_ptr<SkStreamMemory>
fork()
const {
211 return std::unique_ptr<SkStreamMemory>(this->onFork());
229 virtual void flush();
237 return this->
write(&v, 1);
241 return this->
write(&v, 2);
244 return this->
write(&v, 4);
249 return this->
write(text, std::strlen(
text));
254 bool writeDecAsText(int32_t);
255 bool writeBigDecAsText(int64_t,
int minDigits = 0);
256 bool writeHexAsText(uint32_t,
int minDigits = 0);
261 bool writePackedUInt(
size_t);
269 static int SizeOfPackedUInt(
size_t value);
280 bool write(
const void* ,
size_t n)
override { fBytesWritten += n;
return true; }
285 size_t fBytesWritten;
314 static std::unique_ptr<SkFILEStream>
Make(
const char path[]) {
320 bool isValid()
const {
return fFILE !=
nullptr; }
326 bool isAtEnd()
const override;
330 return std::unique_ptr<SkStreamAsset>(this->onDuplicate());
333 size_t getPosition()
const override;
334 bool seek(
size_t position)
override;
335 bool move(
long offset)
override;
337 std::unique_ptr<SkStreamAsset>
fork()
const {
338 return std::unique_ptr<SkStreamAsset>(this->onFork());
341 size_t getLength()
const override;
351 std::shared_ptr<FILE> fFILE;
375 static std::unique_ptr<SkMemoryStream> MakeCopy(
const void*
data,
size_t length);
378 static std::unique_ptr<SkMemoryStream> MakeDirect(
const void*
data,
size_t length);
387 virtual void setMemory(
const void*
data,
size_t length,
388 bool copyData =
false);
393 void setMemoryOwned(
const void*
data,
size_t length);
398 const void* getAtPos();
401 bool isAtEnd()
const override;
403 size_t peek(
void*
buffer,
size_t size)
const override;
408 return std::unique_ptr<SkMemoryStream>(this->onDuplicate());
411 size_t getPosition()
const override;
412 bool seek(
size_t position)
override;
413 bool move(
long offset)
override;
415 std::unique_ptr<SkMemoryStream>
fork()
const {
416 return std::unique_ptr<SkMemoryStream>(this->onFork());
419 size_t getLength()
const override;
421 const void* getMemoryBase()
override;
442 bool isValid()
const {
return fFILE !=
nullptr; }
445 void flush()
override;
447 size_t bytesWritten()
const override;
463 size_t bytesWritten()
const override;
468 void copyTo(
void*
dst)
const;
472 void copyToAndReset(
void*
dst);
488 std::unique_ptr<SkStreamAsset> detachAsStream();
495 Block* fHead =
nullptr;
496 Block* fTail =
nullptr;
497 size_t fBytesWrittenBeforeTail = 0;
500 void validate()
const;
502 void validate()
const {}
static bool rewind(EdgeList *activeEdges, Vertex **current, Vertex *dst, const Comparator &c)
static bool read(SkStream *stream, void *buffer, size_t amount)
#define INHERITED(method,...)
constexpr uint16_t SkToU16(S x)
constexpr uint8_t SkToU8(S x)
SkDynamicMemoryWStream()=default
std::unique_ptr< SkStreamAsset > duplicate() const
static std::unique_ptr< SkFILEStream > Make(const char path[])
std::unique_ptr< SkStreamAsset > fork() const
sk_sp< SkData > getData() const override
std::unique_ptr< SkMemoryStream > fork() const
std::unique_ptr< SkMemoryStream > duplicate() const
size_t bytesWritten() const override
bool write(const void *, size_t n) override
std::unique_ptr< SkStreamAsset > duplicate() const
bool hasLength() const override
size_t getLength() const override=0
SkStreamAsset * onFork() const override=0
SkStreamAsset * onDuplicate() const override=0
std::unique_ptr< SkStreamAsset > fork() const
SkStreamMemory * onDuplicate() const override=0
std::unique_ptr< SkStreamMemory > duplicate() const
SkStreamMemory * onFork() const override=0
std::unique_ptr< SkStreamMemory > fork() const
const void * getMemoryBase() override=0
std::unique_ptr< SkStreamRewindable > duplicate() const
SkStreamRewindable * onDuplicate() const override=0
std::unique_ptr< SkStreamSeekable > duplicate() const
std::unique_ptr< SkStreamSeekable > fork() const
size_t getPosition() const override=0
SkStreamSeekable * onFork() const override=0
bool move(long offset) override=0
bool hasPosition() const override
bool seek(size_t position) override=0
SkStreamSeekable * onDuplicate() const override=0
virtual sk_sp< SkData > getData() const
virtual SkStream * onFork() const
std::unique_ptr< SkStream > duplicate() const
virtual SkStream * onDuplicate() const
virtual size_t peek(void *, size_t) const
virtual bool hasPosition() const
virtual size_t getPosition() const
std::unique_ptr< SkStream > fork() const
bool readU16(uint16_t *i)
bool readU32(uint32_t *i)
virtual bool isAtEnd() const =0
virtual bool seek(size_t)
virtual size_t getLength() const
virtual const void * getMemoryBase()
virtual bool hasLength() const
virtual size_t read(void *buffer, size_t size)=0
virtual bool write(const void *buffer, size_t size)=0
bool write16(U16CPU value)
virtual size_t bytesWritten() const =0
bool writeText(const char text[])
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
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 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)
std::shared_ptr< const fml::Mapping > data