2016-06-16 16:52:35 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "samplecode/Sample.h"
|
|
|
|
#include "tools/viewer/Slide.h"
|
2016-06-16 16:52:35 +00:00
|
|
|
|
|
|
|
class SampleSlide : public Slide {
|
|
|
|
public:
|
2018-08-08 15:36:17 +00:00
|
|
|
SampleSlide(const SampleFactory factory);
|
2016-06-16 16:52:35 +00:00
|
|
|
~SampleSlide() override;
|
|
|
|
|
2018-09-04 22:35:20 +00:00
|
|
|
SkISize getDimensions() const override;
|
|
|
|
|
2016-06-16 16:52:35 +00:00
|
|
|
void draw(SkCanvas* canvas) override;
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
2018-08-09 19:06:19 +00:00
|
|
|
void resize(SkScalar winWidth, SkScalar winHeight) override {
|
|
|
|
fSample->setSize(winWidth, winHeight);
|
|
|
|
}
|
2016-06-16 16:52:35 +00:00
|
|
|
void unload() override;
|
2019-07-11 20:32:53 +00:00
|
|
|
bool animate(double) override;
|
2016-06-16 16:52:35 +00:00
|
|
|
|
2017-02-14 20:16:46 +00:00
|
|
|
bool onChar(SkUnichar c) override;
|
2019-08-29 14:39:22 +00:00
|
|
|
bool onMouse(SkScalar x, SkScalar y, skui::InputState state,
|
|
|
|
skui::ModifierKey modifiers) override;
|
2017-02-14 20:16:46 +00:00
|
|
|
|
2016-06-16 16:52:35 +00:00
|
|
|
private:
|
2018-08-08 15:36:17 +00:00
|
|
|
const SampleFactory fSampleFactory;
|
2019-07-12 15:32:43 +00:00
|
|
|
std::unique_ptr<Sample> fSample;
|
2016-06-16 16:52:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|