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

Public Types

enum  kMaskType { kMaskOpaque = 0 , kMaskBlack , kMaskColor , KMaskShader }
 
- Public Types inherited from RectBench
enum  { W = 640 , H = 480 , N = 300 }
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

 BlitMaskBench (SkCanvas::PointMode mode, BlitMaskBench::kMaskType type, const char *name)
 
- Public Member Functions inherited from RectBench
 RectBench (int shift, int stroke=0, bool aa=true, bool perspective=false)
 
const char * computeName (const char root[])
 
- 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
 

Public Attributes

SkCanvas::PointMode fMode
 
- Public Attributes inherited from RectBench
int fShift
 
int fStroke
 
SkRect fRects [N]
 
SkColor fColors [N]
 
bool fAA
 
bool fPerspective
 

Protected Member Functions

void onDraw (int loops, SkCanvas *canvas) override
 
const char * onGetName () override
 
- Protected Member Functions inherited from RectBench
virtual void drawThisRect (SkCanvas *c, const SkRect &r, const SkPaint &p)
 
const char * onGetName () override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *canvas) override
 
void setupPaint (SkPaint *paint) 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 261 of file RectBench.cpp.

Member Enumeration Documentation

◆ kMaskType

Enumerator
kMaskOpaque 
kMaskBlack 
kMaskColor 
KMaskShader 

Definition at line 263 of file RectBench.cpp.

263 {
264 kMaskOpaque = 0,
268 };

Constructor & Destructor Documentation

◆ BlitMaskBench()

BlitMaskBench::BlitMaskBench ( SkCanvas::PointMode  mode,
BlitMaskBench::kMaskType  type,
const char *  name 
)
inline

Definition at line 271 of file RectBench.cpp.

272 :
273 RectBench(2), fMode(mode), _type(type) {
274 fName = name;
275 }
GLenum type
SkCanvas::PointMode fMode
Definition: RectBench.cpp:269
RectBench(int shift, int stroke=0, bool aa=true, bool perspective=false)
Definition: RectBench.cpp:33
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
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

Member Function Documentation

◆ onDraw()

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

Reimplemented from RectBench.

Definition at line 278 of file RectBench.cpp.

278 {
279 SkScalar gSizes[] = {
281 };
282 size_t sizes = std::size(gSizes);
283
284 if (FLAGS_strokeWidth >= 0) {
285 gSizes[0] = (SkScalar)FLAGS_strokeWidth;
286 sizes = 1;
287 }
288 SkRandom rand;
289 SkColor color = 0xFF000000;
290 U8CPU alpha = 0xFF;
292 paint.setStrokeCap(SkPaint::kRound_Cap);
293 if (_type == KMaskShader) {
294 SkBitmap srcBM;
295 srcBM.allocN32Pixels(10, 1);
296 srcBM.eraseColor(0xFF00FF00);
297
298 paint.setShader(srcBM.makeShader(SkSamplingOptions()));
299 }
300 for (int loop = 0; loop < loops; loop++) {
301 for (size_t i = 0; i < sizes; i++) {
302 switch (_type) {
303 case kMaskOpaque:
304 color = fColors[i];
305 alpha = 0xFF;
306 break;
307 case kMaskBlack:
308 alpha = 0xFF;
309 color = 0xFF000000;
310 break;
311 case kMaskColor:
312 color = fColors[i];
313 alpha = rand.nextU() & 255;
314 break;
315 case KMaskShader:
316 break;
317 }
318 paint.setStrokeWidth(gSizes[i]);
319 this->setupPaint(&paint);
320 paint.setColor(color);
321 paint.setAlpha(alpha);
322 canvas->drawPoints(fMode, N * 2, reinterpret_cast<SkPoint*>(fRects), paint);
323 }
324 }
325 }
unsigned U8CPU
Definition: SkCPUTypes.h:18
uint32_t SkColor
Definition: SkColor.h:37
#define SkIntToScalar(x)
Definition: SkScalar.h:57
SkColor fColors[N]
Definition: RectBench.cpp:29
SkRect fRects[N]
Definition: RectBench.cpp:28
void setupPaint(SkPaint *paint) override
Definition: RectBench.cpp:104
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkBitmap.cpp:669
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
Definition: SkCanvas.cpp:1710
@ kRound_Cap
adds circle
Definition: SkPaint.h:335
uint32_t nextU()
Definition: SkRandom.h:42
const Paint & paint
Definition: color_source.cc:38
DlColor color
float SkScalar
Definition: extension.cpp:12
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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ onGetName()

const char * BlitMaskBench::onGetName ( )
inlineoverrideprotectedvirtual

Reimplemented from RectBench.

Definition at line 326 of file RectBench.cpp.

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

Member Data Documentation

◆ fMode

SkCanvas::PointMode BlitMaskBench::fMode

Definition at line 269 of file RectBench.cpp.


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