skia2/bench/SkBenchmark.h
reed@android.com f523e25da0 add BitmapBench
git-svn-id: http://skia.googlecode.com/svn/trunk@83 2bbb7eff-a529-9590-31e7-b0007b416f81
2009-01-26 23:15:37 +00:00

50 lines
836 B
C++

#ifndef SkBenchmark_DEFINED
#define SkBenchmark_DEFINED
#include "SkRefCnt.h"
#include "SkPoint.h"
#include "SkTRegistry.h"
class SkCanvas;
class SkPaint;
class SkBenchmark : public SkRefCnt {
public:
SkBenchmark();
const char* getName();
SkIPoint getSize();
void draw(SkCanvas*);
void setForceAlpha(int alpha) {
fForceAlpha = alpha;
}
void setForceAA(bool aa) {
fForceAA = aa;
}
protected:
void setupPaint(SkPaint* paint);
virtual const char* onGetName() = 0;
virtual void onDraw(SkCanvas*) = 0;
virtual SkIPoint onGetSize();
private:
int fForceAlpha;
bool fForceAA;
};
static inline SkIPoint SkMakeIPoint(int x, int y) {
SkIPoint p;
p.set(x, y);
return p;
}
typedef SkTRegistry<SkBenchmark*, void*> BenchRegistry;
#endif