Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: bench/nanobench.h

Issue 1039253002: Minor cleanup in nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Canvas may not be present Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/nanobench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.h
diff --git a/bench/nanobench.h b/bench/nanobench.h
index a38b5f577248218d752ec804b368638a8af2b043..1dc0b8b90a3ffa5c065b3afc05fdaca9e4c58b64 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
« no previous file with comments | « no previous file | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698