Index: bench/ImageFilterDAGBench.cpp |
diff --git a/bench/ImageFilterDAGBench.cpp b/bench/ImageFilterDAGBench.cpp |
index d66d287e1817f217f75a652607c7b07dfe3bdb07..5fdf95b06d37ee1e387a4b084f7c65b86743cac7 100644 |
--- a/bench/ImageFilterDAGBench.cpp |
+++ b/bench/ImageFilterDAGBench.cpp |
@@ -11,12 +11,10 @@ |
#include "SkCanvas.h" |
#include "SkMergeImageFilter.h" |
-enum { kNumInputs = 5 }; |
// Exercise a blur filter connected to 5 inputs of the same merge filter. |
// This bench shows an improvement in performance once cacheing of re-used |
// nodes is implemented, since the DAG is no longer flattened to a tree. |
- |
class ImageFilterDAGBench : public Benchmark { |
public: |
ImageFilterDAGBench() {} |
@@ -27,21 +25,23 @@ protected: |
} |
void onDraw(int loops, SkCanvas* canvas) override { |
+ const SkRect rect = SkRect::Make(SkIRect::MakeWH(400, 400)); |
+ |
for (int j = 0; j < loops; j++) { |
- SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(20.0f, 20.0f)); |
- SkImageFilter* inputs[kNumInputs]; |
+ sk_sp<SkImageFilter> blur(SkBlurImageFilter::Create(20.0f, 20.0f)); |
+ sk_sp<SkImageFilter> inputs[kNumInputs]; |
for (int i = 0; i < kNumInputs; ++i) { |
- inputs[i] = blur.get(); |
+ inputs[i] = blur; |
} |
- SkAutoTUnref<SkImageFilter> merge(SkMergeImageFilter::Create(inputs, kNumInputs)); |
SkPaint paint; |
- paint.setImageFilter(merge); |
- SkRect rect = SkRect::Make(SkIRect::MakeWH(400, 400)); |
+ paint.setImageFilter(SkMergeImageFilter::Make(inputs, kNumInputs)); |
canvas->drawRect(rect, paint); |
} |
} |
private: |
+ static const int kNumInputs = 5; |
+ |
typedef Benchmark INHERITED; |
}; |