aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/PathBench.cpp
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-06-23 16:44:34 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-04 21:03:21 +0000
commit9d5dcda7818abfb1443400b391d3b35f18ffd96a (patch)
tree97348aceb054dfc0c869e916c0ae673e04dbac4b /bench/PathBench.cpp
parent54dac1f359d6af8c8e85b12f2fbb54eee7f4cdd1 (diff)
We should draw at least once for benchmark
Bug: skia:6792 Change-Id: Ia69c7601abead8f30963de709f22e27e04798319 Reviewed-on: https://skia-review.googlesource.com/20697 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'bench/PathBench.cpp')
-rw-r--r--bench/PathBench.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index 6991db558d..757ffcc198 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -68,7 +68,7 @@ protected:
}
count >>= (3 * complexity());
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < SkTMax(1, count); i++) {
canvas->drawPath(path, paint);
}
}
@@ -1082,7 +1082,7 @@ class TightBoundsBench : public Benchmark {
public:
TightBoundsBench(SkRect (*proc)(const SkPath&), const char suffix[]) : fProc(proc) {
fName.printf("tight_bounds_%s", suffix);
-
+
const int N = 100;
SkRandom rand;
for (int i = 0; i < N; ++i) {
@@ -1102,13 +1102,13 @@ protected:
}
const char* onGetName() override { return fName.c_str(); }
-
+
void onDraw(int loops, SkCanvas* canvas) override {
for (int i = 0; i < loops*100; ++i) {
fProc(fPath);
}
}
-
+
private:
typedef Benchmark INHERITED;
};