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

Public Types

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

Public Member Functions

 ClipStrategyBench (Mode mode, size_t count)
 
 ~ClipStrategyBench () override=default
 
- 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 ()
 

Detailed Description

Definition at line 12 of file ClipStrategyBench.cpp.

Member Enumeration Documentation

◆ Mode

enum class ClipStrategyBench::Mode
strong
Enumerator
kClipPath 
kMask 

Definition at line 14 of file ClipStrategyBench.cpp.

14 {
16 kMask,
17 };
@ kMask
Definition: SkGlyph.h:315

Constructor & Destructor Documentation

◆ ClipStrategyBench()

ClipStrategyBench::ClipStrategyBench ( Mode  mode,
size_t  count 
)
inline

Definition at line 19 of file ClipStrategyBench.cpp.

20 : fMode(mode)
21 , fCount(count)
22 , fName("clip_strategy_"){
23
24 if (fMode == Mode::kClipPath) {
25 fName.append("path_");
26 this->forEachClipCircle([&](float x, float y, float r) {
27 fClipPath.addCircle(x, y, r);
28 });
29 } else {
30 fName.append("mask_");
31 }
32 fName.appendf("%zu", count);
33 }
int count
Definition: FontMgrTest.cpp:50
SkPath & addCircle(SkScalar x, SkScalar y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
Definition: SkPath.cpp:1213
void append(const char text[])
Definition: SkString.h:203
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:550
double y
double x
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ ~ClipStrategyBench()

ClipStrategyBench::~ClipStrategyBench ( )
overridedefault

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 42 of file ClipStrategyBench.cpp.

42 {
43 SkPaint p, srcIn;
44 p.setAntiAlias(true);
46
47 for (int i = 0; i < loops; ++i) {
48 SkAutoCanvasRestore acr(canvas, false);
49
50 if (fMode == Mode::kClipPath) {
51 canvas->save();
52 canvas->clipPath(fClipPath, true);
53 } else {
54 canvas->saveLayer(nullptr, nullptr);
55 this->forEachClipCircle([&](float x, float y, float r) {
56 canvas->drawCircle(x, y, r, p);
57 });
58 canvas->saveLayer(nullptr, &srcIn);
59 }
60 canvas->drawColor(SK_ColorGREEN);
61 }
62 }
@ kSrcIn
r = s * da
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
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 clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1456
int save()
Definition: SkCanvas.cpp:447
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
void setBlendMode(SkBlendMode mode)
Definition: SkPaint.cpp:151

◆ onGetName()

const char * ClipStrategyBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 38 of file ClipStrategyBench.cpp.

38 {
39 return fName.c_str();
40 }
const char * c_str() const
Definition: SkString.h:133

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