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

Public Member Functions

 MipmapBench (int w, int h, bool halfFloat=false)
 
- 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

bool isSuitableFor (Backend backend) override
 
const char * onGetName () override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *) 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 13 of file MipmapBench.cpp.

Constructor & Destructor Documentation

◆ MipmapBench()

MipmapBench::MipmapBench ( int  w,
int  h,
bool  halfFloat = false 
)
inline

Definition at line 20 of file MipmapBench.cpp.

21 : fW(w), fH(h), fHalfFoat(halfFloat)
22 {
23 fName.printf("mipmap_build_%dx%d", w, h);
24 if (halfFloat) {
25 fName.append("_f16");
26 }
27 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
void append(const char text[])
Definition: SkString.h:203
SkScalar w
SkScalar h

Member Function Documentation

◆ isSuitableFor()

bool MipmapBench::isSuitableFor ( Backend  backend)
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 30 of file MipmapBench.cpp.

30 {
32 }
const char * backend

◆ onDelayedSetup()

void MipmapBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 36 of file MipmapBench.cpp.

36 {
37 SkColorType ct = fHalfFoat ? kRGBA_F16_SkColorType : kN32_SkColorType;
40 fBitmap.allocPixels(info);
41 fBitmap.eraseColor(SK_ColorWHITE); // so we don't read uninitialized memory
42 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
SkColorType
Definition: SkColorType.h:19
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:258
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
static sk_sp< SkColorSpace > MakeSRGB()
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

◆ onDraw()

void MipmapBench::onDraw ( int  loops,
SkCanvas  
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 44 of file MipmapBench.cpp.

44 {
45 for (int i = 0; i < loops * 4; i++) {
46 SkMipmap::Build(fBitmap, nullptr)->unref();
47 }
48 }
void unref() const
Definition: SkCachedData.h:31
static SkMipmap * Build(const SkPixmap &src, SkDiscardableFactoryProc, bool computeContents=true)
Definition: SkMipmap.cpp:45

◆ onGetName()

const char * MipmapBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 34 of file MipmapBench.cpp.

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

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