Flutter Engine
The Flutter Engine
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
LightingBaseBench Class Reference
Inheritance diagram for LightingBaseBench:
Benchmark SkRefCnt SkRefCntBase LightingDistantLitDiffuseBench LightingDistantLitSpecularBench LightingPointLitDiffuseBench LightingPointLitSpecularBench LightingSpotLitDiffuseBench LightingSpotLitSpecularBench

Public Member Functions

 LightingBaseBench (bool small)
 
- 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 Types

using INHERITED = Benchmark
 

Protected Member Functions

void draw (int loops, SkCanvas *canvas, sk_sp< SkImageFilter > imageFilter) const
 
- 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 ()
 

Static Protected Member Functions

static SkPoint3 GetPointLocation ()
 
static SkPoint3 GetDistantDirection ()
 
static SkPoint3 GetSpotLocation ()
 
static SkPoint3 GetSpotTarget ()
 
static SkScalar GetSpotExponent ()
 
static SkScalar GetCutoffAngle ()
 
static SkScalar GetKd ()
 
static SkScalar GetKs ()
 
static SkScalar GetShininess ()
 
static SkScalar GetSurfaceScale ()
 
static SkColor GetWhite ()
 

Protected Attributes

bool fIsSmall
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Detailed Description

Definition at line 17 of file LightingBench.cpp.

Member Typedef Documentation

◆ INHERITED

Definition at line 95 of file LightingBench.cpp.

Constructor & Destructor Documentation

◆ LightingBaseBench()

LightingBaseBench::LightingBaseBench ( bool  small)
inline

Definition at line 19 of file LightingBench.cpp.

19: fIsSmall(small) { }

Member Function Documentation

◆ draw()

void LightingBaseBench::draw ( int  loops,
SkCanvas canvas,
sk_sp< SkImageFilter imageFilter 
) const
inlineprotected

Definition at line 22 of file LightingBench.cpp.

22 {
26 paint.setImageFilter(std::move(imageFilter));
27 for (int i = 0; i < loops; i++) {
28 canvas->drawRect(r, paint);
29 }
30 }
#define FILTER_WIDTH_SMALL
#define FILTER_WIDTH_LARGE
#define FILTER_HEIGHT_SMALL
#define FILTER_HEIGHT_LARGE
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
const Paint & paint
Definition: color_source.cc:38
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ GetCutoffAngle()

static SkScalar LightingBaseBench::GetCutoffAngle ( )
inlinestaticprotected

Definition at line 64 of file LightingBench.cpp.

64 {
65 static SkScalar cutoffAngle = SkIntToScalar(15);
66 return cutoffAngle;
67 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
float SkScalar
Definition: extension.cpp:12

◆ GetDistantDirection()

static SkPoint3 LightingBaseBench::GetDistantDirection ( )
inlinestaticprotected

Definition at line 37 of file LightingBench.cpp.

37 {
38 static SkScalar azimuthRad = SkDegreesToRadians(SkIntToScalar(225));
39 static SkScalar elevationRad = SkDegreesToRadians(SkIntToScalar(5));
40 static SkPoint3 distantDirection = SkPoint3::Make(
41 SkScalarCos(azimuthRad) * SkScalarCos(elevationRad),
42 SkScalarSin(azimuthRad) * SkScalarCos(elevationRad),
43 SkScalarSin(elevationRad));
44 return distantDirection;
45 }
#define SkDegreesToRadians(degrees)
Definition: SkScalar.h:77
#define SkScalarSin(radians)
Definition: SkScalar.h:45
#define SkScalarCos(radians)
Definition: SkScalar.h:46
static SkPoint3 Make(SkScalar x, SkScalar y, SkScalar z)
Definition: SkPoint3.h:18

◆ GetKd()

static SkScalar LightingBaseBench::GetKd ( )
inlinestaticprotected

Definition at line 69 of file LightingBench.cpp.

69 {
70 static SkScalar kd = SkIntToScalar(2);
71 return kd;
72 }

◆ GetKs()

static SkScalar LightingBaseBench::GetKs ( )
inlinestaticprotected

Definition at line 74 of file LightingBench.cpp.

74 {
75 static SkScalar ks = SkIntToScalar(1);
76 return ks;
77 }

◆ GetPointLocation()

static SkPoint3 LightingBaseBench::GetPointLocation ( )
inlinestaticprotected

Definition at line 32 of file LightingBench.cpp.

32 {
33 static SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10));
34 return pointLocation;
35 }

◆ GetShininess()

static SkScalar LightingBaseBench::GetShininess ( )
inlinestaticprotected

Definition at line 79 of file LightingBench.cpp.

79 {
80 static SkScalar shininess = SkIntToScalar(8);
81 return shininess;
82 }

◆ GetSpotExponent()

static SkScalar LightingBaseBench::GetSpotExponent ( )
inlinestaticprotected

Definition at line 59 of file LightingBench.cpp.

59 {
60 static SkScalar spotExponent = SK_Scalar1;
61 return spotExponent;
62 }
#define SK_Scalar1
Definition: SkScalar.h:18

◆ GetSpotLocation()

static SkPoint3 LightingBaseBench::GetSpotLocation ( )
inlinestaticprotected

Definition at line 47 of file LightingBench.cpp.

47 {
48 static SkPoint3 spotLocation = SkPoint3::Make(SkIntToScalar(-10),
49 SkIntToScalar(-10),
50 SkIntToScalar(20));
51 return spotLocation;
52 }

◆ GetSpotTarget()

static SkPoint3 LightingBaseBench::GetSpotTarget ( )
inlinestaticprotected

Definition at line 54 of file LightingBench.cpp.

54 {
55 static SkPoint3 spotTarget = SkPoint3::Make(SkIntToScalar(40), SkIntToScalar(40), 0);
56 return spotTarget;
57 }

◆ GetSurfaceScale()

static SkScalar LightingBaseBench::GetSurfaceScale ( )
inlinestaticprotected

Definition at line 84 of file LightingBench.cpp.

84 {
85 static SkScalar surfaceScale = SkIntToScalar(1);
86 return surfaceScale;
87 }

◆ GetWhite()

static SkColor LightingBaseBench::GetWhite ( )
inlinestaticprotected

Definition at line 89 of file LightingBench.cpp.

89 {
90 static SkColor white(0xFFFFFFFF);
91 return white;
92 }
uint32_t SkColor
Definition: SkColor.h:37

Member Data Documentation

◆ fIsSmall

bool LightingBaseBench::fIsSmall
protected

Definition at line 94 of file LightingBench.cpp.


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