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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 protected: | 98 protected: |
99 const char* onGetName() override { | 99 const char* onGetName() override { |
100 if (fAA) { | 100 if (fAA) { |
101 return "chart_aa"; | 101 return "chart_aa"; |
102 } else { | 102 } else { |
103 return "chart_bw"; | 103 return "chart_bw"; |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 void onDraw(const int loops, SkCanvas* canvas) override { | 107 void onDraw(int loops, SkCanvas* canvas) override { |
108 bool sizeChanged = false; | 108 bool sizeChanged = false; |
109 if (canvas->getDeviceSize() != fSize) { | 109 if (canvas->getDeviceSize() != fSize) { |
110 fSize = canvas->getDeviceSize(); | 110 fSize = canvas->getDeviceSize(); |
111 sizeChanged = true; | 111 sizeChanged = true; |
112 } | 112 } |
113 | 113 |
114 SkScalar ySpread = SkIntToScalar(fSize.fHeight / 20); | 114 SkScalar ySpread = SkIntToScalar(fSize.fHeight / 20); |
115 | 115 |
116 SkScalar height = SkIntToScalar(fSize.fHeight); | 116 SkScalar height = SkIntToScalar(fSize.fHeight); |
117 if (sizeChanged) { | 117 if (sizeChanged) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 SkTDArray<SkScalar> fData[kNumGraphs]; | 185 SkTDArray<SkScalar> fData[kNumGraphs]; |
186 bool fAA; | 186 bool fAA; |
187 | 187 |
188 typedef Benchmark INHERITED; | 188 typedef Benchmark INHERITED; |
189 }; | 189 }; |
190 | 190 |
191 ////////////////////////////////////////////////////////////////////////////// | 191 ////////////////////////////////////////////////////////////////////////////// |
192 | 192 |
193 DEF_BENCH( return new ChartBench(true); ) | 193 DEF_BENCH( return new ChartBench(true); ) |
194 DEF_BENCH( return new ChartBench(false); ) | 194 DEF_BENCH( return new ChartBench(false); ) |
OLD | NEW |