aboutsummaryrefslogtreecommitdiffstats
path: root/gm/gm.h
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2009-09-14 11:53:40 -0400
committerMike Reed <reed@google.com>2009-09-14 15:01:10 -0400
commite32706edd70b0f847fe4d124a195cd2927dc8021 (patch)
treec5fb8da02dc56601068c0e3695cc7298cf1bd8e9 /gm/gm.h
parent7ca7644aeec45833638d2ce965f4c6ec62e71ade (diff)
downloadexternal_skia-e32706edd70b0f847fe4d124a195cd2927dc8021.zip
external_skia-e32706edd70b0f847fe4d124a195cd2927dc8021.tar.gz
external_skia-e32706edd70b0f847fe4d124a195cd2927dc8021.tar.bz2
add SkSize.h
add golden-master (gm) test app
Diffstat (limited to 'gm/gm.h')
-rw-r--r--gm/gm.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/gm/gm.h b/gm/gm.h
new file mode 100644
index 0000000..ab92ff6
--- /dev/null
+++ b/gm/gm.h
@@ -0,0 +1,45 @@
+#ifndef skiagm_DEFINED
+#define skiagm_DEFINED
+
+#include "SkCanvas.h"
+#include "SkPaint.h"
+#include "SkRefCnt.h"
+#include "SkSize.h"
+#include "SkString.h"
+#include "SkTRegistry.h"
+
+namespace skiagm {
+
+ static inline SkISize make_isize(int w, int h) {
+ SkISize sz;
+ sz.set(w, h);
+ return sz;
+ }
+
+ class GM {
+ public:
+ GM();
+ virtual ~GM();
+
+ void draw(SkCanvas*);
+ SkISize getISize() { return this->onISize(); }
+ const char* shortName() {
+ if (fShortName.size() == 0) {
+ fShortName = this->onShortName();
+ }
+ return fShortName.c_str();
+ }
+
+ protected:
+ virtual void onDraw(SkCanvas*) = 0;
+ virtual SkISize onISize() = 0;
+ virtual SkString onShortName() = 0;
+
+ private:
+ SkString fShortName;
+ };
+
+ typedef SkTRegistry<GM*, void*> GMRegistry;
+}
+
+#endif