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

Public Member Functions

 HardStopGradientBench_ScaleNumColors (SkTileMode tilemode, int count)
 
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 19 of file HardStopGradientBench_ScaleNumColors.cpp.

Constructor & Destructor Documentation

◆ HardStopGradientBench_ScaleNumColors()

HardStopGradientBench_ScaleNumColors::HardStopGradientBench_ScaleNumColors ( SkTileMode  tilemode,
int  count 
)
inline

Definition at line 21 of file HardStopGradientBench_ScaleNumColors.cpp.

21 {
22 fName.printf("hardstop_scale_num_colors_%s_%03d_colors",
24
25 fTileMode = tilemode;
26 fColorCount = count;
27 }
int count
Definition: FontMgrTest.cpp:50
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
const char * tilemode_name(SkTileMode mode)
Definition: ToolUtils.cpp:129

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 86 of file HardStopGradientBench_ScaleNumColors.cpp.

86 {
87 for (int i = 0; i < loops; i++) {
88 canvas->drawPaint(fPaint);
89 }
90 }
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668

◆ onGetName()

const char * HardStopGradientBench_ScaleNumColors::onGetName ( )
inlineoverridevirtual

Implements Benchmark.

Definition at line 29 of file HardStopGradientBench_ScaleNumColors.cpp.

29 {
30 return fName.c_str();
31 }
const char * c_str() const
Definition: SkString.h:133

◆ onGetSize()

SkISize HardStopGradientBench_ScaleNumColors::onGetSize ( )
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 33 of file HardStopGradientBench_ScaleNumColors.cpp.

33 {
34 return SkISize::Make(kSize, kSize);
35 }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ onPreDraw()

void HardStopGradientBench_ScaleNumColors::onPreDraw ( SkCanvas canvas)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 44 of file HardStopGradientBench_ScaleNumColors.cpp.

44 {
45 // Left to right
46 SkPoint points[2] = {
47 SkPoint::Make(0, kSize/2),
48 SkPoint::Make(kSize-1, kSize/2),
49 };
50
51 constexpr int kNumColorChoices = 4;
52 SkColor color_choices[kNumColorChoices] = {
57 };
58
59 // Alternate between different choices
60 SkColor colors[100];
61 for (int i = 0; i < fColorCount; i++) {
62 colors[i] = color_choices[i % kNumColorChoices];
63 }
64
65 // Create a hard stop
66 SkScalar positions[100];
67 positions[0] = 0.0f;
68 positions[1] = 0.0f;
69 for (int i = 2; i < fColorCount; i++) {
70 // Evenly spaced afterwards
71 positions[i] = i / (fColorCount - 1.0f);
72 }
73
75 colors,
76 positions,
77 fColorCount,
78 fTileMode,
79 0,
80 nullptr));
81 }
static const int points[]
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: