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

Public Member Functions

 TileImageFilterBench (int tileSize)
 
- 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 23 of file TileImageFilterBench.cpp.

Constructor & Destructor Documentation

◆ TileImageFilterBench()

TileImageFilterBench::TileImageFilterBench ( int  tileSize)
inline

Definition at line 25 of file TileImageFilterBench.cpp.

25 : fTileSize(tileSize) {
26 if (tileSize > 0) {
27 fName.printf("tile_image_filter_tiled_%d", tileSize);
28 } else {
29 fName.printf("tile_image_filter");
30 }
31 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 38 of file TileImageFilterBench.cpp.

38 {
40 paint.setImageFilter(SkImageFilters::Tile(
41 SkRect::MakeWH(50, 50), SkRect::MakeWH(WIDTH, HEIGHT), nullptr));
42
43 for (int i = 0; i < loops; i++) {
44 if (fTileSize > 0) {
45 for (int y = 0; y < HEIGHT; y += fTileSize) {
46 for (int x = 0; x < WIDTH; x += fTileSize) {
47 canvas->save();
48 SkIRect clipIRect = SkIRect::MakeXYWH(x, y, fTileSize, fTileSize);
49 canvas->clipRect(SkRect::Make(clipIRect));
51 canvas->restore();
52 }
53 }
54 } else {
56 }
57 }
58 }
#define WIDTH
#define HEIGHT
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
int save()
Definition: SkCanvas.cpp:447
static sk_sp< SkImageFilter > Tile(const SkRect &src, const SkRect &dst, sk_sp< SkImageFilter > input)
const Paint & paint
Definition: color_source.cc:38
double y
double x
Definition: SkRect.h:32
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
Definition: SkRect.h:104
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ onGetName()

const char * TileImageFilterBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 34 of file TileImageFilterBench.cpp.

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

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