Skip to content

Commit

Permalink
Remove dead code from Benchmark
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Brian Osman <[email protected]>
  • Loading branch information
brianosman authored and Skia Commit-Bot committed Aug 9, 2018
1 parent 8af4c40 commit 1e4a4da
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 76 deletions.
16 changes: 1 addition & 15 deletions bench/Benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@
#include "SkPaint.h"
#include "SkParse.h"

const char* SkTriState::Name[] = { "default", "true", "false" };

template BenchRegistry* BenchRegistry::gHead;

Benchmark::Benchmark() {
fForceAlpha = 0xFF;
fDither = SkTriState::kDefault;
fOrMask = fClearMask = 0;
}
Benchmark::Benchmark() {}

const char* Benchmark::getName() {
return this->onGetName();
Expand Down Expand Up @@ -59,15 +53,7 @@ void Benchmark::draw(int loops, SkCanvas* canvas) {
}

void Benchmark::setupPaint(SkPaint* paint) {
paint->setAlpha(fForceAlpha);
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() {
Expand Down
54 changes: 0 additions & 54 deletions bench/Benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ struct GrContextOptions;
class SkCanvas;
class SkPaint;

class SkTriState {
public:
enum State {
kDefault,
kTrue,
kFalse
};
static const char* Name[];
};

class Benchmark : public SkRefCnt {
public:
Benchmark();
Expand Down Expand Up @@ -87,46 +77,6 @@ class Benchmark : public SkRefCnt {
// Bench framework can tune loops to be large enough for stable timing.
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) {}

protected:
Expand All @@ -146,10 +96,6 @@ class Benchmark : public SkRefCnt {
virtual SkIPoint onGetSize();

private:
int fForceAlpha;
SkTriState::State fDither;
uint32_t fOrMask, fClearMask;

typedef SkRefCnt INHERITED;
};

Expand Down
1 change: 0 additions & 1 deletion bench/PathTextBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ static_assert(52 == kNumGlyphs, "expected 52 glyphs");
class PathTextBench : public Benchmark {
public:
PathTextBench(bool clipped, bool uncached) : fClipped(clipped), fUncached(uncached) {}
bool isVisual() override { return true; }

private:
const char* onGetName() override {
Expand Down
2 changes: 0 additions & 2 deletions bench/RectBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class RectBench : public Benchmark {
return fBaseName.c_str();
}

bool isVisual() override { return true; }

protected:

virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) {
Expand Down
2 changes: 0 additions & 2 deletions bench/ShadowBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class ShadowBench : public Benchmark {
computeName("shadows");
}

bool isVisual() override { return true; }

protected:
enum {
kWidth = 640,
Expand Down
2 changes: 0 additions & 2 deletions bench/ShapesBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ class ShapesBench : public Benchmark {
}
#endif

bool isVisual() override { return true; }

private:
void clampShapeSize() {
float maxDiagonal = static_cast<float>(SkTMin(kBenchWidth, kBenchHeight));
Expand Down

0 comments on commit 1e4a4da

Please sign in to comment.