Flutter Engine
The Flutter Engine
SlideDir.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 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 SlideDir_DEFINED
9#define SlideDir_DEFINED
10
14#include "include/core/SkSize.h"
19#include "tools/viewer/Slide.h"
20
21#include <memory>
22#include <vector>
23
24class SkCanvas;
25class SkString;
26
27namespace skui {
28enum class InputState;
29enum class ModifierKey;
30} // namespace skui
31
32class SlideDir final : public Slide {
33public:
35 int columns = kDefaultColumnCount);
36
37 class Animator;
38
39protected:
40 void load(SkScalar winWidth, SkScalar winHeight) override;
41 void unload() override;
42
43 SkISize getDimensions() const override;
44
45 void draw(SkCanvas*) override;
46 bool animate(double) override;
47
48 bool onChar(SkUnichar) override;
49 bool onMouse(SkScalar x, SkScalar y, skui::InputState, skui::ModifierKey modifiers) override;
50
51private:
52 struct Rec;
53 class FocusController;
54
55 static constexpr int kDefaultColumnCount = 4;
56
57 const Rec* findCell(float x, float y) const;
58
60 std::unique_ptr<FocusController> fFocusController;
61 const int fColumns;
62
63 std::vector<Rec> fRecs;
64 std::unique_ptr<sksg::Scene> fScene;
65 std::vector<sk_sp<Animator>> fSceneAnimators;
67
68 SkSize fWinSize = SkSize::MakeEmpty();
69 SkSize fCellSize = SkSize::MakeEmpty();
70 SkMSec fTimeBase = 0;
71
72 const Rec* fTrackingCell = nullptr;
73 SkPoint fTrackingPos = SkPoint::Make(0, 0);
74};
75
76#endif // SlideDir_DEFINED
int32_t SkUnichar
Definition: SkTypes.h:175
uint32_t SkMSec
Definition: SkTypes.h:184
SlideDir(const SkString &name, skia_private::TArray< sk_sp< Slide > > &&, int columns=kDefaultColumnCount)
Definition: SlideDir.cpp:275
void load(SkScalar winWidth, SkScalar winHeight) override
Definition: SlideDir.cpp:294
void draw(SkCanvas *) override
Definition: SlideDir.cpp:372
bool onChar(SkUnichar) override
Definition: SlideDir.cpp:392
bool animate(double) override
Definition: SlideDir.cpp:376
SkISize getDimensions() const override
Definition: SlideDir.cpp:367
void unload() override
Definition: SlideDir.cpp:355
bool onMouse(SkScalar x, SkScalar y, skui::InputState, skui::ModifierKey modifiers) override
Definition: SlideDir.cpp:404
Definition: Slide.h:29
float SkScalar
Definition: extension.cpp:12
double y
double x
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
InputState
Definition: InputState.h:6
ModifierKey
Definition: ModifierKey.h:9
Definition: SkSize.h:16
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
Definition: SkSize.h:52
static constexpr SkSize MakeEmpty()
Definition: SkSize.h:62