aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/nanobench.h
diff options
context:
space:
mode:
Diffstat (limited to 'bench/nanobench.h')
-rw-r--r--bench/nanobench.h10
1 files changed, 9 insertions, 1 deletions
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