OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 SkASSERT(idx[i] < PTS); | 61 SkASSERT(idx[i] < PTS); |
62 } | 62 } |
63 idx += 6; | 63 idx += 6; |
64 } | 64 } |
65 } | 65 } |
66 yy += dy; | 66 yy += dy; |
67 } | 67 } |
68 SkASSERT(PTS == pts - fPts); | 68 SkASSERT(PTS == pts - fPts); |
69 SkASSERT(IDX == idx - fIdx); | 69 SkASSERT(IDX == idx - fIdx); |
70 | 70 |
71 SkMWCRandom rand; | 71 SkRandom rand; |
72 for (int i = 0; i < PTS; ++i) { | 72 for (int i = 0; i < PTS; ++i) { |
73 fColors[i] = rand.nextU() | (0xFF << 24); | 73 fColors[i] = rand.nextU() | (0xFF << 24); |
74 } | 74 } |
75 | 75 |
76 fName.set("verts"); | 76 fName.set("verts"); |
77 } | 77 } |
78 | 78 |
79 protected: | 79 protected: |
80 virtual const char* onGetName() { return fName.c_str(); } | 80 virtual const char* onGetName() { return fName.c_str(); } |
81 virtual void onDraw(SkCanvas* canvas) { | 81 virtual void onDraw(SkCanvas* canvas) { |
82 SkPaint paint; | 82 SkPaint paint; |
83 this->setupPaint(&paint); | 83 this->setupPaint(&paint); |
84 | 84 |
85 for (int i = 0; i < N; i++) { | 85 for (int i = 0; i < N; i++) { |
86 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS, | 86 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS, |
87 fPts, NULL, fColors, NULL, fIdx, IDX, paint); | 87 fPts, NULL, fColors, NULL, fIdx, IDX, paint); |
88 } | 88 } |
89 } | 89 } |
90 private: | 90 private: |
91 typedef SkBenchmark INHERITED; | 91 typedef SkBenchmark INHERITED; |
92 }; | 92 }; |
93 | 93 |
94 /////////////////////////////////////////////////////////////////////////////// | 94 /////////////////////////////////////////////////////////////////////////////// |
95 | 95 |
96 static SkBenchmark* Fact(void* p) { return SkNEW_ARGS(VertBench, (p)); } | 96 static SkBenchmark* Fact(void* p) { return SkNEW_ARGS(VertBench, (p)); } |
97 | 97 |
98 static BenchRegistry gReg(Fact); | 98 static BenchRegistry gReg(Fact); |
OLD | NEW |