Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: bench/ImageFilterDAGBench.cpp

Issue 1847583002: Update SkMergeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to To Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/MergeBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « no previous file | bench/MergeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698