Spin off GM::runAsBench() from flags.

This will let us kill flags.

BUG=skia:

Review URL: https://codereview.chromium.org/873753002
This commit is contained in:
mtklein 2015-01-23 10:31:45 -08:00 committed by Commit bot
parent 7a2c8f3f28
commit cf5d9c993d
7 changed files with 17 additions and 9 deletions

View File

@ -503,7 +503,7 @@ public:
while (fGMs) { while (fGMs) {
SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(NULL)); SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(NULL));
fGMs = fGMs->next(); fGMs = fGMs->next();
if (gm->getFlags() & skiagm::GM::kAsBench_Flag) { if (gm->runAsBench()) {
fSourceType = "gm"; fSourceType = "gm";
fBenchType = "micro"; fBenchType = "micro";
return SkNEW_ARGS(GMBench, (gm.detach())); return SkNEW_ARGS(GMBench, (gm.detach()));

View File

@ -26,9 +26,11 @@ public:
protected: protected:
uint32_t onGetFlags() const SK_OVERRIDE { 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 { SkString onShortName() SK_OVERRIDE {
return SkString("circular-clips"); return SkString("circular-clips");
} }

View File

@ -215,9 +215,11 @@ protected:
} }
virtual uint32_t onGetFlags() const { virtual uint32_t onGetFlags() const {
return kAsBench_Flag | kSkipTiled_Flag; return kSkipTiled_Flag;
} }
bool runAsBench() const SK_OVERRIDE { return true; }
private: private:
class Clip { class Clip {
public: public:

View File

@ -414,9 +414,11 @@ public:
Dashing5GM(bool doAA) : fDoAA(doAA) {} Dashing5GM(bool doAA) : fDoAA(doAA) {}
protected: 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) { if (fDoAA) {
return SkString("dashing5_aa"); return SkString("dashing5_aa");
} else { } else {

View File

@ -53,8 +53,6 @@ namespace skiagm {
kGPUOnly_Flag = 1 << 9, 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 kNoBBH_Flag = 1 << 11, // May draw wrong using a bounding-box hierarchy
}; };
@ -74,6 +72,8 @@ namespace skiagm {
SkISize getISize() { return this->onISize(); } SkISize getISize() { return this->onISize(); }
const char* getName(); const char* getName();
virtual bool runAsBench() const { return false; }
uint32_t getFlags() const { uint32_t getFlags() const {
return this->onGetFlags(); return this->onGetFlags();
} }

View File

@ -534,7 +534,8 @@ namespace skiagm {
return name; 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: private:
typedef GM INHERITED; typedef GM INHERITED;

View File

@ -139,8 +139,9 @@ protected:
uint32_t onGetFlags() const SK_OVERRIDE { uint32_t onGetFlags() const SK_OVERRIDE {
// The aa hairline stroked rects used to visualize the clip draw slightly differently in // The aa hairline stroked rects used to visualize the clip draw slightly differently in
// quilt mode in dm. // quilt mode in dm.
return kAsBench_Flag | kSkipTiled_Flag; return kSkipTiled_Flag;
} }
bool runAsBench() const SK_OVERRIDE { return true; }
private: private:
static const int kCnt = 30; static const int kCnt = 30;