Spin off GM::runAsBench() from flags.
This will let us kill flags.
BUG=skia:
Review URL: https://codereview.chromium.org/873753002
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 6fe2d62..8d00ca1 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -503,7 +503,7 @@
while (fGMs) {
SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(NULL));
fGMs = fGMs->next();
- if (gm->getFlags() & skiagm::GM::kAsBench_Flag) {
+ if (gm->runAsBench()) {
fSourceType = "gm";
fBenchType = "micro";
return SkNEW_ARGS(GMBench, (gm.detach()));
diff --git a/gm/circularclips.cpp b/gm/circularclips.cpp
index 6a8415c..69e8b69 100644
--- a/gm/circularclips.cpp
+++ b/gm/circularclips.cpp
@@ -26,9 +26,11 @@
protected:
uint32_t onGetFlags() const SK_OVERRIDE {
- return kSkipTiled_Flag | kAsBench_Flag;
+ return kSkipTiled_Flag;
}
+ bool runAsBench() const SK_OVERRIDE { return true; }
+
SkString onShortName() SK_OVERRIDE {
return SkString("circular-clips");
}
diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp
index f7aac89..0ec45b7 100644
--- a/gm/convexpolyclip.cpp
+++ b/gm/convexpolyclip.cpp
@@ -215,9 +215,11 @@
}
virtual uint32_t onGetFlags() const {
- return kAsBench_Flag | kSkipTiled_Flag;
+ return kSkipTiled_Flag;
}
+ bool runAsBench() const SK_OVERRIDE { return true; }
+
private:
class Clip {
public:
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index a5d234f..a3d6094 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -414,9 +414,11 @@
Dashing5GM(bool doAA) : fDoAA(doAA) {}
protected:
- uint32_t onGetFlags() const SK_OVERRIDE { return kAsBench_Flag | kSkipTiled_Flag; }
+ uint32_t onGetFlags() const SK_OVERRIDE { return kSkipTiled_Flag; }
- SkString onShortName() SK_OVERRIDE {
+ bool runAsBench() const SK_OVERRIDE { return true; }
+
+ SkString onShortName() SK_OVERRIDE {
if (fDoAA) {
return SkString("dashing5_aa");
} else {
diff --git a/gm/gm.h b/gm/gm.h
index 81744e2..55820ac 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -53,8 +53,6 @@
kGPUOnly_Flag = 1 << 9,
- kAsBench_Flag = 1 << 10, // Run the GM as a benchmark in the bench tool
-
kNoBBH_Flag = 1 << 11, // May draw wrong using a bounding-box hierarchy
};
@@ -74,6 +72,8 @@
SkISize getISize() { return this->onISize(); }
const char* getName();
+ virtual bool runAsBench() const { return false; }
+
uint32_t getFlags() const {
return this->onGetFlags();
}
diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp
index c7da676..15b57e3 100644
--- a/gm/multipicturedraw.cpp
+++ b/gm/multipicturedraw.cpp
@@ -534,7 +534,8 @@
return name;
}
- uint32_t onGetFlags() const SK_OVERRIDE { return kAsBench_Flag | kSkipTiled_Flag; }
+ uint32_t onGetFlags() const SK_OVERRIDE { return kSkipTiled_Flag; }
+ bool runAsBench() const SK_OVERRIDE { return true; }
private:
typedef GM INHERITED;
diff --git a/gm/variedtext.cpp b/gm/variedtext.cpp
index dddd79e..dba5d70 100644
--- a/gm/variedtext.cpp
+++ b/gm/variedtext.cpp
@@ -139,8 +139,9 @@
uint32_t onGetFlags() const SK_OVERRIDE {
// The aa hairline stroked rects used to visualize the clip draw slightly differently in
// quilt mode in dm.
- return kAsBench_Flag | kSkipTiled_Flag;
+ return kSkipTiled_Flag;
}
+ bool runAsBench() const SK_OVERRIDE { return true; }
private:
static const int kCnt = 30;