| OLD | NEW |
| 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 "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 | 12 |
| 13 /** | 13 /** |
| 14 * This is a conversion of samplecode/SampleChart.cpp into a bench. It sure woul
d be nice to be able | 14 * This is a conversion of samplecode/SampleChart.cpp into a bench. It sure woul
d be nice to be able |
| 15 * to write one subclass that can be a GM, bench, and/or Sample. | 15 * to write one subclass that can be a GM, bench, and/or Sample. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 // Generates y values for the chart plots. | 18 // Generates y values for the chart plots. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 fill->lineTo(x, (*bottomData)[bottomData->count() - 1 - i]); | 77 fill->lineTo(x, (*bottomData)[bottomData->count() - 1 - i]); |
| 78 } | 78 } |
| 79 } else { | 79 } else { |
| 80 fill->lineTo(x - xDelta, yBase); | 80 fill->lineTo(x - xDelta, yBase); |
| 81 fill->lineTo(xLeft, yBase); | 81 fill->lineTo(xLeft, yBase); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 // A set of scrolling line plots with the area between each plot filled. Stresse
s out GPU path | 85 // A set of scrolling line plots with the area between each plot filled. Stresse
s out GPU path |
| 86 // filling | 86 // filling |
| 87 class ChartBench : public SkBenchmark { | 87 class ChartBench : public Benchmark { |
| 88 public: | 88 public: |
| 89 ChartBench(bool aa) { | 89 ChartBench(bool aa) { |
| 90 fShift = 0; | 90 fShift = 0; |
| 91 fAA = aa; | 91 fAA = aa; |
| 92 fSize.fWidth = -1; | 92 fSize.fWidth = -1; |
| 93 fSize.fHeight = -1; | 93 fSize.fHeight = -1; |
| 94 } | 94 } |
| 95 | 95 |
| 96 protected: | 96 protected: |
| 97 virtual const char* onGetName() SK_OVERRIDE { | 97 virtual const char* onGetName() SK_OVERRIDE { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 enum { | 176 enum { |
| 177 kNumGraphs = 5, | 177 kNumGraphs = 5, |
| 178 kPixelsPerTick = 3, | 178 kPixelsPerTick = 3, |
| 179 kShiftPerFrame = 1, | 179 kShiftPerFrame = 1, |
| 180 }; | 180 }; |
| 181 int fShift; | 181 int fShift; |
| 182 SkISize fSize; | 182 SkISize fSize; |
| 183 SkTDArray<SkScalar> fData[kNumGraphs]; | 183 SkTDArray<SkScalar> fData[kNumGraphs]; |
| 184 bool fAA; | 184 bool fAA; |
| 185 | 185 |
| 186 typedef SkBenchmark INHERITED; | 186 typedef Benchmark INHERITED; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 ////////////////////////////////////////////////////////////////////////////// | 189 ////////////////////////////////////////////////////////////////////////////// |
| 190 | 190 |
| 191 DEF_BENCH( return new ChartBench(true); ) | 191 DEF_BENCH( return new ChartBench(true); ) |
| 192 DEF_BENCH( return new ChartBench(false); ) | 192 DEF_BENCH( return new ChartBench(false); ) |
| OLD | NEW |