reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 1 | #ifndef SkBenchmark_DEFINED |
| 2 | #define SkBenchmark_DEFINED |
| 3 | |
| 4 | #include "SkRefCnt.h" |
| 5 | #include "SkPoint.h" |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame^] | 6 | #include "SkTRegistry.h" |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 7 | |
| 8 | class SkCanvas; |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 9 | class SkPaint; |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 10 | |
| 11 | class SkBenchmark : public SkRefCnt { |
| 12 | public: |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 13 | SkBenchmark(); |
| 14 | |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 15 | const char* getName(); |
| 16 | SkIPoint getSize(); |
| 17 | void draw(SkCanvas*); |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 18 | |
| 19 | void setForceAlpha(int alpha) { |
| 20 | fForceAlpha = alpha; |
| 21 | } |
| 22 | |
| 23 | void setForceAA(bool aa) { |
| 24 | fForceAA = aa; |
| 25 | } |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 26 | |
| 27 | protected: |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 28 | void setupPaint(SkPaint* paint); |
| 29 | |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 30 | virtual const char* onGetName() = 0; |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 31 | virtual void onDraw(SkCanvas*) = 0; |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame^] | 32 | |
| 33 | virtual SkIPoint onGetSize(); |
| 34 | |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 35 | private: |
| 36 | int fForceAlpha; |
| 37 | bool fForceAA; |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | static inline SkIPoint SkMakeIPoint(int x, int y) { |
| 41 | SkIPoint p; |
| 42 | p.set(x, y); |
| 43 | return p; |
| 44 | } |
| 45 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame^] | 46 | typedef SkTRegistry<SkBenchmark*, void*> BenchRegistry; |
| 47 | |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 48 | #endif |
| 49 | |