Flutter Engine
The Flutter Engine
Slug.h
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
8#ifndef sktext_gpu_Slug_DEFINED
9#define sktext_gpu_Slug_DEFINED
10
11#include "include/core/SkRect.h"
14
15#include <cstddef>
16#include <cstdint>
17
18class SkCanvas;
19class SkData;
20class SkPaint;
21class SkReadBuffer;
22class SkStrikeClient;
23class SkTextBlob;
24class SkWriteBuffer;
25struct SkDeserialProcs;
26struct SkPoint;
27
28namespace sktext::gpu {
29// Slug encapsulates an SkTextBlob at a specific origin, using a specific paint. It can be
30// manipulated using matrix and clip changes to the canvas. If the canvas is transformed, then
31// the Slug will also transform with smaller glyphs using bi-linear interpolation to render. You
32// can think of a Slug as making a rubber stamp out of a SkTextBlob.
33class SK_API Slug : public SkRefCnt {
34public:
35 // Return nullptr if the blob would not draw. This is not because of clipping, but because of
36 // some paint optimization. The Slug is captured as if drawn using drawTextBlob.
37 static sk_sp<Slug> ConvertBlob(
38 SkCanvas* canvas, const SkTextBlob& blob, SkPoint origin, const SkPaint& paint);
39
40 // Serialize the slug.
41 sk_sp<SkData> serialize() const;
42 size_t serialize(void* buffer, size_t size) const;
43
44 // Set the client parameter to the appropriate SkStrikeClient when typeface ID translation
45 // is needed.
46 static sk_sp<Slug> Deserialize(const void* data,
47 size_t size,
48 const SkStrikeClient* client = nullptr);
49 static sk_sp<Slug> MakeFromBuffer(SkReadBuffer& buffer);
50
51 // Allows clients to deserialize SkPictures that contain slug data
52 static void AddDeserialProcs(SkDeserialProcs* procs, const SkStrikeClient* client = nullptr);
53
54 // Draw the Slug obeying the canvas's mapping and clipping.
55 void draw(SkCanvas* canvas, const SkPaint& paint) const;
56
57 virtual SkRect sourceBounds() const = 0;
58 virtual SkRect sourceBoundsWithOrigin () const = 0;
59
60 virtual void doFlatten(SkWriteBuffer&) const = 0;
61
62 uint32_t uniqueID() const { return fUniqueID; }
63
64private:
65 static uint32_t NextUniqueID();
66 const uint32_t fUniqueID{NextUniqueID()};
67};
68
69
70} // namespace sktext::gpu
71
72#endif // sktext_gpu_Slug_DEFINED
#define SK_API
Definition: SkAPI.h:35
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
Definition: SkData.h:25
virtual void doFlatten(SkWriteBuffer &) const =0
virtual SkRect sourceBounds() const =0
uint32_t uniqueID() const
Definition: Slug.h:62
virtual SkRect sourceBoundsWithOrigin() const =0
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