Flutter Engine
The Flutter Engine
Slug.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
15
16class SkData;
17
18namespace sktext::gpu {
19
21 SkCanvas* canvas, const SkTextBlob& blob, SkPoint origin, const SkPaint& paint) {
22 return canvas->convertBlobToSlug(blob, origin, paint);
23}
24
27 this->doFlatten(buffer);
28 return buffer.snapshotAsData();
29}
30
31size_t Slug::serialize(void* buffer, size_t size) const {
32 SkBinaryWriteBuffer writeBuffer{buffer, size, {}};
33 this->doFlatten(writeBuffer);
34
35 // If we overflow the given buffer, then SkWriteBuffer allocates a new larger buffer. Check
36 // to see if an additional buffer was allocated, if it wasn't then everything fit, else
37 // return 0 signaling the buffer overflowed.
38 // N.B. This is the idiom from SkTextBlob.
39 return writeBuffer.usingInitialStorage() ? writeBuffer.bytesWritten() : 0u;
40}
41
42sk_sp<Slug> Slug::Deserialize(const void* data, size_t size, const SkStrikeClient* client) {
44 SkDeserialProcs procs;
45 Slug::AddDeserialProcs(&procs, client);
46 buffer.setDeserialProcs(procs);
47 return MakeFromBuffer(buffer);
48}
49
50void Slug::draw(SkCanvas* canvas, const SkPaint& paint) const {
51 canvas->drawSlug(this, paint);
52}
53
54} // namespace sktext::gpu
55
Definition: SkData.h:25
static sk_sp< Slug > ConvertBlob(SkCanvas *canvas, const SkTextBlob &blob, SkPoint origin, const SkPaint &paint)
Definition: Slug.cpp:20
static void AddDeserialProcs(SkDeserialProcs *procs, const SkStrikeClient *client=nullptr)
Definition: SlugImpl.cpp:106
static sk_sp< Slug > MakeFromBuffer(SkReadBuffer &buffer)
void draw(SkCanvas *canvas, const SkPaint &paint) const
Definition: Slug.cpp:50
sk_sp< SkData > serialize() const
Definition: Slug.cpp:25
virtual void doFlatten(SkWriteBuffer &) const =0
static sk_sp< Slug > Deserialize(const void *data, size_t size, const SkStrikeClient *client=nullptr)
Definition: Slug.cpp:42
const Paint & paint
Definition: color_source.cc:38
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
Definition: switches.h:126
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
Definition: switches.h:259
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63