Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SkStrikeSpec Class Reference

#include <SkStrikeSpec.h>

Public Member Functions

 SkStrikeSpec (const SkDescriptor &descriptor, sk_sp< SkTypeface > typeface)
 
 SkStrikeSpec (const SkStrikeSpec &)
 
SkStrikeSpecoperator= (const SkStrikeSpec &)=delete
 
 SkStrikeSpec (SkStrikeSpec &&)
 
SkStrikeSpecoperator= (SkStrikeSpec &&)=delete
 
 ~SkStrikeSpec ()
 
sk_sp< sktext::StrikeForGPUfindOrCreateScopedStrike (sktext::StrikeForGPUCacheInterface *cache) const
 
sk_sp< SkStrikefindOrCreateStrike () const
 
sk_sp< SkStrikefindOrCreateStrike (SkStrikeCache *cache) const
 
std::unique_ptr< SkScalerContextcreateScalerContext () const
 
const SkDescriptordescriptor () const
 
const SkTypefacetypeface () const
 
SkString dump () const
 

Static Public Member Functions

static SkStrikeSpec MakeMask (const SkFont &font, const SkPaint &paint, const SkSurfaceProps &surfaceProps, SkScalerContextFlags scalerContextFlags, const SkMatrix &deviceMatrix)
 
static SkStrikeSpec MakeTransformMask (const SkFont &font, const SkPaint &paint, const SkSurfaceProps &surfaceProps, SkScalerContextFlags scalerContextFlags, const SkMatrix &deviceMatrix)
 
static std::tuple< SkStrikeSpec, SkScalarMakePath (const SkFont &font, const SkPaint &paint, const SkSurfaceProps &surfaceProps, SkScalerContextFlags scalerContextFlags)
 
static std::tuple< SkStrikeSpec, SkScalarMakeCanonicalized (const SkFont &font, const SkPaint *paint=nullptr)
 
static SkStrikeSpec MakeWithNoDevice (const SkFont &font, const SkPaint *paint=nullptr)
 
static SkStrikeSpec MakePDFVector (const SkTypeface &typeface, int *size)
 
static bool ShouldDrawAsPath (const SkPaint &paint, const SkFont &font, const SkMatrix &matrix)
 

Detailed Description

Definition at line 39 of file SkStrikeSpec.h.

Constructor & Destructor Documentation

◆ SkStrikeSpec() [1/3]

SkStrikeSpec::SkStrikeSpec ( const SkDescriptor descriptor,
sk_sp< SkTypeface typeface 
)

Definition at line 25 of file SkStrikeSpec.cpp.

26 : fAutoDescriptor{descriptor}
27 , fTypeface{std::move(typeface)} {}
const SkTypeface & typeface() const
const SkDescriptor & descriptor() const

◆ SkStrikeSpec() [2/3]

SkStrikeSpec::SkStrikeSpec ( const SkStrikeSpec )
default

◆ SkStrikeSpec() [3/3]

SkStrikeSpec::SkStrikeSpec ( SkStrikeSpec &&  )
default

◆ ~SkStrikeSpec()

SkStrikeSpec::~SkStrikeSpec ( )
default

Member Function Documentation

◆ createScalerContext()

std::unique_ptr< SkScalerContext > SkStrikeSpec::createScalerContext ( ) const
inline

Definition at line 91 of file SkStrikeSpec.h.

91 {
92 SkScalerContextEffects effects{fPathEffect.get(), fMaskFilter.get()};
93 return fTypeface->createScalerContext(effects, fAutoDescriptor.getDesc());
94 }
SkDescriptor * getDesc() const
std::unique_ptr< SkScalerContext > createScalerContext(const SkScalerContextEffects &, const SkDescriptor *) const
T * get() const
Definition SkRefCnt.h:303

◆ descriptor()

const SkDescriptor & SkStrikeSpec::descriptor ( ) const
inline

Definition at line 96 of file SkStrikeSpec.h.

96{ return *fAutoDescriptor.getDesc(); }

◆ dump()

SkString SkStrikeSpec::dump ( ) const

Definition at line 130 of file SkStrikeSpec.cpp.

130 {
131 return fAutoDescriptor.getDesc()->dumpRec();
132}
SkString dumpRec() const

◆ findOrCreateScopedStrike()

