Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Friends | List of all members
SkStrike Class Reference

#include <SkStrike.h>

Inheritance diagram for SkStrike:
sktext::StrikeForGPU SkRefCnt SkRefCntBase

Public Member Functions

 Monitor (SkStrike *strike) SK_ACQUIRE(strike -> fStrikeLock) :fStrike
 
 ~Monitor () SK_RELEASE_CAPABILITY()
 
 SkStrike (SkStrikeCache *strikeCache, const SkStrikeSpec &strikeSpec, std::unique_ptr< SkScalerContext > scaler, const SkFontMetrics *metrics, std::unique_ptr< SkStrikePinner > pinner)
 
void lock () override SK_ACQUIRE(fStrikeLock)
 
void unlock () override SK_RELEASE_CAPABILITY(fStrikeLock)
 
SkGlyphDigest digestFor (skglyph::ActionType, SkPackedGlyphID) override SK_REQUIRES(fStrikeLock)
 
bool prepareForImage (SkGlyph *glyph) override SK_REQUIRES(fStrikeLock)
 
bool prepareForPath (SkGlyph *) override SK_REQUIRES(fStrikeLock)
 
bool prepareForDrawable (SkGlyph *) override SK_REQUIRES(fStrikeLock)
 
bool mergeFromBuffer (SkReadBuffer &buffer) SK_EXCLUDES(fStrikeLock)
 
SkGlyphmergeGlyphAndImage (SkPackedGlyphID toID, const SkGlyph &fromGlyph) SK_EXCLUDES(fStrikeLock)
 
const SkPathmergePath (SkGlyph *glyph, const SkPath *path, bool hairline) SK_EXCLUDES(fStrikeLock)
 
const SkDrawablemergeDrawable (SkGlyph *glyph, sk_sp< SkDrawable > drawable) SK_EXCLUDES(fStrikeLock)
 
void findIntercepts (const SkScalar bounds[2], SkScalar scale, SkScalar xPos, SkGlyph *, SkScalar *array, int *count) SK_EXCLUDES(fStrikeLock)
 
const SkFontMetricsgetFontMetrics () const
 
SkSpan< const SkGlyph * > metrics (SkSpan< const SkGlyphID > glyphIDs, const SkGlyph *results[]) SK_EXCLUDES(fStrikeLock)
 
SkSpan< const SkGlyph * > preparePaths (SkSpan< const SkGlyphID > glyphIDs, const SkGlyph *results[]) SK_EXCLUDES(fStrikeLock)
 
SkSpan< const SkGlyph * > prepareImages (SkSpan< const SkPackedGlyphID > glyphIDs, const SkGlyph *results[]) SK_EXCLUDES(fStrikeLock)
 
SkSpan< const SkGlyph * > prepareDrawables (SkSpan< const SkGlyphID > glyphIDs, const SkGlyph *results[]) SK_EXCLUDES(fStrikeLock)
 
const SkDescriptorgetDescriptor () const override
 
const SkGlyphPositionRoundingSpecroundingSpec () const override
 
sktext::SkStrikePromise strikePromise () override
 
void glyphIDsToPaths (SkSpan< sktext::IDOrPath > idsOrPaths) SK_EXCLUDES(fStrikeLock)
 
void glyphIDsToDrawables (SkSpan< sktext::IDOrDrawable > idsOrDrawables) SK_EXCLUDES(fStrikeLock)
 
const SkStrikeSpecstrikeSpec () const
 
void verifyPinnedStrike () const
 
void dump () const SK_EXCLUDES(fStrikeLock)
 
void dumpMemoryStatistics (SkTraceMemoryDump *dump) const SK_EXCLUDES(fStrikeLock)
 
SkGlyphglyph (SkGlyphDigest) SK_REQUIRES(fStrikeLock)
 
virtual void lock ()=0
 
virtual void unlock ()=0
 
virtual SkGlyphDigest digestFor (skglyph::ActionType, SkPackedGlyphID)=0
 
virtual bool prepareForImage (SkGlyph *)=0
 
virtual bool prepareForPath (SkGlyph *)=0
 
virtual bool prepareForDrawable (SkGlyph *)=0
 
virtual const SkDescriptorgetDescriptor () const =0
 
virtual const SkGlyphPositionRoundingSpecroundingSpec () const =0
 
