1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SampleSlide_DEFINED 9 #define SampleSlide_DEFINED 10 11 #include "samplecode/Sample.h" 12 #include "tools/viewer/Slide.h" 13 14 class SampleSlide : public Slide { 15 public: 16 SampleSlide(const SampleFactory factory); 17 ~SampleSlide() override; 18 19 SkISize getDimensions() const override; 20 21 void draw(SkCanvas* canvas) override; 22 void load(SkScalar winWidth, SkScalar winHeight) override; resize(SkScalar winWidth,SkScalar winHeight)23 void resize(SkScalar winWidth, SkScalar winHeight) override { 24 fSample->setSize(winWidth, winHeight); 25 } 26 void unload() override; 27 bool animate(double) override; 28 29 bool onChar(SkUnichar c) override; 30 bool onMouse(SkScalar x, SkScalar y, skui::InputState state, 31 skui::ModifierKey modifiers) override; 32 33 private: 34 const SampleFactory fSampleFactory; 35 std::unique_ptr<Sample> fSample; 36 }; 37 38 #endif 39