Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(286)

Side by Side Diff: bench/RectBench.cpp

Issue 96099: Whitespace fix: remove whitespace from the end of lines.
Patch Set: Created 16 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bench/BitmapBench.cpp ('k') | bench/SkBenchmark.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkBenchmark.h" 1 #include "SkBenchmark.h"
2 #include "SkCanvas.h" 2 #include "SkCanvas.h"
3 #include "SkPaint.h" 3 #include "SkPaint.h"
4 #include "SkRandom.h" 4 #include "SkRandom.h"
5 #include "SkString.h" 5 #include "SkString.h"
6 6
7 class RectBench : public SkBenchmark { 7 class RectBench : public SkBenchmark {
8 public: 8 public:
9 int fShift; 9 int fShift;
10 enum { 10 enum {
(...skipping 13 matching lines...) Expand all
24 int h = rand.nextU() % H; 24 int h = rand.nextU() % H;
25 w >>= shift; 25 w >>= shift;
26 h >>= shift; 26 h >>= shift;
27 x -= w/2; 27 x -= w/2;
28 y -= h/2; 28 y -= h/2;
29 fRects[i].set(SkIntToScalar(x), SkIntToScalar(y), 29 fRects[i].set(SkIntToScalar(x), SkIntToScalar(y),
30 SkIntToScalar(x+w), SkIntToScalar(y+h)); 30 SkIntToScalar(x+w), SkIntToScalar(y+h));
31 fColors[i] = rand.nextU() | 0xFF808080; 31 fColors[i] = rand.nextU() | 0xFF808080;
32 } 32 }
33 } 33 }
34 34
35 SkString fName; 35 SkString fName;
36 const char* computeName(const char root[]) { 36 const char* computeName(const char root[]) {
37 fName.set(root); 37 fName.set(root);
38 fName.appendS32(fShift); 38 fName.appendS32(fShift);
39 return fName.c_str(); 39 return fName.c_str();
40 } 40 }
41 41
42 protected: 42 protected:
43 virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) { 43 virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) {
44 c->drawRect(r, p); 44 c->drawRect(r, p);
45 } 45 }
46 46
47 virtual const char* onGetName() { return computeName("rects"); } 47 virtual const char* onGetName() { return computeName("rects"); }
48 virtual void onDraw(SkCanvas* canvas) { 48 virtual void onDraw(SkCanvas* canvas) {
49 SkPaint paint; 49 SkPaint paint;
50 for (int i = 0; i < N; i++) { 50 for (int i = 0; i < N; i++) {
51 paint.setColor(fColors[i]); 51 paint.setColor(fColors[i]);
(...skipping 21 matching lines...) Expand all
73 c->drawRoundRect(r, r.width() / 4, r.height() / 4, p); 73 c->drawRoundRect(r, r.width() / 4, r.height() / 4, p);
74 } 74 }
75 virtual const char* onGetName() { return computeName("rrects"); } 75 virtual const char* onGetName() { return computeName("rrects"); }
76 }; 76 };
77 77
78 class PointsBench : public RectBench { 78 class PointsBench : public RectBench {
79 public: 79 public:
80 SkCanvas::PointMode fMode; 80 SkCanvas::PointMode fMode;
81 const char* fName; 81 const char* fName;
82 82
83 PointsBench(SkCanvas::PointMode mode, const char* name) : 83 PointsBench(SkCanvas::PointMode mode, const char* name) :
84 RectBench(2), fMode(mode) { 84 RectBench(2), fMode(mode) {
85 fName = name; 85 fName = name;
86 } 86 }
87 87
88 protected: 88 protected:
89 virtual void onDraw(SkCanvas* canvas) { 89 virtual void onDraw(SkCanvas* canvas) {
90 static const SkScalar gSizes[] = { 90 static const SkScalar gSizes[] = {
91 SkIntToScalar(7), 0 91 SkIntToScalar(7), 0
92 }; 92 };
93 93
94 SkPaint paint; 94 SkPaint paint;
95 paint.setStrokeCap(SkPaint::kRound_Cap); 95 paint.setStrokeCap(SkPaint::kRound_Cap);
96 96
97 for (size_t i = 0; i < SK_ARRAY_COUNT(gSizes); i++) { 97 for (size_t i = 0; i < SK_ARRAY_COUNT(gSizes); i++) {
98 paint.setStrokeWidth(gSizes[i]); 98 paint.setStrokeWidth(gSizes[i]);
99 this->setupPaint(&paint); 99 this->setupPaint(&paint);
100 canvas->drawPoints(fMode, N * 2, 100 canvas->drawPoints(fMode, N * 2,
101 reinterpret_cast<const SkPoint*>(fRects), paint); 101 reinterpret_cast<const SkPoint*>(fRects), paint);
102 paint.setColor(fColors[i]); 102 paint.setColor(fColors[i]);
103 } 103 }
104 } 104 }
105 virtual const char* onGetName() { return fName; } 105 virtual const char* onGetName() { return fName; }
106 }; 106 };
(...skipping 17 matching lines...) Expand all
124 static BenchRegistry gRectReg1(RectFactory1); 124 static BenchRegistry gRectReg1(RectFactory1);
125 static BenchRegistry gRectReg2(RectFactory2); 125 static BenchRegistry gRectReg2(RectFactory2);
126 static BenchRegistry gOvalReg1(OvalFactory1); 126 static BenchRegistry gOvalReg1(OvalFactory1);
127 static BenchRegistry gOvalReg2(OvalFactory2); 127 static BenchRegistry gOvalReg2(OvalFactory2);
128 static BenchRegistry gRRectReg1(RRectFactory1); 128 static BenchRegistry gRRectReg1(RRectFactory1);
129 static BenchRegistry gRRectReg2(RRectFactory2); 129 static BenchRegistry gRRectReg2(RRectFactory2);
130 static BenchRegistry gPointsReg(PointsFactory); 130 static BenchRegistry gPointsReg(PointsFactory);
131 static BenchRegistry gLinesReg(LinesFactory); 131 static BenchRegistry gLinesReg(LinesFactory);
132 static BenchRegistry gPolygonReg(PolygonFactory); 132 static BenchRegistry gPolygonReg(PolygonFactory);
133 133
OLDNEW
« no previous file with comments | « bench/BitmapBench.cpp ('k') | bench/SkBenchmark.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b