virtual SkStrikePromise strikePromise ()=0
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static void FlattenGlyphsByType (SkWriteBuffer &buffer, SkSpan< SkGlyph > images, SkSpan< SkGlyph > paths, SkSpan< SkGlyph > drawables)
 

Friends

class SkStrikeCache
 
class SkStrikeTestingPeer
 

Detailed Description

Definition at line 60 of file SkStrike.cpp.

Constructor & Destructor Documentation

◆ ~Monitor()

SkStrike::~Monitor ( )
inline

Definition at line 67 of file SkStrike.cpp.

67 {
68 fStrike->unlock();
69 }
void unlock() override SK_RELEASE_CAPABILITY(fStrikeLock)
Definition: SkStrike.cpp:80

◆ SkStrike()

SkStrike::SkStrike ( SkStrikeCache strikeCache,
const SkStrikeSpec strikeSpec,
std::unique_ptr< SkScalerContext scaler,
const SkFontMetrics metrics,
std::unique_ptr< SkStrikePinner pinner 
)

Definition at line 45 of file SkStrike.cpp.

50 : fFontMetrics{use_or_generate_metrics(metrics, scaler.get())}
51 , fRoundingSpec{scaler->isSubpixel(),
52 scaler->computeAxisAlignmentForHText()}
53 , fStrikeSpec{strikeSpec}
54 , fStrikeCache{strikeCache}
55 , fScalerContext{std::move(scaler)}
56 , fPinner{std::move(pinner)} {
57 SkASSERT(fScalerContext != nullptr);
58}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static SkFontMetrics use_or_generate_metrics(const SkFontMetrics *metrics, SkScalerContext *context)
Definition: SkStrike.cpp:34
SkSpan< const SkGlyph * > metrics(SkSpan< const SkGlyphID > glyphIDs, const SkGlyph *results[]) SK_EXCLUDES(fStrikeLock)
Definition: SkStrike.cpp:218
const SkStrikeSpec & strikeSpec() const
Definition: SkStrike.h:121

Member Function Documentation

◆ digestFor()

SkGlyphDigest SkStrike::digestFor ( skglyph::ActionType  actionType,
SkPackedGlyphID  packedGlyphID 
)
overridevirtual

Implements sktext::StrikeForGPU.

Definition at line 331 of file SkStrike.cpp.

331 {
332 SkGlyphDigest* digestPtr = fDigestForPackedGlyphID.find(packedGlyphID);
333 if (digestPtr != nullptr && digestPtr->actionFor(actionType) != GlyphAction::kUnset) {
334 return *digestPtr;
335 }
336
337 SkGlyph* glyph;
338 if (digestPtr != nullptr) {
339 glyph = fGlyphForIndex[digestPtr->index()];
340 } else {
341 glyph = fAlloc.make<SkGlyph>(fScalerContext->makeGlyph(packedGlyphID, &fAlloc));
342 fMemoryIncrease += sizeof(SkGlyph);
343 digestPtr = this->addGlyphAndDigest(glyph);
344 }
345
346 digestPtr->setActionFor(actionType, glyph, this);
347
348 return *digestPtr;
349}
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
Definition: SkArenaAlloc.h:120
void setActionFor(skglyph::ActionType, SkGlyph *, sktext::StrikeForGPU *)
Definition: SkGlyph.cpp:634
int index() const
Definition: SkGlyph.h:338
skglyph::GlyphAction actionFor(skglyph::ActionType actionType) const
Definition: SkGlyph.h:343
SkGlyph * glyph(SkGlyphDigest) SK_REQUIRES(fStrikeLock)
Definition: SkStrike.cpp:322

◆ dump()

void SkStrike::dump ( ) const

Definition at line 277 of file SkStrike.cpp.

277 {
278 SkAutoMutexExclusive lock{fStrikeLock};
279 const SkTypeface* face = fScalerContext->getTypeface();
280 const SkScalerContextRec& rec = fScalerContext->getRec();
285 face->getFamilyName(&name);
286
287 SkString msg;
288 SkFontStyle style = face->fontStyle();
289 msg.printf("cache typeface:%x %25s:(%d,%d,%d)\n %s glyphs:%3d",
290 face->uniqueID(), name.c_str(), style.weight(), style.width(), style.slant(),
291 rec.dump().c_str(), fDigestForPackedGlyphID.count());
292 SkDebugf("%s\n", msg.c_str());
293}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define SkScalarInvert(x)
Definition: SkScalar.h:73
Slant slant() const
Definition: SkFontStyle.h:64
int width() const
Definition: SkFontStyle.h:63
int weight() const
Definition: SkFontStyle.h:62
void lock() override SK_ACQUIRE(fStrikeLock)
Definition: SkStrike.cpp:75
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
const char * c_str() const
Definition: SkString.h:133
SkTypefaceID uniqueID() const
Definition: SkTypeface.h:101
void getFamilyName(SkString *name) const
Definition: SkTypeface.cpp:459
SkFontStyle fontStyle() const
Definition: SkTypeface.h:55
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
void getSingleMatrix(SkMatrix *) const
SkString dump() const

