Chromium Code Reviews| Index: bench/SkBenchmark.h |
| diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h |
| index ec40077527b777285d6085949194a459fd844f00..1a31cbe6f74e6cf462d5522082e251bbfebe5020 100644 |
| --- a/bench/SkBenchmark.h |
| +++ b/bench/SkBenchmark.h |
| @@ -29,6 +29,9 @@ static BenchRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_)); |
| class SkCanvas; |
| class SkPaint; |
| +#if SK_SUPPORT_GPU |
| +class GrContext; |
| +#endif |
| class SkTriState { |
| public: |
| @@ -49,6 +52,19 @@ public: |
| const char* getName(); |
| SkIPoint getSize(); |
| + enum Backend { |
| + kNonRendering_Backend, |
| + kRaster_Backend, |
| + kGPU_Backend, |
| + kPDF_Backend, |
| + }; |
| + |
| + // Call to determine whether the benchmark is intended for |
| + // the rendering mode. |
| + virtual bool isSuitableFor(Backend) { |
| + return true; |
| + } |
| + |
| // Call before draw, allows the benchmark to do setup work outside of the |
| // timer. When a benchmark is repeatedly drawn, this should be called once |
| // before the initial draw. |
| @@ -77,13 +93,6 @@ public: |
| fDither = state; |
| } |
| - /** If true; the benchmark does rendering; if false, the benchmark |
| - doesn't, and so need not be re-run in every different rendering |
| - mode. */ |
| - bool isRendering() { |
| - return fIsRendering; |
| - } |
| - |
| /** Assign masks for paint-flags. These will be applied when setupPaint() |
| * is called. |
| * |
| @@ -111,17 +120,23 @@ public: |
| static SkString& GetResourcePath() { return gResourcePath; } |
| +#if SK_SUPPORT_GPU |
| + virtual void setContext(GrContext* context) { fContext = context; }; |
|
mtklein
2013/11/19 12:59:01
Would something like GrContext* GM::GetGr(SkCanvas
Kimmo Kinnunen
2013/11/19 14:12:49
Done.
|
| +#endif |
| + |
| protected: |
| virtual void setupPaint(SkPaint* paint); |
| + |
| virtual const char* onGetName() = 0; |
| virtual void onPreDraw() {} |
| virtual void onDraw(SkCanvas*) = 0; |
| virtual void onPostDraw() {} |
| virtual SkIPoint onGetSize(); |
| - /// Defaults to true. |
| - bool fIsRendering; |
| +#if SK_SUPPORT_GPU |
| + GrContext* fContext; |
| +#endif |
| private: |
| int fForceAlpha; |