Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
sktext::GlyphRunList Class Reference

#include <GlyphRun.h>

Public Member Functions

 GlyphRunList (const SkTextBlob *blob, SkRect bounds, SkPoint origin, SkSpan< const GlyphRun > glyphRunList, GlyphRunBuilder *builder)
 
 GlyphRunList (const GlyphRun &glyphRun, const SkRect &bounds, SkPoint origin, GlyphRunBuilder *builder)
 
uint64_t uniqueID () const
 
bool anyRunsLCD () const
 
void temporaryShuntBlobNotifyAddedToCache (uint32_t cacheID, SkTextBlob::PurgeDelegate) const
 
bool canCache () const
 
size_t runCount () const
 
size_t totalGlyphCount () const
 
size_t maxGlyphRunSize () const
 
bool hasRSXForm () const
 
sk_sp< SkTextBlobmakeBlob () const
 
SkPoint origin () const
 
SkRect sourceBounds () const
 
SkRect sourceBoundsWithOrigin () const
 
const SkTextBlobblob () const
 
GlyphRunBuilderbuilder () const
 
auto begin () -> decltype(fGlyphRuns.begin())
 
auto end () -> decltype(fGlyphRuns.end())
 
auto begin () const -> decltype(std::cbegin(fGlyphRuns))
 
auto end () const -> decltype(std::cend(fGlyphRuns))
 
auto size () const -> decltype(fGlyphRuns.size())
 
auto empty () const -> decltype(fGlyphRuns.empty())
 
auto operator[] (size_t i) const -> decltype(fGlyphRuns[i])
 

Detailed Description

Definition at line 69 of file GlyphRun.h.

Constructor & Destructor Documentation

◆ GlyphRunList() [1/2]

sktext::GlyphRunList::GlyphRunList ( const SkTextBlob blob,
SkRect  bounds,
SkPoint  origin,
SkSpan< const GlyphRun glyphRunList,
GlyphRunBuilder builder 
)

Definition at line 46 of file GlyphRun.cpp.

51 : fGlyphRuns{glyphRunList}
52 , fOriginalTextBlob{blob}
53 , fSourceBounds{bounds}
54 , fOrigin{origin}
55 , fBuilder{builder} {}
const SkTextBlob * blob() const
Definition: GlyphRun.h:117
SkPoint origin() const
Definition: GlyphRun.h:114
GlyphRunBuilder * builder() const
Definition: GlyphRun.h:118
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ GlyphRunList() [2/2]

sktext::GlyphRunList::GlyphRunList ( const GlyphRun glyphRun,
const SkRect bounds,
SkPoint  origin,
GlyphRunBuilder builder 
)

Definition at line 57 of file GlyphRun.cpp.

61 : fGlyphRuns{SkSpan<const GlyphRun>{&glyphRun, 1}}
62 , fOriginalTextBlob{nullptr}
63 , fSourceBounds{bounds}
64 , fOrigin{origin}
65 , fBuilder{builder} {}

Member Function Documentation

◆ anyRunsLCD()

bool sktext::GlyphRunList::anyRunsLCD ( ) const

Definition at line 72 of file GlyphRun.cpp.

72 {
73 for (const auto& r : fGlyphRuns) {
74 if (r.font().getEdging() == SkFont::Edging::kSubpixelAntiAlias) {
75 return true;
76 }
77 }
78 return false;
79}
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency

◆ begin() [1/2]

auto sktext::GlyphRunList::begin ( ) -> decltype(fGlyphRuns.begin())
inline

Definition at line 120 of file GlyphRun.h.

120{ return fGlyphRuns.begin(); }

◆ begin() [2/2]

auto sktext::GlyphRunList::begin ( ) const -> decltype(std::cbegin(fGlyphRuns))
inline

Definition at line 122 of file GlyphRun.h.

122{ return std::cbegin(fGlyphRuns); }

◆ blob()

const SkTextBlob * sktext::GlyphRunList::blob ( ) const
inline

Definition at line 117 of file GlyphRun.h.

117{ return fOriginalTextBlob; }

◆ builder()

GlyphRunBuilder * sktext::GlyphRunList::builder ( ) const
inline

Definition at line 118 of file GlyphRun.h.

118{ return fBuilder; }

◆ canCache()

bool sktext::GlyphRunList::canCache ( ) const
inline

Definition at line 88 of file GlyphRun.h.

88{ return fOriginalTextBlob != nullptr; }

◆ empty()

auto sktext::GlyphRunList::empty ( ) const -> decltype(fGlyphRuns.empty())
inline

Definition at line 125 of file GlyphRun.h.

125{ return fGlyphRuns.empty(); }

◆ end() [1/2]

auto sktext::GlyphRunList::end ( ) -> decltype(fGlyphRuns.end())
inline

Definition at line 121 of file GlyphRun.h.

121{ return fGlyphRuns.end(); }

◆ end() [2/2]

auto sktext::GlyphRunList::end ( ) const -> decltype(std::cend(fGlyphRuns))
inline

Definition at line 123 of file GlyphRun.h.

123{ return std::cend(fGlyphRuns); }

◆ hasRSXForm()

