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) {
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()));

View File

@ -26,9 +26,11 @@ public:
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");
}

View File

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

View File

@ -414,9 +414,11 @@ public:
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 {

View File

@ -53,8 +53,6 @@ namespace skiagm {
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 @@ namespace skiagm {
SkISize getISize() { return this->onISize(); }
const char* getName();
virtual bool runAsBench() const { return false; }
uint32_t getFlags() const {
return this->onGetFlags();
}

View File

@ -534,7 +534,8 @@ namespace skiagm {
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;

View File

@ -139,8 +139,9 @@ protected:
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;