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

Public Member Functions

 ImageFilterDAGBench ()
 
- 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 27 of file ImageFilterDAGBench.cpp.

Constructor & Destructor Documentation

◆ ImageFilterDAGBench()

ImageFilterDAGBench::ImageFilterDAGBench ( )
inline

Definition at line 29 of file ImageFilterDAGBench.cpp.

29{}

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 36 of file ImageFilterDAGBench.cpp.

36 {
37 const SkRect rect = SkRect::Make(SkIRect::MakeWH(400, 400));
38
39 // Set up the filters once, we're not interested in measuring allocation time here
40 sk_sp<SkImageFilter> blur(SkImageFilters::Blur(20.0f, 20.0f, nullptr));
41 sk_sp<SkImageFilter> inputs[kNumInputs];
42 for (int i = 0; i < kNumInputs; ++i) {
43 inputs[i] = blur;
44 }
46 paint.setImageFilter(SkImageFilters::Merge(inputs, kNumInputs));
47
48 // Only measure the filter computations done in drawRect()
49 // TODO (michaelludwig) - This benchmark, and the ones defined below, allocate their filters
50 // outside of the loop. This means that repeatedly drawing with the same filter will hit
51 // the global image filter cache inside the loop. Raster backend uses this cache so will see
52 // artificially improved performance. Ganesh will not because it uses a cache per filter
53 // call, so only within-DAG cache hits are measured (as desired). skbug:9297 wants to move
54 // raster backend to the same pattern, which will make the benchmark executions fair again.
55 for (int j = 0; j < loops; j++) {
56 canvas->drawRect(rect, paint);
57 }
58 }
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
static sk_sp< SkImageFilter > Merge(sk_sp< SkImageFilter > *const filters, int count, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition: SkRect.h:56
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669

◆ onGetName()

const char * ImageFilterDAGBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 32 of file ImageFilterDAGBench.cpp.

32 {
33 return "image_filter_dag";
34 }

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