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

Public Member Functions

 WritePixelsBench (SkColorType ct, SkAlphaType at, sk_sp< SkColorSpace > cs)
 
- 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 ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 18 of file WritePixelsBench.cpp.

Constructor & Destructor Documentation

◆ WritePixelsBench()

WritePixelsBench::WritePixelsBench ( SkColorType  ct,
SkAlphaType  at,
sk_sp< SkColorSpace cs 
)
inline

Definition at line 20 of file WritePixelsBench.cpp.

21 : fColorType(ct)
22 , fAlphaType(at)
23 , fCS(cs)
24 {
25 fName.printf("writepix_%s_%s_%s",
26 at == kPremul_SkAlphaType ? "pm" : "um",
27 ct == kRGBA_8888_SkColorType ? "rgba" : "bgra",
28 cs ? "srgb" : "null");
29 }
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 36 of file WritePixelsBench.cpp.

36 {
37 SkISize size = canvas->getBaseLayerSize();
38
39 SkImageInfo info = SkImageInfo::Make(size, fColorType, fAlphaType, fCS);
40 SkBitmap bmp;
41 bmp.allocPixels(info);
43
44 for (int loop = 0; loop < loops; ++loop) {
45 canvas->writePixels(info, bmp.getPixels(), bmp.rowBytes(), 0, 0);
46 }
47 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:258
size_t rowBytes() const
Definition: SkBitmap.h:238
void * getPixels() const
Definition: SkBitmap.h:283
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
bool writePixels(const SkImageInfo &info, const void *pixels, size_t rowBytes, int x, int y)
Definition: SkCanvas.cpp:399
virtual SkISize getBaseLayerSize() const
Definition: SkCanvas.cpp:369
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
Definition: SkSize.h:16
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

◆ onGetName()

const char * WritePixelsBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 32 of file WritePixelsBench.cpp.

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

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