OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 bool isVisual() override { return true; } | 42 bool isVisual() override { return true; } |
43 | 43 |
44 protected: | 44 protected: |
45 virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) { | 45 virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) { |
46 c->drawRect(r, p); | 46 c->drawRect(r, p); |
47 } | 47 } |
48 | 48 |
49 const char* onGetName() override { return computeName("rects"); } | 49 const char* onGetName() override { return computeName("rects"); } |
50 | 50 |
51 void onPreDraw() override { | 51 void onDelayedSetup() override { |
52 SkRandom rand; | 52 SkRandom rand; |
53 const SkScalar offset = SK_Scalar1/3; | 53 const SkScalar offset = SK_Scalar1/3; |
54 for (int i = 0; i < N; i++) { | 54 for (int i = 0; i < N; i++) { |
55 int x = rand.nextU() % W; | 55 int x = rand.nextU() % W; |
56 int y = rand.nextU() % H; | 56 int y = rand.nextU() % H; |
57 int w = rand.nextU() % W; | 57 int w = rand.nextU() % W; |
58 int h = rand.nextU() % H; | 58 int h = rand.nextU() % H; |
59 w >>= fShift; | 59 w >>= fShift; |
60 h >>= fShift; | 60 h >>= fShift; |
61 x -= w/2; | 61 x -= w/2; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 "maskopaque");) | 302 "maskopaque");) |
303 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, | 303 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
304 BlitMaskBench::kMaskBlack, | 304 BlitMaskBench::kMaskBlack, |
305 "maskblack");) | 305 "maskblack");) |
306 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, | 306 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
307 BlitMaskBench::kMaskColor, | 307 BlitMaskBench::kMaskColor, |
308 "maskcolor");) | 308 "maskcolor");) |
309 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, | 309 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
310 BlitMaskBench::KMaskShader, | 310 BlitMaskBench::KMaskShader, |
311 "maskshader");) | 311 "maskshader");) |
OLD | NEW |