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

Unified Diff: bench/nanobench.cpp

Issue 1061323003: Change to add zoom animations to nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows warning Created 5 years, 8 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 | « bench/SKPBench.cpp ('k') | gyp/bench.gyp » ('j') | 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 0045d53f40ea6ad41b8d8ccf163b3a20492409ea..c33f2c77d2624d6e59a0a2e14848fd35d1b5ad52 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -18,6 +18,7 @@
#include "ProcStats.h"
#include "ResultsWriter.h"
#include "RecordingBench.h"
+#include "SKPAnimationBench.h"
#include "SKPBench.h"
#include "Stats.h"
#include "Timer.h"
@@ -82,6 +83,7 @@ DEFINE_int32(maxCalibrationAttempts, 3,
DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this.");
DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
+DEFINE_string(zoom, "1.0,1", "Comma-separated scale,step zoom factors for SKPs.");
DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
@@ -491,6 +493,7 @@ public:
, fCurrentImage(0)
, fCurrentSubsetImage(0)
, fCurrentColorType(0)
+ , fCurrentAnimSKP(0)
, fDivisor(2) {
for (int i = 0; i < FLAGS_skps.count(); i++) {
if (SkStrEndsWith(FLAGS_skps[i], ".skp")) {
@@ -517,6 +520,11 @@ public:
}
}
+ if (2 != sscanf(FLAGS_zoom[0], "%f,%d", &fZoomScale, &fZoomSteps)) {
+ SkDebugf("Can't parse %s from --zoom as a scale,step.\n", FLAGS_zoom[0]);
+ exit(1);
+ }
+
fUseMPDs.push_back() = false;
if (FLAGS_mpd) {
fUseMPDs.push_back() = true;
@@ -625,8 +633,9 @@ public:
fSourceType = "skp";
fBenchType = "playback";
return SkNEW_ARGS(SKPBench,
- (name.c_str(), pic.get(), fClip,
- fScales[fCurrentScale], fUseMPDs[fCurrentUseMPD++]));
+ (name.c_str(), pic.get(), fClip,
+ fScales[fCurrentScale], fUseMPDs[fCurrentUseMPD++]));
+
}
fCurrentUseMPD = 0;
fCurrentSKP++;
@@ -635,6 +644,26 @@ public:
fCurrentScale++;
}
+ // Now loop over each skp again if we have an animation
+ if (fZoomScale != 1.0f && fZoomSteps != 1) {
+ while (fCurrentAnimSKP < fSKPs.count()) {
+ const SkString& path = fSKPs[fCurrentAnimSKP];
+ SkAutoTUnref<SkPicture> pic;
+ if (!ReadPicture(path.c_str(), &pic)) {
+ fCurrentAnimSKP++;
+ continue;
+ }
+
+ fCurrentAnimSKP++;
+ SkString name = SkOSPath::Basename(path.c_str());
+ SkMatrix anim = SkMatrix::I();
+ anim.setScale(fZoomScale, fZoomScale);
+ return SkNEW_ARGS(SKPAnimationBench, (name.c_str(), pic.get(), fClip, anim,
+ fZoomSteps));
+ }
+ }
+
+
for (; fCurrentCodec < fImages.count(); fCurrentCodec++) {
const SkString& path = fImages[fCurrentCodec];
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
@@ -789,6 +818,8 @@ private:
SkTArray<bool> fUseMPDs;
SkTArray<SkString> fImages;
SkTArray<SkColorType> fColorTypes;
+ SkScalar fZoomScale;
+ int fZoomSteps;
double fSKPBytes, fSKPOps;
@@ -802,6 +833,7 @@ private:
int fCurrentImage;
int fCurrentSubsetImage;
int fCurrentColorType;
+ int fCurrentAnimSKP;
const int fDivisor;
};
« no previous file with comments | « bench/SKPBench.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698