Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkTextBlobBench Class Reference
Inheritance diagram for SkTextBlobBench:
Benchmark SkRefCnt SkRefCntBase TextBlobCachedBench TextBlobFirstTimeBench TextBlobMakeBench

Public Member Functions

 SkTextBlobBench ()
 
void onDelayedSetup () override
 
sk_sp< SkTextBlobmakeBlob ()
 
- 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
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 
- 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 ()
 

Detailed Description

Definition at line 25 of file TextBlobBench.cpp.

Constructor & Destructor Documentation

◆ SkTextBlobBench()

SkTextBlobBench::SkTextBlobBench ( )
inline

Definition at line 27 of file TextBlobBench.cpp.

27{}

Member Function Documentation

◆ makeBlob()

sk_sp< SkTextBlob > SkTextBlobBench::makeBlob ( )
inline

Definition at line 43 of file TextBlobBench.cpp.

43 {
45 fBuilder.allocRunPosH(fFont, fGlyphs.size(), 10, nullptr);
46 memcpy(run.glyphs, &fGlyphs[0], fGlyphs.size() * sizeof(uint16_t));
47 memcpy(run.pos, &fXPos[0], fXPos.size() * sizeof(SkScalar));
48 return fBuilder.make();
49 }
int size() const
Definition: SkTDArray.h:138
const RunBuffer & allocRunPosH(const SkFont &font, int count, SkScalar y, const SkRect *bounds=nullptr)
Definition: SkTextBlob.cpp:546
sk_sp< SkTextBlob > make()
Definition: SkTextBlob.cpp:617
float SkScalar
Definition: extension.cpp:12
Definition: run.py:1

◆ onDelayedSetup()

void SkTextBlobBench::onDelayedSetup ( )
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 29 of file TextBlobBench.cpp.

29 {
31 fFont.setSubpixel(true);
32
33 // This text seems representative in both length and letter frequency.
34 const char* text = "Keep your sentences short, but not overly so.";
35
36 fGlyphs.resize(fFont.countText(text, strlen(text), SkTextEncoding::kUTF8));
37 fXPos.resize(fGlyphs.size());
38
39 fFont.textToGlyphs(text, strlen(text), SkTextEncoding::kUTF8, fGlyphs.begin(), fGlyphs.size());
40 fFont.getXPos(&fGlyphs[0], fGlyphs.size(), fXPos.begin());
41 }
@ kUTF8
uses bytes to represent UTF-8 or ASCII
void setSubpixel(bool subpixel)
Definition: SkFont.cpp:109
void getXPos(const SkGlyphID glyphs[], int count, SkScalar xpos[], SkScalar origin=0) const
Definition: SkFont.cpp:270
void setTypeface(sk_sp< SkTypeface > tf)
Definition: SkFont.cpp:90
int countText(const void *text, size_t byteLength, SkTextEncoding encoding) const
Definition: SkFont.h:323
int textToGlyphs(const void *text, size_t byteLength, SkTextEncoding encoding, SkGlyphID glyphs[], int maxGlyphCount) const
Definition: SkFont.cpp:181
T * begin()
Definition: SkTDArray.h:150
void resize(int count)
Definition: SkTDArray.h:183
std::u16string text
sk_sp< SkTypeface > CreatePortableTypeface(const char *name, SkFontStyle style)

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