OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 SkRect r = { 20, 20, 40, 40 }; | 71 SkRect r = { 20, 20, 40, 40 }; |
72 SkScalar rad = 4; | 72 SkScalar rad = 4; |
73 fRec.fRRect.setRectXY(r, rad, rad); | 73 fRec.fRRect.setRectXY(r, rad, rad); |
74 } | 74 } |
75 | 75 |
76 protected: | 76 protected: |
77 virtual const char* onGetName() { | 77 virtual const char* onGetName() { |
78 return fName.c_str(); | 78 return fName.c_str(); |
79 } | 79 } |
80 | 80 |
81 virtual void onDraw(SkCanvas* canvas) { | 81 virtual void onDraw(const int loops, SkCanvas* canvas) { |
82 fRec.fCanvas = canvas; | 82 fRec.fCanvas = canvas; |
83 this->setupPaint(&fRec.fPaint); | 83 this->setupPaint(&fRec.fPaint); |
84 fRec.fPaint.setStyle(SkPaint::kStroke_Style); | 84 fRec.fPaint.setStyle(SkPaint::kStroke_Style); |
85 fRec.fPaint.setStrokeJoin(fJoin); | 85 fRec.fPaint.setStrokeJoin(fJoin); |
86 fRec.fPaint.setStrokeWidth(5); | 86 fRec.fPaint.setStrokeWidth(5); |
87 fProc(&fRec, this->getLoops()); | 87 fProc(&fRec, loops); |
88 } | 88 } |
89 | 89 |
90 private: | 90 private: |
91 typedef SkBenchmark INHERITED; | 91 typedef SkBenchmark INHERITED; |
92 }; | 92 }; |
93 | 93 |
94 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rect); ) | 94 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rect); ) |
95 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rect); ) | 95 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rect); ) |
96 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rect); ) | 96 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rect); ) |
97 | 97 |
98 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rrect); ) | 98 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rrect); ) |
99 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rrect); ) | 99 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rrect); ) |
100 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rrect); ) | 100 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rrect); ) |
101 | 101 |
102 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_oval); ) | 102 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_oval); ) |
103 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_oval); ) | 103 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_oval); ) |
104 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_oval); ) | 104 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_oval); ) |
OLD | NEW |