2009-06-10 15:38:48 +00:00
|
|
|
#ifndef skiagm_DEFINED
|
|
|
|
#define skiagm_DEFINED
|
|
|
|
|
2009-06-20 02:38:16 +00:00
|
|
|
#include "SkCanvas.h"
|
|
|
|
#include "SkPaint.h"
|
2009-06-10 15:38:48 +00:00
|
|
|
#include "SkRefCnt.h"
|
2009-06-20 02:38:16 +00:00
|
|
|
#include "SkSize.h"
|
2009-06-10 15:38:48 +00:00
|
|
|
#include "SkString.h"
|
|
|
|
#include "SkTRegistry.h"
|
|
|
|
|
|
|
|
namespace skiagm {
|
2009-06-20 02:38:16 +00:00
|
|
|
|
2009-06-21 00:49:18 +00:00
|
|
|
static inline SkISize make_isize(int w, int h) {
|
2009-06-20 02:38:16 +00:00
|
|
|
SkISize sz;
|
|
|
|
sz.set(w, h);
|
|
|
|
return sz;
|
|
|
|
}
|
2009-06-10 15:38:48 +00:00
|
|
|
|
|
|
|
class GM {
|
|
|
|
public:
|
|
|
|
GM();
|
|
|
|
virtual ~GM();
|
|
|
|
|
|
|
|
void draw(SkCanvas*);
|
2009-06-20 02:38:16 +00:00
|
|
|
SkISize getISize() { return this->onISize(); }
|
2009-06-21 00:49:18 +00:00
|
|
|
const char* shortName() {
|
|
|
|
if (fShortName.size() == 0) {
|
|
|
|
fShortName = this->onShortName();
|
|
|
|
}
|
|
|
|
return fShortName.c_str();
|
|
|
|
}
|
2009-06-10 15:38:48 +00:00
|
|
|
|
|
|
|
protected:
|
2009-06-21 00:49:18 +00:00
|
|
|
virtual void onDraw(SkCanvas*) = 0;
|
|
|
|
virtual SkISize onISize() = 0;
|
|
|
|
virtual SkString onShortName() = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
SkString fShortName;
|
2009-06-10 15:38:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef SkTRegistry<GM*, void*> GMRegistry;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|