26template <
typename T>
void* skia_alloc_func(
void*,
T items,
T size) {
30void skia_free_func(
void*,
void* address) {
sk_free(address); }
34#define SKDEFLATEWSTREAM_INPUT_BUFFER_SIZE 4096
35#define SKDEFLATEWSTREAM_OUTPUT_BUFFER_SIZE 4224
43 unsigned char* inBuffer,
44 size_t inBufferSize) {
45 zStream->next_in = inBuffer;
46 zStream->avail_in =
SkToInt(inBufferSize);
50 zStream->next_out = outBuffer;
51 zStream->avail_out =
sizeof(outBuffer);
55 out->write(outBuffer,
sizeof(outBuffer) - zStream->avail_out);
56 }
while (zStream->avail_in || !zStream->avail_out);
58 ? returnValue == Z_STREAM_END
59 : returnValue == Z_OK);
82 fImpl->fInBufferIndex = 0;
86 fImpl->fZStream.next_in =
nullptr;
87 fImpl->fZStream.zalloc = &skia_alloc_func;
88 fImpl->fZStream.zfree = &skia_free_func;
89 fImpl->fZStream.opaque =
nullptr;
90 SkASSERT(compressionLevel <= 9 && compressionLevel >= -1);
91 SkDEBUGCODE(
int r =) deflateInit2(&fImpl->fZStream, compressionLevel,
92 Z_DEFLATED, gzip ? 0x1F : 0x0F,
93 8, Z_DEFAULT_STRATEGY);
104 do_deflate(Z_FINISH, &fImpl->fZStream, fImpl->fOut, fImpl->fInBuffer,
105 fImpl->fInBufferIndex);
106 (void)deflateEnd(&fImpl->fZStream);
107 fImpl->fOut =
nullptr;
115 const char*
buffer = (
const char*)void_buffer;
118 std::min(
len,
sizeof(fImpl->fInBuffer) - fImpl->fInBufferIndex);
119 memcpy(fImpl->fInBuffer + fImpl->fInBufferIndex,
buffer, tocopy);
122 fImpl->fInBufferIndex += tocopy;
123 SkASSERT(fImpl->fInBufferIndex <=
sizeof(fImpl->fInBuffer));
126 if (
sizeof(fImpl->fInBuffer) == fImpl->fInBufferIndex) {
127 do_deflate(Z_NO_FLUSH, &fImpl->fZStream, fImpl->fOut,
128 fImpl->fInBuffer, fImpl->fInBufferIndex);
129 fImpl->fInBufferIndex = 0;
136 return fImpl->fZStream.total_in + fImpl->fInBufferIndex;
#define SKDEFLATEWSTREAM_INPUT_BUFFER_SIZE
static void do_deflate(int flush, z_stream *zStream, SkWStream *out, unsigned char *inBuffer, size_t inBufferSize)
#define SKDEFLATEWSTREAM_OUTPUT_BUFFER_SIZE
static void * sk_calloc_throw(size_t size)
SK_API void sk_free(void *)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr size_t SkToSizeT(S x)
constexpr int SkToInt(S x)
bool write(const void *, size_t) override
SkDeflateWStream(SkWStream *, int compressionLevel, bool gzip=false)
~SkDeflateWStream() override
size_t bytesWritten() const override
static float min(float r, float g, float b)
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
unsigned char fInBuffer[SKDEFLATEWSTREAM_INPUT_BUFFER_SIZE]
#define TRACE_EVENT0(category_group, name)