• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SkSGScene_DEFINED
9 #define SkSGScene_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "include/core/SkTypes.h"
13 
14 #include <memory>
15 #include <vector>
16 
17 class SkCanvas;
18 struct SkPoint;
19 
20 namespace sksg {
21 
22 class InvalidationController;
23 class RenderNode;
24 
25 /**
26  * Holds a scene root.  Provides high-level methods for rendering.
27  *
28  */
29 class Scene final {
30 public:
31     static std::unique_ptr<Scene> Make(sk_sp<RenderNode> root);
32     ~Scene();
33     Scene(const Scene&) = delete;
34     Scene& operator=(const Scene&) = delete;
35 
36     void render(SkCanvas*) const;
37     void revalidate(InvalidationController* = nullptr);
38     const RenderNode* nodeAt(const SkPoint&) const;
39 
40 private:
41     explicit Scene(sk_sp<RenderNode> root);
42 
43     const sk_sp<RenderNode> fRoot;
44 };
45 
46 } // namespace sksg
47 
48 #endif // SkSGScene_DEFINED
49