| 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 "Benchmark.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| 11 #include "SkRandom.h" | 11 #include "SkRandom.h" |
| 12 #include "SkShader.h" |
| 12 #include "SkString.h" | 13 #include "SkString.h" |
| 13 #include "SkShader.h" | |
| 14 | 14 |
| 15 enum VertFlags { | 15 enum VertFlags { |
| 16 kColors_VertFlag, | 16 kColors_VertFlag, |
| 17 kTexture_VertFlag, | 17 kTexture_VertFlag, |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 class VertBench : public SkBenchmark { | 20 class VertBench : public Benchmark { |
| 21 SkString fName; | 21 SkString fName; |
| 22 enum { | 22 enum { |
| 23 W = 640, | 23 W = 640, |
| 24 H = 480, | 24 H = 480, |
| 25 ROW = 20, | 25 ROW = 20, |
| 26 COL = 20, | 26 COL = 20, |
| 27 PTS = (ROW + 1) * (COL + 1), | 27 PTS = (ROW + 1) * (COL + 1), |
| 28 IDX = ROW * COL * 6, | 28 IDX = ROW * COL * 6, |
| 29 }; | 29 }; |
| 30 | 30 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 virtual void onDraw(const int loops, SkCanvas* canvas) { | 80 virtual void onDraw(const int loops, SkCanvas* canvas) { |
| 81 SkPaint paint; | 81 SkPaint paint; |
| 82 this->setupPaint(&paint); | 82 this->setupPaint(&paint); |
| 83 | 83 |
| 84 for (int i = 0; i < loops; i++) { | 84 for (int i = 0; i < loops; i++) { |
| 85 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS, | 85 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS, |
| 86 fPts, NULL, fColors, NULL, fIdx, IDX, paint); | 86 fPts, NULL, fColors, NULL, fIdx, IDX, paint); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 private: | 89 private: |
| 90 typedef SkBenchmark INHERITED; | 90 typedef Benchmark INHERITED; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 /////////////////////////////////////////////////////////////////////////////// | 93 /////////////////////////////////////////////////////////////////////////////// |
| 94 | 94 |
| 95 DEF_BENCH( return SkNEW_ARGS(VertBench, ()); ) | 95 DEF_BENCH( return SkNEW_ARGS(VertBench, ()); ) |
| OLD | NEW |