◆ dumpMemoryStatistics()

void SkStrike::dumpMemoryStatistics ( SkTraceMemoryDump dump) const

Definition at line 295 of file SkStrike.cpp.

295 {
296 SkAutoMutexExclusive lock{fStrikeLock};
297 const SkTypeface* face = fScalerContext->getTypeface();
298 const SkScalerContextRec& rec = fScalerContext->getRec();
299
300 SkString fontName;
301 face->getFamilyName(&fontName);
302 // Replace all special characters with '_'.
303 for (size_t index = 0; index < fontName.size(); ++index) {
304 if (!std::isalnum(fontName[index])) {
305 fontName[index] = '_';
306 }
307 }
308
309 SkString dumpName = SkStringPrintf("%s/%s_%u/%p",
310 SkStrikeCache::kGlyphCacheDumpName,
311 fontName.c_str(),
312 rec.fTypefaceID,
313 this);
314
315 dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", fMemoryUsed);
316 dump->dumpNumericValue(dumpName.c_str(),
317 "glyph_count", "objects",
318 fDigestForPackedGlyphID.count());
319 dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr);
320}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
void dump() const SK_EXCLUDES(fStrikeLock)
Definition: SkStrike.cpp:277
size_t size() const
Definition: SkString.h:131
SkTypefaceID fTypefaceID

◆ findIntercepts()

void SkStrike::findIntercepts ( const SkScalar  bounds[2],
SkScalar  scale,
SkScalar  xPos,
SkGlyph glyph,
SkScalar array,
int count 
)

Definition at line 212 of file SkStrike.cpp.

213 {
214 SkAutoMutexExclusive lock{fStrikeLock};
215 glyph->ensureIntercepts(bounds, scale, xPos, array, count, &fAlloc);
216}
int count
Definition: FontMgrTest.cpp:50
void ensureIntercepts(const SkScalar bounds[2], SkScalar scale, SkScalar xPos, SkScalar *array, int *count, SkArenaAlloc *alloc)
Definition: SkGlyph.cpp:547
Optional< SkRect > bounds
Definition: SkRecords.h:189
const Scalar scale

◆ FlattenGlyphsByType()

void SkStrike::FlattenGlyphsByType ( SkWriteBuffer buffer,
SkSpan< SkGlyph images,
SkSpan< SkGlyph paths,
SkSpan< SkGlyph drawables 
)
static

Definition at line 87 of file SkStrike.cpp.

90 {
91 SkASSERT_RELEASE(SkTFitsIn<int>(images.size()) &&
92 SkTFitsIn<int>(paths.size()) &&
93 SkTFitsIn<int>(drawables.size()));
94
95 buffer.writeInt(images.size());
96 for (SkGlyph& glyph : images) {
100 }
101
102 buffer.writeInt(paths.size());
103 for (SkGlyph& glyph : paths) {
107 }
108
109 buffer.writeInt(drawables.size());
110 for (SkGlyph& glyph : drawables) {
114 }
115}
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
void flattenMetrics(SkWriteBuffer &) const
Definition: SkGlyph.cpp:336
SkMask::Format maskFormat() const
Definition: SkGlyph.h:500
void flattenPath(SkWriteBuffer &) const
Definition: SkGlyph.cpp:378
void flattenDrawable(SkWriteBuffer &) const
Definition: SkGlyph.cpp:414
void flattenImage(SkWriteBuffer &) const
Definition: SkGlyph.cpp:349
constexpr size_t size() const
Definition: SkSpan_impl.h:95
std::array< MockImage, 3 > images
Definition: mock_vulkan.cc:41
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
static bool IsValidFormat(uint8_t format)
Definition: SkMask.h:46

◆ getDescriptor()

const SkDescriptor & SkStrike::getDescriptor ( ) const
inlineoverridevirtual

