2018-02-15 23:40:48 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2018 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SlideDir_DEFINED
|
|
|
|
#define SlideDir_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/viewer/Slide.h"
|
2018-02-15 23:40:48 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/private/SkTArray.h"
|
2018-02-15 23:40:48 +00:00
|
|
|
|
2020-03-26 19:58:56 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
2018-02-15 23:40:48 +00:00
|
|
|
class SkString;
|
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
namespace sksg {
|
|
|
|
|
|
|
|
class Group;
|
|
|
|
class Scene;
|
|
|
|
|
2020-08-06 18:11:56 +00:00
|
|
|
} // namespace sksg
|
2018-02-15 23:40:48 +00:00
|
|
|
|
|
|
|
class SlideDir final : public Slide {
|
|
|
|
public:
|
2018-09-05 19:41:23 +00:00
|
|
|
SlideDir(const SkString& name, SkTArray<sk_sp<Slide>>&&,
|
2018-02-15 23:40:48 +00:00
|
|
|
int columns = kDefaultColumnCount);
|
|
|
|
|
2020-03-26 19:58:56 +00:00
|
|
|
class Animator;
|
|
|
|
|
2018-02-15 23:40:48 +00:00
|
|
|
protected:
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
|
|
|
void unload() override;
|
|
|
|
|
|
|
|
SkISize getDimensions() const override;
|
|
|
|
|
|
|
|
void draw(SkCanvas*) override;
|
2019-07-11 20:32:53 +00:00
|
|
|
bool animate(double) override;
|
2018-02-15 23:40:48 +00:00
|
|
|
|
|
|
|
bool onChar(SkUnichar) override;
|
2019-08-29 14:39:22 +00:00
|
|
|
bool onMouse(SkScalar x, SkScalar y, skui::InputState, skui::ModifierKey modifiers) override;
|
2018-02-15 23:40:48 +00:00
|
|
|
|
|
|
|
private:
|
2018-02-19 18:25:18 +00:00
|
|
|
struct Rec;
|
|
|
|
class FocusController;
|
|
|
|
|
2018-02-15 23:40:48 +00:00
|
|
|
static constexpr int kDefaultColumnCount = 4;
|
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
const Rec* findCell(float x, float y) const;
|
2018-02-15 23:40:48 +00:00
|
|
|
|
2018-09-05 19:41:23 +00:00
|
|
|
const SkTArray<sk_sp<Slide>> fSlides;
|
2018-02-19 18:25:18 +00:00
|
|
|
std::unique_ptr<FocusController> fFocusController;
|
2018-02-15 23:40:48 +00:00
|
|
|
const int fColumns;
|
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
SkTArray<Rec, true> fRecs;
|
|
|
|
std::unique_ptr<sksg::Scene> fScene;
|
2020-03-26 19:58:56 +00:00
|
|
|
std::vector<sk_sp<Animator>> fSceneAnimators;
|
2018-02-19 18:25:18 +00:00
|
|
|
sk_sp<sksg::Group> fRoot;
|
|
|
|
|
|
|
|
SkSize fWinSize = SkSize::MakeEmpty();
|
|
|
|
SkSize fCellSize = SkSize::MakeEmpty();
|
|
|
|
SkMSec fTimeBase = 0;
|
2018-02-15 23:40:48 +00:00
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
const Rec* fTrackingCell = nullptr;
|
|
|
|
SkPoint fTrackingPos = SkPoint::Make(0, 0);
|
2018-02-15 23:40:48 +00:00
|
|
|
|
|
|
|
using INHERITED = Slide;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SlideDir_DEFINED
|