Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | List of all members
UtfToGlyph Class Reference
Inheritance diagram for UtfToGlyph:
Benchmark SkRefCnt SkRefCntBase

Public Member Functions

 UtfToGlyph (SkTextEncoding encoding, const char *(*text), int lineCount, const char *name)
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
virtual bool isSuitableFor (Backend backend)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual bool shouldLoop () const
 
void delayedSetup ()
 
void perCanvasPreDraw (SkCanvas *)
 
void perCanvasPostDraw (SkCanvas *)
 
void preDraw (SkCanvas *)
 
void postDraw (SkCanvas *)
 
void draw (int loops, SkCanvas *)
 
virtual void getGpuStats (SkCanvas *, skia_private::TArray< SkString > *keys, skia_private::TArray< double > *values)
 
virtual bool getDMSAAStats (GrRecordingContext *)
 
int getUnits () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

const char * onGetName () override
 
bool isSuitableFor (Backend backend) override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *canvas) override
 
- Protected Member Functions inherited from Benchmark
void setUnits (int units)
 
virtual void setupPaint (SkPaint *paint)
 
virtual const char * onGetName ()=0
 
virtual const char * onGetUniqueName ()
 
virtual void onDelayedSetup ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual void onDraw (int loops, SkCanvas *)=0
 
virtual SkISize onGetSize ()
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Detailed Description

Definition at line 214 of file TypefaceBench.cpp.

Constructor & Destructor Documentation

◆ UtfToGlyph()

UtfToGlyph::UtfToGlyph ( SkTextEncoding  encoding,
const char **  text,
int  lineCount,
const char *  name 
)
inline

Definition at line 216 of file TypefaceBench.cpp.

217 : fEncoding{encoding}
218 , fText{text}
219 , fLineCount{lineCount}
220 , fName{name} { }
std::u16string text
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

Member Function Documentation

◆ isSuitableFor()

bool UtfToGlyph::isSuitableFor ( Backend  backend)
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 227 of file TypefaceBench.cpp.

227 {
229 }
const char * backend

◆ onDelayedSetup()

void UtfToGlyph::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 231 of file TypefaceBench.cpp.

231 {
232 int maxGlyphs = 0;
233 for (int i = 0; i < fLineCount; i++) {
234 fLines.emplace_back(this->convertLine(i));
235 maxGlyphs = std::max(maxGlyphs, fLines.back()->glyphCount);
236 }
237 fGlyphIds.insert(fGlyphIds.begin(), maxGlyphs, 0);
238 fTypeface = ToolUtils::CreateTestTypeface("monospace", SkFontStyle());
239 }
static float max(float r, float g, float b)
Definition: hsl.cpp:49
sk_sp< SkTypeface > CreateTestTypeface(const char *name, SkFontStyle style)

◆ onDraw()

void UtfToGlyph::onDraw ( int  loops,
SkCanvas canvas 
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 241 of file TypefaceBench.cpp.

241 {
242 SkFont font(fTypeface);
243 // Do more loops to reduce variance.
244 for (int i = 0; i < loops * 3; ++i) {
245 for (auto& line : fLines) {
246 font.textToGlyphs(line->utf.data(), line->utf.size(), fEncoding,
247 fGlyphIds.data(), line->glyphCount);
248 }
249 }
250 }
Definition: SkFont.h:35
font
Font Metadata and Metrics.

◆ onGetName()

const char * UtfToGlyph::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 223 of file TypefaceBench.cpp.

223 {
224 return fName;
225 }

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