From 76963e73704a42a18c29d6fbdcccb566e5c67658 Mon Sep 17 00:00:00 2001 From: jvanverth Date: Mon, 13 Jun 2016 09:31:26 -0700 Subject: 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 --- tools/viewer/SampleSlide.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tools/viewer/SampleSlide.h (limited to 'tools/viewer/SampleSlide.h') 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 -- cgit v1.2.3