Implements sktext::StrikeForGPU.

Definition at line 103 of file SkStrike.h.

103 {
104 return fStrikeSpec.descriptor();
105 }
const SkDescriptor & descriptor() const
Definition: SkStrikeSpec.h:96

◆ getFontMetrics()

const SkFontMetrics & SkStrike::getFontMetrics ( ) const
inline

Definition at line 86 of file SkStrike.h.

86 {
87 return fFontMetrics;
88 }

◆ glyph()

SkGlyph * SkStrike::glyph ( SkGlyphDigest  digest)

Definition at line 322 of file SkStrike.cpp.

322 {
323 return fGlyphForIndex[digest.index()];
324}

◆ glyphIDsToDrawables()

void SkStrike::glyphIDsToDrawables ( SkSpan< sktext::IDOrDrawable idsOrDrawables)

Definition at line 267 of file SkStrike.cpp.

267 {
268 Monitor m{this};
269 for (sktext::IDOrDrawable& idOrDrawable : idsOrDrawables) {
270 SkGlyph* glyph = this->glyph(SkPackedGlyphID{idOrDrawable.fGlyphID});
271 this->prepareForDrawable(glyph);
272 SkASSERT(glyph->drawable() != nullptr);
273 idOrDrawable.fDrawable = glyph->drawable();
274 }
275}
SkDrawable * drawable() const
Definition: SkGlyph.cpp:327
bool prepareForDrawable(SkGlyph *) override SK_REQUIRES(fStrikeLock)
Definition: SkStrike.cpp:373
Monitor(SkStrike *strike) SK_ACQUIRE(strike -> fStrikeLock) :fStrike
Definition: SkStrike.cpp:62

◆ glyphIDsToPaths()

void SkStrike::glyphIDsToPaths ( SkSpan< sktext::IDOrPath idsOrPaths)

Definition at line 258 of file SkStrike.cpp.

258 {
259 Monitor m{this};
260 for (sktext::IDOrPath& idOrPath : idsOrPaths) {
261 SkGlyph* glyph = this->glyph(SkPackedGlyphID{idOrPath.fGlyphID});
262 this->prepareForPath(glyph);
263 new (&idOrPath.fPath) SkPath{*glyph->path()};
264 }
265}
const SkPath * path() const
Definition: SkGlyph.cpp:284
Definition: SkPath.h:59
bool prepareForPath(SkGlyph *) override SK_REQUIRES(fStrikeLock)
Definition: SkStrike.cpp:366

◆ lock()

void SkStrike::lock ( )
overridevirtual

Implements sktext::StrikeForGPU.

Definition at line 75 of file SkStrike.cpp.

75 {
76 fStrikeLock.acquire();
77 fMemoryIncrease = 0;
78}

◆ mergeDrawable()

const SkDrawable * SkStrike::mergeDrawable ( SkGlyph glyph,
sk_sp< SkDrawable drawable 
)

Definition at line 199 of file SkStrike.cpp.

199 {
200 Monitor m{this};
202 SkDEBUGFAIL("Re-adding drawable to existing glyph. This should not happen.");
203 }
204 if (glyph->setDrawable(&fAlloc, std::move(drawable))) {
205 fMemoryIncrease += glyph->drawable()->approximateBytesUsed();
206 SkASSERT(fMemoryIncrease > 0);
207 }
208
209 return glyph->drawable();
210}
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
size_t approximateBytesUsed()
Definition: SkDrawable.cpp:75
bool setDrawableHasBeenCalled() const
Definition: SkGlyph.h:495
bool setDrawable(SkArenaAlloc *alloc, SkScalerContext *scalerContext)
Definition: SkGlyph.cpp:310

◆ mergeFromBuffer()

bool SkStrike::mergeFromBuffer ( SkReadBuffer buffer)

Definition at line 117 of file SkStrike.cpp.

