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

Side by Side Diff: bench/StrokeBench.cpp

Issue 23876006: Refactoring: get rid of the SkBenchmark void* parameter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head Created 7 years, 3 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 | « bench/SortBench.cpp ('k') | bench/TableBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // 52 //
53 // Test drawing a small stroked version to see the effect of special-casing 53 // Test drawing a small stroked version to see the effect of special-casing
54 // our stroke code for these convex single-contour shapes. 54 // our stroke code for these convex single-contour shapes.
55 // 55 //
56 class StrokeRRectBench : public SkBenchmark { 56 class StrokeRRectBench : public SkBenchmark {
57 SkString fName; 57 SkString fName;
58 SkPaint::Join fJoin; 58 SkPaint::Join fJoin;
59 RRectRec fRec; 59 RRectRec fRec;
60 DrawProc fProc; 60 DrawProc fProc;
61 public: 61 public:
62 StrokeRRectBench(void* param, SkPaint::Join j, DrawProc proc) : SkBenchmark( param) { 62 StrokeRRectBench(SkPaint::Join j, DrawProc proc) {
63 static const char* gJoinName[] = { 63 static const char* gJoinName[] = {
64 "miter", "round", "bevel" 64 "miter", "round", "bevel"
65 }; 65 };
66 66
67 fJoin = j; 67 fJoin = j;
68 fProc = proc; 68 fProc = proc;
69 fName.printf("draw_stroke_%s_%s", proc(NULL, 0), gJoinName[j]); 69 fName.printf("draw_stroke_%s_%s", proc(NULL, 0), gJoinName[j]);
70 70
71 SkRect r = { 20, 20, 40, 40 }; 71 SkRect r = { 20, 20, 40, 40 };
72 SkScalar rad = 4; 72 SkScalar rad = 4;
(...skipping 11 matching lines...) Expand all
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, this->getLoops());
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(p, SkPaint::kRound_Join, draw_rect); ) 94 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rect); )
95 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kBevel_Join, draw_rect); ) 95 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rect); )
96 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kMiter_Join, draw_rect); ) 96 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rect); )
97 97
98 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kRound_Join, draw_rrect); ) 98 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rrect); )
99 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kBevel_Join, draw_rrect); ) 99 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rrect); )
100 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kMiter_Join, draw_rrect); ) 100 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rrect); )
101 101
102 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kRound_Join, draw_oval); ) 102 DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_oval); )
103 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kBevel_Join, draw_oval); ) 103 DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_oval); )
104 DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kMiter_Join, draw_oval); ) 104 DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_oval); )
OLDNEW
« no previous file with comments | « bench/SortBench.cpp ('k') | bench/TableBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698