| 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 |
|
| 16 |
class SkCanvas; |
| 17 |
struct SkPoint; |
| 18 |
|
| 19 |
namespace sksg { |
| 20 |
|
| 21 |
class InvalidationController; |
| 22 |
class RenderNode; |
| 23 |
|
| 24 |
/** |
| 25 |
* Holds a scene root. Provides high-level methods for rendering. |
| 26 |
* |
| 27 |
*/ |
| 28 |
class Scene final { |
| 29 |
public: |
| 30 |
static std::unique_ptr<Scene> Make(sk_sp<RenderNode> root); |
| 31 |
~Scene(); |
| 32 |
Scene(const Scene&) = delete; |
| 33 |
Scene& operator=(const Scene&) = delete; |
| 34 |
|
| 35 |
void render(SkCanvas*) const; |
| 36 |
void revalidate(InvalidationController* = nullptr); |
| 37 |
const RenderNode* nodeAt(const SkPoint&) const; |
| 38 |
|
| 39 |
private: |
| 40 |
explicit Scene(sk_sp<RenderNode> root); |
| 41 |
|
| 42 |
const sk_sp<RenderNode> fRoot; |
| 43 |
}; |
| 44 |
|
| 45 |
} // namespace sksg |
| 46 |
|
| 47 |
#endif // SkSGScene_DEFINED |