sk_sp< sktext::StrikeForGPU > SkStrikeSpec::findOrCreateScopedStrike ( sktext::StrikeForGPUCacheInterface cache) const

Definition at line 170 of file SkStrikeSpec.cpp.

171 {
172 return cache->findOrCreateScopedStrike(*this);
173}
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 Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition switches.h:191

◆ findOrCreateStrike() [1/2]

sk_sp< SkStrike > SkStrikeSpec::findOrCreateStrike ( ) const

Definition at line 175 of file SkStrikeSpec.cpp.

175 {
176 SkScalerContextEffects effects{fPathEffect.get(), fMaskFilter.get()};
178}
sk_sp< SkStrike > findOrCreateStrike(const SkStrikeSpec &strikeSpec) SK_EXCLUDES(fLock)
static SkStrikeCache * GlobalStrikeCache()

◆ findOrCreateStrike() [2/2]

sk_sp< SkStrike > SkStrikeSpec::findOrCreateStrike ( SkStrikeCache cache) const

Definition at line 180 of file SkStrikeSpec.cpp.

180 {
181 SkScalerContextEffects effects{fPathEffect.get(), fMaskFilter.get()};
182 return cache->findOrCreateStrike(*this);
183}

◆ MakeCanonicalized()

std::tuple< SkStrikeSpec, SkScalar > SkStrikeSpec::MakeCanonicalized ( const SkFont font,
const SkPaint paint = nullptr 
)
static

Definition at line 71 of file SkStrikeSpec.cpp.

