From 1e4a4daebec4436482ed663b48968754101662b5 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Wed, 8 Aug 2018 14:27:25 -0400 Subject: [PATCH] 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 Commit-Queue: Brian Osman --- bench/Benchmark.cpp | 16 +----------- bench/Benchmark.h | 54 ----------------------------------------- bench/PathTextBench.cpp | 1 - bench/RectBench.cpp | 2 -- bench/ShadowBench.cpp | 2 -- bench/ShapesBench.cpp | 2 -- 6 files changed, 1 insertion(+), 76 deletions(-) diff --git a/bench/Benchmark.cpp b/bench/Benchmark.cpp index df1e34746b..9438e08c88 100644 --- a/bench/Benchmark.cpp +++ b/bench/Benchmark.cpp @@ -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(); @@ -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() { diff --git a/bench/Benchmark.h b/bench/Benchmark.h index ddc93870cd..b9126ce416 100644 --- a/bench/Benchmark.h +++ b/bench/Benchmark.h @@ -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(); @@ -87,46 +77,6 @@ public: // 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* keys, SkTArray* values) {} protected: @@ -146,10 +96,6 @@ protected: virtual SkIPoint onGetSize(); private: - int fForceAlpha; - SkTriState::State fDither; - uint32_t fOrMask, fClearMask; - typedef SkRefCnt INHERITED; }; diff --git a/bench/PathTextBench.cpp b/bench/PathTextBench.cpp index b1c9e01a80..8c7c9f7f54 100644 --- a/bench/PathTextBench.cpp +++ b/bench/PathTextBench.cpp @@ -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 { diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp index 407c3a976f..dcd9b32dad 100644 --- a/bench/RectBench.cpp +++ b/bench/RectBench.cpp @@ -39,8 +39,6 @@ public: return fBaseName.c_str(); } - bool isVisual() override { return true; } - protected: virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) { diff --git a/bench/ShadowBench.cpp b/bench/ShadowBench.cpp index e454abd3a4..072af6692b 100644 --- a/bench/ShadowBench.cpp +++ b/bench/ShadowBench.cpp @@ -22,8 +22,6 @@ public: computeName("shadows"); } - bool isVisual() override { return true; } - protected: enum { kWidth = 640, diff --git a/bench/ShapesBench.cpp b/bench/ShapesBench.cpp index 67048b9e6b..dd3ac7a822 100644 --- a/bench/ShapesBench.cpp +++ b/bench/ShapesBench.cpp @@ -97,8 +97,6 @@ public: } #endif - bool isVisual() override { return true; } - private: void clampShapeSize() { float maxDiagonal = static_cast(SkTMin(kBenchWidth, kBenchHeight));