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

Public Member Functions

 RepeatTileBench (SkColorType ct, SkAlphaType at=kPremul_SkAlphaType)
 
- 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 onDelayedSetup () 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 36 of file RepeatTileBench.cpp.

Constructor & Destructor Documentation

◆ RepeatTileBench()

RepeatTileBench::RepeatTileBench ( SkColorType  ct,
SkAlphaType  at = kPremul_SkAlphaType 
)
inline

Definition at line 42 of file RepeatTileBench.cpp.

42 : fAlphaType(at) {
43 const int w = 50;
44 const int h = 50;
45
46 fBitmap.setInfo(SkImageInfo::Make(w, h, ct, at));
47 fName.printf("repeatTile_%s_%c",
49 kOpaque_SkAlphaType == at ? 'X' : 'A');
50 }
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
bool setInfo(const SkImageInfo &imageInfo, size_t rowBytes=0)
Definition: SkBitmap.cpp:114
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
const char * colortype_name(SkColorType ct)
Definition: ToolUtils.cpp:65
SkScalar w
SkScalar h
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

Member Function Documentation

◆ onDelayedSetup()

void RepeatTileBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 57 of file RepeatTileBench.cpp.

57 {
58 fBitmap.allocPixels();
59 fBitmap.eraseColor(kOpaque_SkAlphaType == fAlphaType ? SK_ColorWHITE : 0);
60
61 draw_into_bitmap(fBitmap);
62
65 }
static void draw_into_bitmap(const SkBitmap &bm)
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:258
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkBitmap.cpp:669
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
void setShader(sk_sp< SkShader > shader)

◆ onDraw()

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

Implements Benchmark.

Definition at line 68 of file RepeatTileBench.cpp.

68 {
69 SkPaint paint(fPaint);
70 this->setupPaint(&paint);
71
72 for (int i = 0; i < loops; i++) {
73 canvas->drawPaint(paint);
74 }
75 }
virtual void setupPaint(SkPaint *paint)
Definition: Benchmark.cpp:55
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668
const Paint & paint
Definition: color_source.cc:38

◆ onGetName()

const char * RepeatTileBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 53 of file RepeatTileBench.cpp.

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

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