117 {
118 // Read glyphs with images for the current strike.
119 const int imagesCount = buffer.readInt();
120 if (imagesCount == 0 && !buffer.isValid()) {
121 return false;
122 }
123
124 {
125 Monitor m{this};
126 for (int curImage = 0; curImage < imagesCount; ++curImage) {
127 if (!this->mergeGlyphAndImageFromBuffer(buffer)) {
128 return false;
129 }
130 }
131 }
132
133 // Read glyphs with paths for the current strike.
134 const int pathsCount = buffer.readInt();
135 if (pathsCount == 0 && !buffer.isValid()) {
136 return false;
137 }
138 {
139 Monitor m{this};
140 for (int curPath = 0; curPath < pathsCount; ++curPath) {
141 if (!this->mergeGlyphAndPathFromBuffer(buffer)) {
142 return false;
143 }
144 }
145 }
146
147 // Read glyphs with drawables for the current strike.
148 const int drawablesCount = buffer.readInt();
149 if (drawablesCount == 0 && !buffer.isValid()) {
150 return false;
151 }
152 {
153 Monitor m{this};
154 for (int curDrawable = 0; curDrawable < drawablesCount; ++curDrawable) {
155 if (!this->mergeGlyphAndDrawableFromBuffer(buffer)) {
156 return false;
157 }
158 }
159 }
160
161 return true;
162}

◆ mergeGlyphAndImage()

SkGlyph * SkStrike::mergeGlyphAndImage ( SkPackedGlyphID  toID,
const SkGlyph fromGlyph 
)

Definition at line 164 of file SkStrike.cpp.

164 {
165 Monitor m{this};
166 // TODO(herb): remove finding the glyph when setting the metrics and image are separated
167 SkGlyphDigest* digest = fDigestForPackedGlyphID.find(toID);
168 if (digest != nullptr) {
169 SkGlyph* glyph = fGlyphForIndex[digest->index()];
170 if (fromGlyph.setImageHasBeenCalled()) {
172 // Should never set an image on a glyph which already has an image.
173 SkDEBUGFAIL("Re-adding image to existing glyph. This should not happen.");
174 }
175 // TODO: assert that any metrics on fromGlyph are the same.
176 fMemoryIncrease += glyph->setMetricsAndImage(&fAlloc, fromGlyph);
177 }
178 return glyph;
179 } else {
180 SkGlyph* glyph = fAlloc.make<SkGlyph>(toID);
181 fMemoryIncrease += glyph->setMetricsAndImage(&fAlloc, fromGlyph) + sizeof(SkGlyph);
182 (void)this->addGlyphAndDigest(glyph);
183 return glyph;
184 }
185}
bool setImageHasBeenCalled() const
Definition: SkGlyph.h:459
size_t setMetricsAndImage(SkArenaAlloc *alloc, const SkGlyph &from)
Definition: SkGlyph.cpp:207

◆ mergePath()

const SkPath * SkStrike::mergePath ( SkGlyph glyph,
const SkPath path,
bool  hairline 
)

Definition at line 187 of file SkStrike.cpp.

187 {
188 Monitor m{this};
190 SkDEBUGFAIL("Re-adding path to existing glyph. This should not happen.");
191 }
192 if (glyph->setPath(&fAlloc, path, hairline)) {
193 fMemoryIncrease += glyph->path()->approximateBytesUsed();
194 }
195
196 return glyph->path();
197}
bool setPathHasBeenCalled() const
Definition: SkGlyph.h:486
bool setPath(SkArenaAlloc *alloc, SkScalerContext *scalerContext)
Definition: SkGlyph.cpp:266
size_t approximateBytesUsed() const
Definition: SkPath.cpp:572
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
Definition: switches.h:57

◆ metrics()

SkSpan< const SkGlyph * > SkStrike::metrics ( SkSpan< const SkGlyphID glyphIDs,
const SkGlyph results[] 
)

Definition at line 218 of file SkStrike.cpp.

219 {
220 Monitor m{this};
221 return this->internalPrepare(glyphIDs, kMetricsOnly, results);
222}

◆ Monitor()

SkStrike::Monitor ( SkStrike strike) -> fStrikeLock) : fStrike
inline

Definition at line 62 of file SkStrike.cpp.

