Remove dead code from Benchmark
Spotted the VisualBench hooks the other day, then found some more dead code when I went to remove them. Change-Id: Ia07f0556faf33cc69e3ec590f7a8f47f2c1f298a Reviewed-on: https://skia-review.googlesource.com/146360 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
8af4c40014
commit
1e4a4daebe
@ -11,15 +11,9 @@
|
|||||||
#include "SkPaint.h"
|
#include "SkPaint.h"
|
||||||
#include "SkParse.h"
|
#include "SkParse.h"
|
||||||
|
|
||||||
const char* SkTriState::Name[] = { "default", "true", "false" };
|
|
||||||
|
|
||||||
template BenchRegistry* BenchRegistry::gHead;
|
template BenchRegistry* BenchRegistry::gHead;
|
||||||
|
|
||||||
Benchmark::Benchmark() {
|
Benchmark::Benchmark() {}
|
||||||
fForceAlpha = 0xFF;
|
|
||||||
fDither = SkTriState::kDefault;
|
|
||||||
fOrMask = fClearMask = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* Benchmark::getName() {
|
const char* Benchmark::getName() {
|
||||||
return this->onGetName();
|
return this->onGetName();
|
||||||
@ -59,15 +53,7 @@ void Benchmark::draw(int loops, SkCanvas* canvas) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Benchmark::setupPaint(SkPaint* paint) {
|
void Benchmark::setupPaint(SkPaint* paint) {
|
||||||
paint->setAlpha(fForceAlpha);
|
|
||||||
paint->setAntiAlias(true);
|
paint->setAntiAlias(true);
|
||||||
paint->setFilterQuality(kNone_SkFilterQuality);
|
|
||||||
|
|
||||||
paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
|
|
||||||
|
|
||||||
if (SkTriState::kDefault != fDither) {
|
|
||||||
paint->setDither(SkTriState::kTrue == fDither);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SkIPoint Benchmark::onGetSize() {
|
SkIPoint Benchmark::onGetSize() {
|
||||||
|
@ -31,16 +31,6 @@ struct GrContextOptions;
|
|||||||
class SkCanvas;
|
class SkCanvas;
|
||||||
class SkPaint;
|
class SkPaint;
|
||||||
|
|
||||||
class SkTriState {
|
|
||||||
public:
|
|
||||||
enum State {
|
|
||||||
kDefault,
|
|
||||||
kTrue,
|
|
||||||
kFalse
|
|
||||||
};
|
|
||||||
static const char* Name[];
|
|
||||||
};
|
|
||||||
|
|
||||||
class Benchmark : public SkRefCnt {
|
class Benchmark : public SkRefCnt {
|
||||||
public:
|
public:
|
||||||
Benchmark();
|
Benchmark();
|
||||||
@ -87,46 +77,6 @@ public:
|
|||||||
// Bench framework can tune loops to be large enough for stable timing.
|
// Bench framework can tune loops to be large enough for stable timing.
|
||||||
void draw(int loops, SkCanvas*);
|
void draw(int loops, SkCanvas*);
|
||||||
|
|
||||||
void setForceAlpha(int alpha) {
|
|
||||||
fForceAlpha = alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setDither(SkTriState::State state) {
|
|
||||||
fDither = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Assign masks for paint-flags. These will be applied when setupPaint()
|
|
||||||
* is called.
|
|
||||||
*
|
|
||||||
* Performs the following on the paint:
|
|
||||||
* uint32_t flags = paint.getFlags();
|
|
||||||
* flags &= ~clearMask;
|
|
||||||
* flags |= orMask;
|
|
||||||
* paint.setFlags(flags);
|
|
||||||
*/
|
|
||||||
void setPaintMasks(uint32_t orMask, uint32_t clearMask) {
|
|
||||||
fOrMask = orMask;
|
|
||||||
fClearMask = clearMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Benches which support running in a visual mode can advertise this functionality
|
|
||||||
*/
|
|
||||||
virtual bool isVisual() { return false; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* VisualBench frequently resets the canvas. As a result we need to bulk call all of the hooks
|
|
||||||
*/
|
|
||||||
void preTimingHooks(SkCanvas* canvas) {
|
|
||||||
this->perCanvasPreDraw(canvas);
|
|
||||||
this->preDraw(canvas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void postTimingHooks(SkCanvas* canvas) {
|
|
||||||
this->postDraw(canvas);
|
|
||||||
this->perCanvasPostDraw(canvas);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void getGpuStats(SkCanvas*, SkTArray<SkString>* keys, SkTArray<double>* values) {}
|
virtual void getGpuStats(SkCanvas*, SkTArray<SkString>* keys, SkTArray<double>* values) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -146,10 +96,6 @@ protected:
|
|||||||
virtual SkIPoint onGetSize();
|
virtual SkIPoint onGetSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int fForceAlpha;
|
|
||||||
SkTriState::State fDither;
|
|
||||||
uint32_t fOrMask, fClearMask;
|
|
||||||
|
|
||||||
typedef SkRefCnt INHERITED;
|
typedef SkRefCnt INHERITED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ static_assert(52 == kNumGlyphs, "expected 52 glyphs");
|
|||||||
class PathTextBench : public Benchmark {
|
class PathTextBench : public Benchmark {
|
||||||
public:
|
public:
|
||||||
PathTextBench(bool clipped, bool uncached) : fClipped(clipped), fUncached(uncached) {}
|
PathTextBench(bool clipped, bool uncached) : fClipped(clipped), fUncached(uncached) {}
|
||||||
bool isVisual() override { return true; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* onGetName() override {
|
const char* onGetName() override {
|
||||||
|
@ -39,8 +39,6 @@ public:
|
|||||||
return fBaseName.c_str();
|
return fBaseName.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isVisual() override { return true; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) {
|
virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) {
|
||||||
|
@ -22,8 +22,6 @@ public:
|
|||||||
computeName("shadows");
|
computeName("shadows");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isVisual() override { return true; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum {
|
enum {
|
||||||
kWidth = 640,
|
kWidth = 640,
|
||||||
|
@ -97,8 +97,6 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool isVisual() override { return true; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clampShapeSize() {
|
void clampShapeSize() {
|
||||||
float maxDiagonal = static_cast<float>(SkTMin(kBenchWidth, kBenchHeight));
|
float maxDiagonal = static_cast<float>(SkTMin(kBenchWidth, kBenchHeight));
|
||||||
|
Loading…
Reference in New Issue
Block a user