bool sktext::GlyphRunList::hasRSXForm ( ) const
inline

Definition at line 105 of file GlyphRun.h.

105 {
106 for (const GlyphRun& run : *this) {
107 if (!run.scaledRotations().empty()) { return true; }
108 }
109 return false;
110 }
Definition: run.py:1

◆ makeBlob()

sk_sp< SkTextBlob > sktext::GlyphRunList::makeBlob ( ) const

Definition at line 88 of file GlyphRun.cpp.

88 {
90 for (auto& run : *this) {
92 if (run.scaledRotations().empty()) {
93 if (run.text().empty()) {
94 buffer = builder.allocRunPos(run.font(), run.runSize(), nullptr);
95 } else {
96 buffer = builder.allocRunTextPos(run.font(), run.runSize(), run.text().size(), nullptr);
97 auto text = run.text();
98 memcpy(buffer.utf8text, text.data(), text.size_bytes());
99 auto clusters = run.clusters();
100 memcpy(buffer.clusters, clusters.data(), clusters.size_bytes());
101 }
102 auto positions = run.positions();
103 memcpy(buffer.points(), positions.data(), positions.size_bytes());
104 } else {
105 buffer = builder.allocRunRSXform(run.font(), run.runSize());
106 for (auto [xform, pos, sr] : SkMakeZip(buffer.xforms(),
107 run.positions(),
108 run.scaledRotations())) {
109 xform = SkRSXform::Make(sr.x(), sr.y(), pos.x(), pos.y());
110 }
111 }
112 auto glyphIDs = run.glyphsIDs();
113 memcpy(buffer.glyphs, glyphIDs.data(), glyphIDs.size_bytes());
114 }
115 return builder.make();
116}
SkPoint pos
constexpr auto SkMakeZip(Ts &&... ts)
Definition: SkZip.h:212
std::u16string text
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
constexpr float y() const
Definition: SkPoint_impl.h:187
constexpr float x() const
Definition: SkPoint_impl.h:181
static SkRSXform Make(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty)
Definition: SkRSXform.h:24

◆ maxGlyphRunSize()

size_t sktext::GlyphRunList::maxGlyphRunSize ( ) const
inline

Definition at line 97 of file GlyphRun.h.

97 {
98 size_t size = 0;
99 for (const GlyphRun& run : *this) {
100 size = std::max(run.runSize(), size);
101 }
102 return size;
103 }
auto size() const -> decltype(fGlyphRuns.size())
Definition: GlyphRun.h:124
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ operator[]()

auto sktext::GlyphRunList::operator[] ( size_t  i) const -> decltype(fGlyphRuns[i])
inline

Definition at line 126 of file GlyphRun.h.

126{ return fGlyphRuns[i]; }

◆ origin()

SkPoint sktext::GlyphRunList::origin ( ) const
inline

Definition at line 114 of file GlyphRun.h.

114{ return fOrigin; }

◆ runCount()

size_t sktext::GlyphRunList::runCount ( ) const
inline

Definition at line 89 of file GlyphRun.h.

89{ return fGlyphRuns.size(); }

◆ size()

auto sktext::GlyphRunList::size ( ) const -> decltype(fGlyphRuns.size())
inline

Definition at line 124 of file GlyphRun.h.

124{ return fGlyphRuns.size(); }

◆ sourceBounds()

SkRect sktext::GlyphRunList::sourceBounds ( ) const
inline

Definition at line 115 of file GlyphRun.h.

115{ return fSourceBounds; }

◆ sourceBoundsWithOrigin()

SkRect sktext::GlyphRunList::sourceBoundsWithOrigin ( ) const
inline

Definition at line 116 of file GlyphRun.h.

116{ return fSourceBounds.makeOffset(fOrigin); }
constexpr SkRect makeOffset(float dx, float dy) const
Definition: SkRect.h:965

◆ temporaryShuntBlobNotifyAddedToCache()

void sktext::GlyphRunList::temporaryShuntBlobNotifyAddedToCache ( uint32_t  cacheID,
SkTextBlob::PurgeDelegate  pd 
) const

Definition at line 81 of file GlyphRun.cpp.

82 {
83 SkASSERT(fOriginalTextBlob != nullptr);
84 SkASSERT(pd != nullptr);
85 fOriginalTextBlob->notifyAddedToCache(cacheID, pd);
86}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ totalGlyphCount()

size_t sktext::GlyphRunList::totalGlyphCount ( ) const
inline

Definition at line 90 of file GlyphRun.h.

90 {
91 size_t glyphCount = 0;
92 for (const GlyphRun& run : *this) {
93 glyphCount += run.runSize();
94 }
95 return glyphCount;
96 }

◆ uniqueID()

uint64_t sktext::GlyphRunList::uniqueID ( ) const

Definition at line 67 of file GlyphRun.cpp.

67 {
68 return fOriginalTextBlob != nullptr ? fOriginalTextBlob->uniqueID()
70}
static constexpr uint32_t SK_InvalidUniqueID
Definition: SkTypes.h:196
uint32_t uniqueID() const
Definition: SkTextBlob.h:59

The documentation for this class was generated from the following files: