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 "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 class ChartBench : public Benchmark { | 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 const char* onGetName() SK_OVERRIDE { |
98 if (fAA) { | 98 if (fAA) { |
99 return "chart_aa"; | 99 return "chart_aa"; |
100 } else { | 100 } else { |
101 return "chart_bw"; | 101 return "chart_bw"; |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 105 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { |
106 bool sizeChanged = false; | 106 bool sizeChanged = false; |
107 if (canvas->getDeviceSize() != fSize) { | 107 if (canvas->getDeviceSize() != fSize) { |
108 fSize = canvas->getDeviceSize(); | 108 fSize = canvas->getDeviceSize(); |
109 sizeChanged = true; | 109 sizeChanged = true; |
110 } | 110 } |
111 | 111 |
112 SkScalar ySpread = SkIntToScalar(fSize.fHeight / 20); | 112 SkScalar ySpread = SkIntToScalar(fSize.fHeight / 20); |
113 | 113 |
114 SkScalar height = SkIntToScalar(fSize.fHeight); | 114 SkScalar height = SkIntToScalar(fSize.fHeight); |
115 if (sizeChanged) { | 115 if (sizeChanged) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 SkTDArray<SkScalar> fData[kNumGraphs]; | 183 SkTDArray<SkScalar> fData[kNumGraphs]; |
184 bool fAA; | 184 bool fAA; |
185 | 185 |
186 typedef Benchmark 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 |