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

Unified Diff: bench/nanobench.cpp

Issue 497493003: Add --bbh (default true) to nanobench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Revert SkRecordDraw.cpp in favor of crrev.com/497493003. Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 6968d6dac21deb835f11063a4731b3077673398e..89619164fd575164ec0e8688e8530590f0dc8d02 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -16,11 +16,13 @@
#include "Stats.h"
#include "Timer.h"
-#include "SkOSFile.h"
+#include "SkBBHFactory.h"
#include "SkCanvas.h"
#include "SkCommonFlags.h"
#include "SkForceLinking.h"
#include "SkGraphics.h"
+#include "SkOSFile.h"
+#include "SkPictureRecorder.h"
#include "SkString.h"
#include "SkSurface.h"
@@ -71,6 +73,7 @@ DEFINE_string(key, "",
DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
+DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
static SkString humanize(double ms) {
if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3);
@@ -481,6 +484,20 @@ public:
SkString name = SkOSPath::Basename(path.c_str());
+ if (FLAGS_bbh) {
+ // The SKP we read off disk doesn't have a BBH. Re-record so it grows one.
+ // Here we use an SkTileGrid with parameters optimized for FLAGS_clip.
+ const SkTileGridFactory::TileGridInfo info = {
+ SkISize::Make(fClip.width(), fClip.height()), // tile interval
+ SkISize::Make(0,0), // margin
+ SkIPoint::Make(fClip.left(), fClip.top()), // offset
+ };
+ SkTileGridFactory factory(info);
+ SkPictureRecorder recorder;
+ pic->draw(recorder.beginRecording(pic->width(), pic->height(), &factory));
+ pic.reset(recorder.endRecording());
+ }
+
fSourceType = "skp";
return SkNEW_ARGS(SKPBench,
(name.c_str(), pic.get(), fClip, fScales[fCurrentScale]));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698