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

Public Member Functions

 HardStopGradientBench_SpecialHardStops (int w, int h, Kind kind)
 
const char * onGetName () override
 
SkISize onGetSize () override
 
void onPreDraw (SkCanvas *canvas) override
 
void onDraw (int loops, SkCanvas *canvas) override
 
- 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 36 of file HardStopGradientBench_SpecialHardStops.cpp.

Constructor & Destructor Documentation

◆ HardStopGradientBench_SpecialHardStops()

HardStopGradientBench_SpecialHardStops::HardStopGradientBench_SpecialHardStops ( int  w,
int  h,
Kind  kind 
)
inline

Definition at line 38 of file HardStopGradientBench_SpecialHardStops.cpp.

38 {
39 fW = w;
40 fH = h;
41 fKind = kind;
42
43 fName.printf("hardstop_special_%03dx%03d_%s", fW, fH, kindstr(fKind));
44 }
const char * kindstr(Kind k)
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
SkScalar w
SkScalar h

Member Function Documentation

◆ onDraw()

void HardStopGradientBench_SpecialHardStops::onDraw ( int  loops,
SkCanvas canvas 
)
inlineoverridevirtual

Implements Benchmark.

Definition at line 101 of file HardStopGradientBench_SpecialHardStops.cpp.

101 {
102 for (int i = 0; i < loops; i++) {
103 canvas->drawPaint(fPaint);
104 }
105 }
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668

◆ onGetName()

const char * HardStopGradientBench_SpecialHardStops::onGetName ( )
inlineoverridevirtual

Implements Benchmark.

Definition at line 46 of file HardStopGradientBench_SpecialHardStops.cpp.

46 {
47 return fName.c_str();
48 }
const char * c_str() const
Definition: SkString.h:133

◆ onGetSize()

SkISize HardStopGradientBench_SpecialHardStops::onGetSize ( )
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 50 of file HardStopGradientBench_SpecialHardStops.cpp.

50 {
51 return SkISize::Make(fW, fH);
52 }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ onPreDraw()

void HardStopGradientBench_SpecialHardStops::onPreDraw ( SkCanvas canvas)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 54 of file HardStopGradientBench_SpecialHardStops.cpp.

54 {
55 SkPoint points[2] = {
56 SkPoint::Make( 0.0f, fH/2.0f),
57 SkPoint::Make(fW+2.0f, fH/2.0f),
58 };
59
60 SkColor colors[4] = {
65 };
66
67 SkScalar pos_001[3] = {
68 0.0f,
69 0.0f,
70 1.0f,
71 };
72
73 SkScalar pos_011[3] = {
74 0.0f,
75 1.0f,
76 1.0f,
77 };
78
79 SkScalar pos_centered[4] = {
80 0.0f,
81 0.5f,
82 0.5f,
83 1.0f,
84 };
85
86 SkScalar* positions = fKind == Kind::k001 ? pos_001 :
87 fKind == Kind::k011 ? pos_011 :
88 pos_centered;
89
90 int count = fKind == Kind::kCentered ? 4 : 3;
91
93 colors,
94 positions,
95 count,
97 0,
98 nullptr));
99 }
int count
Definition: FontMgrTest.cpp:50
static const int points[]
@ kCentered
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
void setShader(sk_sp< SkShader > shader)
float SkScalar
Definition: extension.cpp:12
PODArray< SkColor > colors
Definition: SkRecords.h:276
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173

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