aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer/SampleSlide.h
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2016-06-13 09:31:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-13 09:31:27 -0700
commit76963e73704a42a18c29d6fbdcccb566e5c67658 (patch)
treee007527879859f5c1857bd9bf3c2c3df32a1fd4c /tools/viewer/SampleSlide.h
parentfe19987e5499650e8637a8d109f19b8156601660 (diff)
Add samples to Viewer.
This adds support with animation, assuming the sample has implemented onAnimate. Event handling has not been implemented. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2056343004 Review-Url: https://codereview.chromium.org/2056343004
Diffstat (limited to 'tools/viewer/SampleSlide.h')
-rwxr-xr-xtools/viewer/SampleSlide.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/viewer/SampleSlide.h b/tools/viewer/SampleSlide.h
new file mode 100755
index 0000000000..3d772d093d
--- /dev/null
+++ b/tools/viewer/SampleSlide.h
@@ -0,0 +1,34 @@
+/*
+* Copyright 2016 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
+
+#ifndef SampleSlide_DEFINED
+#define SampleSlide_DEFINED
+
+#include "Slide.h"
+#include "SampleCode.h"
+
+class SampleSlide : public Slide {
+public:
+ SampleSlide(const SkViewFactory* factory);
+ ~SampleSlide() override;
+
+ void draw(SkCanvas* canvas) override;
+ void load(SkScalar winWidth, SkScalar winHeight) override;
+ void unload() override;
+ bool animate(const SkAnimTimer& timer) override {
+ if (SampleView::IsSampleView(fView)) {
+ return ((SampleView*)fView)->animate(timer);
+ }
+ return false;
+ }
+
+private:
+ const SkViewFactory* fViewFactory;
+ SkView* fView;
+};
+
+#endif