add 'f' toggle to trigger timer for sample. Must subclass SampleView instead
of SkView to opt-in. Then override onDrawContent() and optionally onDrawBackground.
git-svn-id: http://skia.googlecode.com/svn/trunk@1165 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleCode.h b/samplecode/SampleCode.h
index 058985a..2eb8bef 100644
--- a/samplecode/SampleCode.h
+++ b/samplecode/SampleCode.h
@@ -3,6 +3,7 @@
#include "SkEvent.h"
#include "SkKey.h"
+#include "SkView.h"
class SampleCode {
public:
@@ -25,8 +26,6 @@
//////////////////////////////////////////////////////////////////////////////
-class SkView;
-
typedef SkView* (*SkViewFactory)();
class SkViewRegister : SkNoncopyable {
@@ -45,5 +44,28 @@
static SkViewRegister* gHead;
};
+///////////////////////////////////////////////////////////////////////////////
+
+class SampleView : public SkView {
+public:
+ SampleView() : fRepeatCount(1) {}
+
+ static void SetRepeatDraw(SkView*, int count);
+
+protected:
+ virtual void onDrawBackground(SkCanvas*);
+ virtual void onDrawContent(SkCanvas*) = 0;
+
+ // overrides
+ virtual bool onEvent(const SkEvent& evt);
+ virtual bool onQuery(SkEvent* evt);
+ virtual void onDraw(SkCanvas*);
+
+private:
+ int fRepeatCount;
+
+ typedef SkView INHERITED;
+};
+
#endif