72 {
73 SkPaint canonicalizedPaint;
74 if (paint != nullptr) {
75 canonicalizedPaint = *paint;
76 }
77
78 const SkFont* canonicalizedFont = &font;
79 SkTLazy<SkFont> pathFont;
80 SkScalar strikeToSourceScale = 1;
81 if (ShouldDrawAsPath(canonicalizedPaint, font, SkMatrix::I())) {
82 canonicalizedFont = pathFont.set(font);
83 strikeToSourceScale = pathFont->setupForAsPaths(nullptr);
84 canonicalizedPaint.reset();
85 }
86
87 return {SkStrikeSpec(*canonicalizedFont, canonicalizedPaint, SkSurfaceProps(),
89 strikeToSourceScale};
90}
static const SkMatrix & I()
void reset()
Definition SkPaint.cpp:103
static bool ShouldDrawAsPath(const SkPaint &paint, const SkFont &font, const SkMatrix &matrix)
T * set(const T &src)
Definition SkTLazy.h:56
const Paint & paint
float SkScalar
Definition extension.cpp:12
font
Font Metadata and Metrics.

◆ MakeMask()

SkStrikeSpec SkStrikeSpec::MakeMask ( const SkFont font,
const SkPaint paint,
const SkSurfaceProps surfaceProps,
SkScalerContextFlags  scalerContextFlags,
const SkMatrix deviceMatrix 
)
static

Definition at line 33 of file SkStrikeSpec.cpp.

36 {
37
38 return SkStrikeSpec(font, paint, surfaceProps, scalerContextFlags, deviceMatrix);
39}

◆ MakePath()

std::tuple< SkStrikeSpec, SkScalar > SkStrikeSpec::MakePath ( const SkFont font,
const SkPaint paint,
const SkSurfaceProps surfaceProps,
SkScalerContextFlags  scalerContextFlags 
)
static

Definition at line 51 of file SkStrikeSpec.cpp.

54 {
55
56 // setup our std runPaint, in hopes of getting hits in the cache
57 SkPaint pathPaint{paint};
58 SkFont pathFont{font};
59
60 // The sub-pixel position will always happen when transforming to the screen.
61 pathFont.setSubpixel(false);
62
63 // The factor to get from the size stored in the strike to the size needed for
64 // the source.
65 SkScalar strikeToSourceScale = pathFont.setupForAsPaths(&pathPaint);
66
67 return {SkStrikeSpec(pathFont, pathPaint, surfaceProps, scalerContextFlags, SkMatrix::I()),
68 strikeToSourceScale};
69}

◆ MakePDFVector()

SkStrikeSpec SkStrikeSpec::MakePDFVector ( const SkTypeface typeface,
int size 
)
static

Definition at line 134 of file SkStrikeSpec.cpp.

134 {
135 SkFont font;
136 font.setHinting(SkFontHinting::kNone);
137 font.setEdging(SkFont::Edging::kAlias);
138 font.setTypeface(sk_ref_sp(&typeface));
139 int unitsPerEm = typeface.getUnitsPerEm();
140 if (unitsPerEm <= 0) {
141 unitsPerEm = 1024;
142 }
143 if (size) {
144 *size = unitsPerEm;
145 }
146 font.setSize((SkScalar)unitsPerEm);
147
148 return SkStrikeSpec(font,
149 SkPaint(),
152 SkMatrix::I());
153}
@ kNone
glyph outlines unchanged
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381
@ kAlias
no transparent pixels on glyph edges
int getUnitsPerEm() const
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

◆ MakeTransformMask()

SkStrikeSpec SkStrikeSpec::MakeTransformMask ( const SkFont font,
const SkPaint paint,
const SkSurfaceProps surfaceProps,
SkScalerContextFlags  scalerContextFlags,
const SkMatrix deviceMatrix 
)
static

Definition at line 41 of file SkStrikeSpec.cpp.

45 {
46 SkFont sourceFont{font};
47 sourceFont.setSubpixel(false);
48 return SkStrikeSpec(sourceFont, paint, surfaceProps, scalerContextFlags, deviceMatrix);
49}

◆ MakeWithNoDevice()

SkStrikeSpec SkStrikeSpec::MakeWithNoDevice ( const SkFont font,
const SkPaint paint = nullptr 
)
static

Definition at line 92 of file SkStrikeSpec.cpp.

92 {
93 SkPaint setupPaint;
94 if (paint != nullptr) {
95 setupPaint = *paint;
96 }
97
98 return SkStrikeSpec(font, setupPaint, SkSurfaceProps(),
100}

◆ operator=() [1/2]

SkStrikeSpec & SkStrikeSpec::operator= ( const SkStrikeSpec )
delete

◆ operator=() [2/2]

SkStrikeSpec & SkStrikeSpec::operator= ( SkStrikeSpec &&  )
delete

◆ ShouldDrawAsPath()

bool SkStrikeSpec::ShouldDrawAsPath ( const SkPaint paint,
const SkFont font,
const SkMatrix matrix 
)
static

Definition at line 102 of file SkStrikeSpec.cpp.

103 {
104
105 // hairline glyphs are fast enough, so we don't need to cache them
106 if (SkPaint::kStroke_Style == paint.getStyle() && 0 == paint.getStrokeWidth()) {
107 return true;
108 }
109
110 // we don't cache perspective
111 if (viewMatrix.hasPerspective()) {
112 return true;
113 }
114
115 SkMatrix textMatrix = SkFontPriv::MakeTextMatrix(font);
116 textMatrix.postConcat(viewMatrix);
117
118 // we have a self-imposed maximum, just to limit memory-usage
119 constexpr SkScalar memoryLimit = 256;
120 constexpr SkScalar maxSizeSquared = memoryLimit * memoryLimit;
121
122 auto distance = [&textMatrix](int XIndex, int YIndex) {
123 return textMatrix[XIndex] * textMatrix[XIndex] + textMatrix[YIndex] * textMatrix[YIndex];
124 };
125
126 return distance(SkMatrix::kMScaleX, SkMatrix::kMSkewY ) > maxSizeSquared
127 || distance(SkMatrix::kMSkewX, SkMatrix::kMScaleY) > maxSizeSquared;
128}
static SkMatrix MakeTextMatrix(SkScalar size, SkScalar scaleX, SkScalar skewX)
Definition SkFontPriv.h:41
static constexpr int kMScaleX
horizontal scale factor
Definition SkMatrix.h:353
SkMatrix & postConcat(const SkMatrix &other)
Definition SkMatrix.cpp:683
static constexpr int kMSkewY
vertical skew factor
Definition SkMatrix.h:356
static constexpr int kMScaleY
vertical scale factor
Definition SkMatrix.h:357
static constexpr int kMSkewX
horizontal skew factor
Definition SkMatrix.h:354
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194

◆ typeface()

const SkTypeface & SkStrikeSpec::typeface ( ) const
inline

Definition at line 97 of file SkStrikeSpec.h.

97{ return *fTypeface; }

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