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

Public Types

using ShaderMaker = sk_sp< SkShader >(*)()
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

 ShaderMFBench (const char *nm, bool opaque, const ShaderMaker maker)
 
- 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
 
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 ()
 

Detailed Description

Definition at line 43 of file ShaderMaskFilterBench.cpp.

Member Typedef Documentation

◆ ShaderMaker

Definition at line 46 of file ShaderMaskFilterBench.cpp.

Constructor & Destructor Documentation

◆ ShaderMFBench()

ShaderMFBench::ShaderMFBench ( const char *  nm,
bool  opaque,
const ShaderMaker  maker 
)
inline

Definition at line 48 of file ShaderMaskFilterBench.cpp.

49 : fMaker{maker}
50 , fColor{opaque ? 0xff00ff00 : 0x8000ff00} {
51 fName = SkStringPrintf("shadermaskfilter_%s_%x", nm, SkColorGetA(fColor));
52 }
#define SkColorGetA(color)
Definition: SkColor.h:61
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.

Member Function Documentation

◆ onDelayedSetup()

void ShaderMFBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 59 of file ShaderMaskFilterBench.cpp.

59 {
60 fMaskFilter = SkShaderMaskFilter::Make(fMaker());
61 }
static sk_sp< SkMaskFilter > Make(sk_sp< SkShader > shader)

◆ onDraw()

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

Implements Benchmark.

Definition at line 63 of file ShaderMaskFilterBench.cpp.

63 {
64 SkPaint maskPaint;
65 maskPaint.setMaskFilter(fMaskFilter);
66
67 for (int i = 0; i < loops; ++i) {
68 SkAutoCanvasRestore arc(canvas, false);
69 canvas->saveLayer(nullptr, &maskPaint);
70 canvas->drawColor(fColor);
71 }
72 }
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void setMaskFilter(sk_sp< SkMaskFilter > maskFilter)

◆ onGetName()

const char * ShaderMFBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 55 of file ShaderMaskFilterBench.cpp.

55 {
56 return fName.c_str();
57 }
const char * c_str() const
Definition: SkString.h:133

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