From 75a0ebb0d0bd852e3b068bf14370c6689242a89c Mon Sep 17 00:00:00 2001 From: tomhudson Date: Fri, 27 Mar 2015 12:11:44 -0700 Subject: Minor cleanup in nanobench Simplify time() by removing conditionals; reduce the amount of parameter passing. Add a convenience function to Target. R=mtklein@google.com BUG=skia:3595 Review URL: https://codereview.chromium.org/1039253002 --- bench/nanobench.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bench/nanobench.h') diff --git a/bench/nanobench.h b/bench/nanobench.h index a38b5f5772..1dc0b8b90a 100644 --- a/bench/nanobench.h +++ b/bench/nanobench.h @@ -47,7 +47,8 @@ struct Target { virtual void setup() { } /** Called *after* the clock timer is started, before the benchmark - is drawn. */ + is drawn. Most back ends just return the canvas passed in, + but some may replace it. */ virtual SkCanvas* beginTiming(SkCanvas* canvas) { return canvas; } /** Called *after* a benchmark is drawn, but before the clock timer @@ -74,6 +75,13 @@ struct Target { /** Writes any config-specific data to the log. */ virtual void fillOptions(ResultsWriter*) { } + + SkCanvas* getCanvas() const { + if (!surface.get()) { + return NULL; + } + return surface->getCanvas(); + } }; #endif // nanobench_DEFINED -- cgit v1.2.3