| 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 |
#include "include/core/SkMatrix.h" |
| 9 |
#include "modules/sksg/include/SkSGRenderNode.h" |
| 10 |
#include "modules/sksg/include/SkSGScene.h" |
| 11 |
|
| 12 |
#include <utility> |
| 13 |
|
| 14 |
namespace sksg { |
| 15 |
|
| 16 |
std::unique_ptr<Scene> Scene::Make(sk_sp<RenderNode> root) { |
| 17 |
return root ? std::unique_ptr<Scene>(new Scene(std::move(root))) : nullptr; |
| 18 |
} |
| 19 |
|
| 20 |
Scene::Scene(sk_sp<RenderNode> root) : fRoot(std::move(root)) {} |
| 21 |
|
| 22 |
Scene::~Scene() = default; |
| 23 |
|
| 24 |
void Scene::render(SkCanvas* canvas) const { |
| 25 |
fRoot->render(canvas); |
| 26 |
} |
| 27 |
|
| 28 |
void Scene::revalidate(InvalidationController* ic) { |
| 29 |
fRoot->revalidate(ic, SkMatrix::I()); |
| 30 |
} |
| 31 |
|
| 32 |
const RenderNode* Scene::nodeAt(const SkPoint& p) const { |
| 33 |
return fRoot->nodeAt(p); |
| 34 |
} |
| 35 |
|
| 36 |
} // namespace sksg |