blob: ce10ec70157ed81f07f24cc3eead59200469fb21 [file] [log] [blame]
reed@android.com00dae862009-06-10 15:38:48 +00001#ifndef skiagm_DEFINED
2#define skiagm_DEFINED
3
epoger@google.comd4af56c2011-07-25 16:27:59 +00004#include "SkBitmap.h"
reed@android.comdd0ac282009-06-20 02:38:16 +00005#include "SkCanvas.h"
epoger@google.comd4af56c2011-07-25 16:27:59 +00006#include "SkDevice.h"
reed@android.comdd0ac282009-06-20 02:38:16 +00007#include "SkPaint.h"
reed@android.com00dae862009-06-10 15:38:48 +00008#include "SkRefCnt.h"
reed@android.comdd0ac282009-06-20 02:38:16 +00009#include "SkSize.h"
reed@android.com00dae862009-06-10 15:38:48 +000010#include "SkString.h"
11#include "SkTRegistry.h"
12
13namespace skiagm {
reed@android.comdd0ac282009-06-20 02:38:16 +000014
reed@android.com8015dd82009-06-21 00:49:18 +000015 static inline SkISize make_isize(int w, int h) {
reed@android.comdd0ac282009-06-20 02:38:16 +000016 SkISize sz;
17 sz.set(w, h);
18 return sz;
19 }
reed@android.com00dae862009-06-10 15:38:48 +000020
21 class GM {
22 public:
23 GM();
24 virtual ~GM();
25
26 void draw(SkCanvas*);
reed@android.comdd0ac282009-06-20 02:38:16 +000027 SkISize getISize() { return this->onISize(); }
reed@android.com8015dd82009-06-21 00:49:18 +000028 const char* shortName() {
29 if (fShortName.size() == 0) {
30 fShortName = this->onShortName();
31 }
32 return fShortName.c_str();
33 }
reed@android.com00dae862009-06-10 15:38:48 +000034
35 protected:
reed@android.com8015dd82009-06-21 00:49:18 +000036 virtual void onDraw(SkCanvas*) = 0;
37 virtual SkISize onISize() = 0;
38 virtual SkString onShortName() = 0;
39
40 private:
41 SkString fShortName;
reed@android.com00dae862009-06-10 15:38:48 +000042 };
43
44 typedef SkTRegistry<GM*, void*> GMRegistry;
45}
46
47#endif