From e32706edd70b0f847fe4d124a195cd2927dc8021 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Mon, 14 Sep 2009 11:53:40 -0400 Subject: add SkSize.h add golden-master (gm) test app --- gm/gm.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 gm/gm.h (limited to 'gm/gm.h') 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 GMRegistry; +} + +#endif -- cgit v1.1