| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef Stats_DEFINED | 8 #ifndef Stats_DEFINED |
| 9 #define Stats_DEFINED | 9 #define Stats_DEFINED |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // All samples are the same value. Don't divide by zero. | 55 // All samples are the same value. Don't divide by zero. |
| 56 plot.append(kBars[0]); | 56 plot.append(kBars[0]); |
| 57 continue; | 57 continue; |
| 58 } | 58 } |
| 59 | 59 |
| 60 double s = samples[i]; | 60 double s = samples[i]; |
| 61 s -= min; | 61 s -= min; |
| 62 s /= (max - min); | 62 s /= (max - min); |
| 63 s *= (SK_ARRAY_COUNT(kBars) - 1); | 63 s *= (SK_ARRAY_COUNT(kBars) - 1); |
| 64 const size_t bar = (size_t)(s + 0.5); | 64 const size_t bar = (size_t)(s + 0.5); |
| 65 SK_ALWAYSBREAK(bar < SK_ARRAY_COUNT(kBars)); | 65 SkASSERT_RELEASE(bar < SK_ARRAY_COUNT(kBars)); |
| 66 plot.append(kBars[bar]); | 66 plot.append(kBars[bar]); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 double min; | 70 double min; |
| 71 double max; | 71 double max; |
| 72 double mean; // Estimate of population mean. | 72 double mean; // Estimate of population mean. |
| 73 double var; // Estimate of population variance. | 73 double var; // Estimate of population variance. |
| 74 double median; | 74 double median; |
| 75 SkString plot; // A single-line bar chart (_not_ histogram) of the samples. | 75 SkString plot; // A single-line bar chart (_not_ histogram) of the samples. |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif//Stats_DEFINED | 78 #endif//Stats_DEFINED |
| OLD | NEW |