| Index: tools/Stats.h
|
| diff --git a/tools/Stats.h b/tools/Stats.h
|
| index 8487a9497da6dff23cf2508dad5831065deeaa29..12c1d35e1f92c2a1cb27e85ed2bd8b3040611407 100644
|
| --- a/tools/Stats.h
|
| +++ b/tools/Stats.h
|
| @@ -1,3 +1,10 @@
|
| +/*
|
| + * Copyright 2015 Google Inc.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| #ifndef Stats_DEFINED
|
| #define Stats_DEFINED
|
|
|
| @@ -11,7 +18,13 @@
|
| #endif
|
|
|
| struct Stats {
|
| - Stats(const double samples[], int n) {
|
| + Stats(const SkTArray<double>& samples) {
|
| + int n = samples.count();
|
| + if (!n) {
|
| + min = max = mean = var = median = 0;
|
| + return;
|
| + }
|
| +
|
| min = samples[0];
|
| max = samples[0];
|
| for (int i = 0; i < n; i++) {
|
| @@ -32,7 +45,7 @@ struct Stats {
|
| var = err / (n-1);
|
|
|
| SkAutoTMalloc<double> sorted(n);
|
| - memcpy(sorted.get(), samples, n * sizeof(double));
|
| + memcpy(sorted.get(), samples.begin(), n * sizeof(double));
|
| SkTQSort(sorted.get(), sorted.get() + n - 1);
|
| median = sorted[n/2];
|
|
|
|
|