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

Side by Side Diff: bench/ImageFilterDAGBench.cpp

Issue 233383002: Add a new bench that tests a simple image filter DAG. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gyp/bench.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkBenchmark.h"
9 #include "SkBlurImageFilter.h"
10 #include "SkMergeImageFilter.h"
11 #include "SkCanvas.h"
12
13 #define NUM_COPIES 5
Justin Novosad 2014/04/10 15:51:28 skia style: enum { kNumCopies = 5 };
Stephen White 2014/04/10 16:13:44 Done.
14
15 class ImageFilterDAGBench : public SkBenchmark {
16 public:
17 ImageFilterDAGBench() {
18 }
19
20 protected:
21 virtual const char* onGetName() SK_OVERRIDE {
22 return "image_filter_dag";
23 }
24
25 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
26 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(20.0f, 20.0f) );
27 SkImageFilter* inputs[NUM_COPIES];
28 for (int i = 0; i < NUM_COPIES; ++i) {
29 inputs[i] = blur.get();
Justin Novosad 2014/04/10 15:51:28 num copies is a misleading name. You are not maki
Stephen White 2014/04/10 16:13:44 Done.
30 }
31 SkAutoTUnref<SkImageFilter> merge(SkMergeImageFilter::Create(inputs, NUM _COPIES));
32 SkPaint paint;
33 paint.setImageFilter(merge);
34 SkRect rect = SkRect::Make(SkIRect::MakeWH(400, 400));
35 canvas->drawRect(rect, paint);
36 }
37
38 private:
39 typedef SkBenchmark INHERITED;
40 };
41
42 DEF_BENCH(return new ImageFilterDAGBench;)
OLDNEW
« no previous file with comments | « no previous file | gyp/bench.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698