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

Public Member Functions

 SkGlyphCacheStressTest (int cacheSize)
 
- 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 onDraw (int loops, SkCanvas *) 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 81 of file SkGlyphCacheBench.cpp.

Constructor & Destructor Documentation

◆ SkGlyphCacheStressTest()

SkGlyphCacheStressTest::SkGlyphCacheStressTest ( int  cacheSize)
inlineexplicit

Definition at line 83 of file SkGlyphCacheBench.cpp.

83: fCacheSize(cacheSize) { }

Member Function Documentation

◆ isSuitableFor()

bool SkGlyphCacheStressTest::isSuitableFor ( Backend  backend)
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 91 of file SkGlyphCacheBench.cpp.

91 {
93 }
const char * backend

◆ onDraw()

void SkGlyphCacheStressTest::onDraw ( int  loops,
SkCanvas  
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 95 of file SkGlyphCacheBench.cpp.

95 {
96 size_t oldCacheLimitSize = SkGraphics::GetFontCacheLimit();
98 sk_sp<SkTypeface> typefaces[] = {
101
102 for (int work = 0; work < loops; work++) {
103 SkTaskGroup().batch(16, [&](int threadIndex) {
106 font.setSubpixel(true);
107 font.setTypeface(typefaces[threadIndex % 2]);
109 });
110 }
111 SkGraphics::SetFontCacheLimit(oldCacheLimitSize);
112 }
static void do_font_stuff(SkFont *font)
static constexpr SkFontStyle Italic()
Definition: SkFontStyle.h:72
Definition: SkFont.h:35
@ kAntiAlias
may have transparent pixels on glyph edges
static size_t GetFontCacheLimit()
Definition: SkGraphics.cpp:48
static size_t SetFontCacheLimit(size_t bytes)
Definition: SkGraphics.cpp:52
void batch(int N, std::function< void(int)> fn)
Definition: SkTaskGroup.cpp:24
sk_sp< SkTypeface > CreatePortableTypeface(const char *name, SkFontStyle style)
SkFont DefaultFont()
font
Font Metadata and Metrics.

◆ onGetName()

const char * SkGlyphCacheStressTest::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 86 of file SkGlyphCacheBench.cpp.

86 {
87 fName.printf("SkGlyphCacheStressTest%dK", (int)(fCacheSize >> 10));
88 return fName.c_str();
89 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
const char * c_str() const
Definition: SkString.h:133

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