63 : fStrike{strike} {

◆ prepareDrawables()

SkSpan< const SkGlyph * > SkStrike::prepareDrawables ( SkSpan< const SkGlyphID glyphIDs,
const SkGlyph results[] 
)

Definition at line 243 of file SkStrike.cpp.

244 {
245 const SkGlyph** cursor = results;
246 {
247 Monitor m{this};
248 for (auto glyphID : glyphIDs) {
249 SkGlyph* glyph = this->glyph(SkPackedGlyphID{glyphID});
250 this->prepareForDrawable(glyph);
251 *cursor++ = glyph;
252 }
253 }
254
255 return {results, glyphIDs.size()};
256}

◆ prepareForDrawable()

bool SkStrike::prepareForDrawable ( SkGlyph glyph)
overridevirtual

Implements sktext::StrikeForGPU.

Definition at line 373 of file SkStrike.cpp.

373 {
374 if (glyph->setDrawable(&fAlloc, fScalerContext.get())) {
375 size_t increase = glyph->drawable()->approximateBytesUsed();
376 SkASSERT(increase > 0);
377 fMemoryIncrease += increase;
378 }
379 return glyph->drawable() != nullptr;
380}

◆ prepareForImage()

bool SkStrike::prepareForImage ( SkGlyph glyph)
overridevirtual

Implements sktext::StrikeForGPU.

Definition at line 359 of file SkStrike.cpp.

359 {
360 if (glyph->setImage(&fAlloc, fScalerContext.get())) {
361 fMemoryIncrease += glyph->imageSize();
362 }
363 return glyph->image() != nullptr;
364}
size_t imageSize() const
Definition: SkGlyph.cpp:241
bool setImage(SkArenaAlloc *alloc, SkScalerContext *scalerContext)
Definition: SkGlyph.cpp:185
const void * image() const
Definition: SkGlyph.h:465

◆ prepareForPath()

bool SkStrike::prepareForPath ( SkGlyph glyph)
overridevirtual

Implements sktext::StrikeForGPU.

Definition at line 366 of file SkStrike.cpp.

366 {
367 if (glyph->setPath(&fAlloc, fScalerContext.get())) {
368 fMemoryIncrease += glyph->path()->approximateBytesUsed();
369 }
370 return glyph->path() !=nullptr;
371}

◆ prepareImages()

SkSpan< const SkGlyph * > SkStrike::prepareImages ( SkSpan< const SkPackedGlyphID glyphIDs,
const SkGlyph results[] 
)

Definition at line 230 of file SkStrike.cpp.

231 {
232 const SkGlyph** cursor = results;
233 Monitor m{this};
234 for (auto glyphID : glyphIDs) {
235 SkGlyph* glyph = this->glyph(glyphID);
236 this->prepareForImage(glyph);
237 *cursor++ = glyph;
238 }
239
240 return {results, glyphIDs.size()};
241}
bool prepareForImage(SkGlyph *glyph) override SK_REQUIRES(fStrikeLock)
Definition: SkStrike.cpp:359

◆ preparePaths()

SkSpan< const SkGlyph * > SkStrike::preparePaths ( SkSpan< const SkGlyphID glyphIDs,
const SkGlyph results[] 
)

Definition at line 224 of file SkStrike.cpp.

225 {
226 Monitor m{this};
227 return this->internalPrepare(glyphIDs, kMetricsAndPath, results);
228}

◆ roundingSpec()

const SkGlyphPositionRoundingSpec & SkStrike::roundingSpec ( ) const
inlineoverridevirtual

Implements sktext::StrikeForGPU.

Definition at line 107 of file SkStrike.h.

107 {
108 return fRoundingSpec;
109 }

◆ strikePromise()

sktext::SkStrikePromise SkStrike::strikePromise ( )
inlineoverridevirtual

Implements sktext::StrikeForGPU.

Definition at line 111 of file SkStrike.h.

111 {
112 return sktext::SkStrikePromise(sk_ref_sp<SkStrike>(this));
113 }

◆ strikeSpec()

const SkStrikeSpec & SkStrike::strikeSpec ( ) const
inline

Definition at line 121 of file SkStrike.h.

121 {
122 return fStrikeSpec;
123 }

◆ unlock()

void SkStrike::unlock ( )
overridevirtual

Implements sktext::StrikeForGPU.

Definition at line 80 of file SkStrike.cpp.

80 {
81 const size_t memoryIncrease = fMemoryIncrease;
82 fStrikeLock.release();
83 this->updateMemoryUsage(memoryIncrease);
84}

◆ verifyPinnedStrike()

void SkStrike::verifyPinnedStrike ( ) const
inline

Definition at line 125 of file SkStrike.h.

125 {
126 if (fPinner != nullptr) {
127 fPinner->assertValid();
128 }
129 }

Friends And Related Function Documentation

◆ SkStrikeCache

friend class SkStrikeCache
friend

Definition at line 137 of file SkStrike.h.

◆ SkStrikeTestingPeer

friend class SkStrikeTestingPeer
friend

Definition at line 138 of file SkStrike.h.


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