| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkRect.h" | 10 #include "SkRect.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // | 21 // |
| 22 // Areas 1-4 are first all draw white. Areas 3&4 are then drawn grey. Areas | 22 // Areas 1-4 are first all draw white. Areas 3&4 are then drawn grey. Areas |
| 23 // 2&4 are then drawn grey. Areas 2&3 are thus double drawn while area 4 is | 23 // 2&4 are then drawn grey. Areas 2&3 are thus double drawn while area 4 is |
| 24 // triple drawn. | 24 // triple drawn. |
| 25 // This trio of drawRects is then repeat for the next cell. | 25 // This trio of drawRects is then repeat for the next cell. |
| 26 class TableBench : public SkBenchmark { | 26 class TableBench : public SkBenchmark { |
| 27 public: | 27 public: |
| 28 static const int kNumRows = 48; | 28 static const int kNumRows = 48; |
| 29 static const int kNumCols = 32; | 29 static const int kNumCols = 32; |
| 30 | 30 |
| 31 TableBench(void* param) | |
| 32 : INHERITED(param) { | |
| 33 } | |
| 34 | |
| 35 protected: | 31 protected: |
| 36 virtual const char* onGetName() { | 32 virtual const char* onGetName() { |
| 37 return "tablebench"; | 33 return "tablebench"; |
| 38 } | 34 } |
| 39 | 35 |
| 40 virtual void onDraw(SkCanvas* canvas) { | 36 virtual void onDraw(SkCanvas* canvas) { |
| 41 SkPaint cellPaint; | 37 SkPaint cellPaint; |
| 42 cellPaint.setColor(0xFFFFFFF); | 38 cellPaint.setColor(0xFFFFFFF); |
| 43 | 39 |
| 44 SkPaint borderPaint; | 40 SkPaint borderPaint; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 canvas->drawRect(right, borderPaint); | 62 canvas->drawRect(right, borderPaint); |
| 67 } | 63 } |
| 68 } | 64 } |
| 69 } | 65 } |
| 70 } | 66 } |
| 71 | 67 |
| 72 private: | 68 private: |
| 73 typedef SkBenchmark INHERITED; | 69 typedef SkBenchmark INHERITED; |
| 74 }; | 70 }; |
| 75 | 71 |
| 76 static SkBenchmark* gFactory(void* p) { return new TableBench(p); } | 72 DEF_BENCH( return new TableBench(); ) |
| 77 | |
| 78 static BenchRegistry gRegistry(gFactory); | |
| OLD | NEW |