Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
NestedAAClipBench Class Reference
Inheritance diagram for NestedAAClipBench:
Benchmark SkRefCnt SkRefCntBase

Public Member Functions

 NestedAAClipBench (bool doAA)
 
- 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 recurse (SkCanvas *canvas, int depth, const SkPoint &offset)
 
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 * onGetUniqueName ()
 
virtual void onDelayedSetup ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual SkISize onGetSize ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 86 of file AAClipBench.cpp.

Constructor & Destructor Documentation

◆ NestedAAClipBench()

NestedAAClipBench::NestedAAClipBench ( bool  doAA)
inline

Definition at line 98 of file AAClipBench.cpp.

98 : fDoAA(doAA) {
99 fName.printf("nested_aaclip_%s", doAA ? "AA" : "BW");
100
101 fDrawRect = SkRect::MakeLTRB(0, 0,
102 SkIntToScalar(kImageSize),
103 SkIntToScalar(kImageSize));
104
105 fSizes[0].set(SkIntToScalar(kImageSize), SkIntToScalar(kImageSize));
106
107 for (int i = 1; i < kNestingDepth+1; ++i) {
108 fSizes[i].set(fSizes[i-1].fX/2, fSizes[i-1].fY/2);
109 }
110 }
#define SkIntToScalar(x)
Definition SkScalar.h:57
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:534
void set(float x, float y)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 156 of file AAClipBench.cpp.

156 {
157
158 for (int i = 0; i < loops; ++i) {
160 this->recurse(canvas, 0, offset);
161 }
162 }
void recurse(SkCanvas *canvas, int depth, const SkPoint &offset)
Point offset
static constexpr SkPoint Make(float x, float y)

◆ onGetName()

const char * NestedAAClipBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 113 of file AAClipBench.cpp.

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

◆ recurse()

void NestedAAClipBench::recurse ( SkCanvas canvas,
int  depth,
const SkPoint offset 
)
inlineprotected

Definition at line 116 of file AAClipBench.cpp.

118 {
119
120 canvas->save();
121
122 SkRect temp = SkRect::MakeLTRB(0, 0,
123 fSizes[depth].fX, fSizes[depth].fY);
124 temp.offset(offset);
125
126 SkPath path;
127 path.addRoundRect(temp, SkIntToScalar(3), SkIntToScalar(3));
128 SkASSERT(path.isConvex());
129
130 canvas->clipPath(path, SkClipOp::kIntersect, fDoAA);
131
132 if (kNestingDepth == depth) {
133 // we only draw the draw rect at the lowest nesting level
135 paint.setColor(0xff000000 | fRandom.nextU());
136 canvas->drawRect(fDrawRect, paint);
137 } else {
138 SkPoint childOffset = offset;
139 this->recurse(canvas, depth+1, childOffset);
140
141 childOffset += fSizes[depth+1];
142 this->recurse(canvas, depth+1, childOffset);
143
144 childOffset.fX = offset.fX + fSizes[depth+1].fX;
145 childOffset.fY = offset.fY;
146 this->recurse(canvas, depth+1, childOffset);
147
148 childOffset.fX = offset.fX;
149 childOffset.fY = offset.fY + fSizes[depth+1].fY;
150 this->recurse(canvas, depth+1, childOffset);
151 }
152
153 canvas->restore();
154 }
#define SkASSERT(cond)
Definition SkAssert.h:116
void drawRect(const SkRect &rect, const SkPaint &paint)
void restore()
Definition SkCanvas.cpp:465
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
int save()
Definition SkCanvas.cpp:451
uint32_t nextU()
Definition SkRandom.h:42
const Paint & paint
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
float fX
x-axis value
float fY
y-axis value
void offset(float dx, float dy)
Definition SkRect.h:1016

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