OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
11 #include "SkNullCanvas.h" | 11 #include "SkNullCanvas.h" |
12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
14 #include "SkPictureRecorder.h" | 14 #include "SkPictureRecorder.h" |
15 #include "SkString.h" | 15 #include "SkString.h" |
16 | 16 |
17 class PictureNesting : public Benchmark { | 17 class PictureNesting : public Benchmark { |
18 public: | 18 public: |
19 PictureNesting(const char* name, int maxLevel, int maxPictureLevel) | 19 PictureNesting(const char* name, int maxLevel, int maxPictureLevel) |
20 : fMaxLevel(maxLevel) | 20 : fMaxLevel(maxLevel) |
21 , fMaxPictureLevel(maxPictureLevel) { | 21 , fMaxPictureLevel(maxPictureLevel) { |
22 | 22 |
23 fPaint.setColor(SK_ColorRED); | 23 fPaint.setColor(SK_ColorRED); |
24 fPaint.setAntiAlias(true); | 24 fPaint.setAntiAlias(true); |
25 fPaint.setStyle(SkPaint::kStroke_Style); | 25 fPaint.setStyle(SkPaint::kStroke_Style); |
26 fName.printf("picture_nesting_%s_%d", name, | 26 SkAutoTUnref<SkCanvas> nullCanvas(SkCreateNullCanvas()); |
tfarina
2014/09/17 16:42:34
looks right, since nothing in sierpinsky() takes o
| |
27 this->sierpinsky(SkCreateNullCanvas(), 0, fPaint)); | 27 fName.printf("picture_nesting_%s_%d", name, this->sierpinsky(nullCanvas, 0, fPaint)); |
28 } | 28 } |
29 | 29 |
30 protected: | 30 protected: |
31 virtual const char* onGetName() SK_OVERRIDE { | 31 virtual const char* onGetName() SK_OVERRIDE { |
32 return fName.c_str(); | 32 return fName.c_str(); |
33 } | 33 } |
34 | 34 |
35 void doDraw(SkCanvas* canvas) { | 35 void doDraw(SkCanvas* canvas) { |
36 SkIPoint canvasSize = onGetSize(); | 36 SkIPoint canvasSize = onGetSize(); |
37 canvas->save(); | 37 canvas->save(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 | 154 |
155 DEF_BENCH( return new PictureNestingPlayback(8, 0); ) | 155 DEF_BENCH( return new PictureNestingPlayback(8, 0); ) |
156 DEF_BENCH( return new PictureNestingPlayback(8, 1); ) | 156 DEF_BENCH( return new PictureNestingPlayback(8, 1); ) |
157 DEF_BENCH( return new PictureNestingPlayback(8, 2); ) | 157 DEF_BENCH( return new PictureNestingPlayback(8, 2); ) |
158 DEF_BENCH( return new PictureNestingPlayback(8, 3); ) | 158 DEF_BENCH( return new PictureNestingPlayback(8, 3); ) |
159 DEF_BENCH( return new PictureNestingPlayback(8, 4); ) | 159 DEF_BENCH( return new PictureNestingPlayback(8, 4); ) |
160 DEF_BENCH( return new PictureNestingPlayback(8, 5); ) | 160 DEF_BENCH( return new PictureNestingPlayback(8, 5); ) |
161 DEF_BENCH( return new PictureNestingPlayback(8, 6); ) | 161 DEF_BENCH( return new PictureNestingPlayback(8, 6); ) |
162 DEF_BENCH( return new PictureNestingPlayback(8, 7); ) | 162 DEF_BENCH( return new PictureNestingPlayback(8, 7); ) |
163 DEF_BENCH( return new PictureNestingPlayback(8, 8); ) | 163 DEF_BENCH( return new PictureNestingPlayback(8, 8); ) |
OLD | NEW |