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-03-20 16:55:08 +00:00
|
|
|
bool animate(const AnimTimer& timer) override { return fSample->animate(timer); }
|
2016-06-16 16:52:35 +00:00
|
|
|
|
2017-02-14 20:16:46 +00:00
|
|
|
bool onChar(SkUnichar c) override;
|
2017-11-02 13:46:49 +00:00
|
|
|
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState state,
|
|
|
|
uint32_t 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;
|
|
|
|
sk_sp<Sample> fSample;
|
|
|
|
Sample::Click* fClick;
|
2016-06-16 16:52:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|