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

Public Member Functions

 CommonConvexBench (int w, int h, bool forceConcave, bool aa)
 
- 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 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 ()
 

Protected Attributes

SkString fName
 
SkPath fPath
 
const bool fAA
 

Additional Inherited Members

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

Detailed Description

Definition at line 1239 of file PathBench.cpp.

Constructor & Destructor Documentation

◆ CommonConvexBench()

CommonConvexBench::CommonConvexBench ( int  w,
int  h,
bool  forceConcave,
bool  aa 
)
inline

Definition at line 1246 of file PathBench.cpp.

1246 : fAA(aa) {
1247 fName.printf("convex_path_%d_%d_%d_%d", w, h, forceConcave, aa);
1248
1249 SkRect r = SkRect::MakeXYWH(10, 10, w*1.0f, h*1.0f);
1250 fPath.addRRect(SkRRect::MakeRectXY(r, w/8.0f, h/8.0f));
1251
1252 if (forceConcave) {
1255 } else {
1257 }
1258 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
static void SetConvexity(const SkPath &path, SkPathConvexity c)
Definition: SkPathPriv.h:413
SkPath & addRRect(const SkRRect &rrect, SkPathDirection dir=SkPathDirection::kCW)
Definition: SkPath.cpp:1000
bool isConvex() const
Definition: SkPath.cpp:426
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition: SkRRect.h:180
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
SkScalar w
SkScalar h
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 1265 of file PathBench.cpp.

1265 {
1266 SkPaint paint;
1267 paint.setAntiAlias(fAA);
1268
1269 for (int i = 0; i < loops; ++i) {
1270 for (int inner = 0; inner < 100; ++inner) {
1271 canvas->drawPath(fPath, paint);
1272 }
1273 }
1274 }
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
const Paint & paint
Definition: color_source.cc:38

◆ onGetName()

const char * CommonConvexBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 1261 of file PathBench.cpp.

1261 {
1262 return fName.c_str();
1263 }
const char * c_str() const
Definition: SkString.h:133

Member Data Documentation

◆ fAA

const bool CommonConvexBench::fAA
protected

Definition at line 1243 of file PathBench.cpp.

◆ fName

SkString CommonConvexBench::fName
protected

Definition at line 1241 of file PathBench.cpp.

◆ fPath

SkPath CommonConvexBench::fPath
protected

Definition at line 1242 of file PathBench.cpp.


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