2018-01-22 17:57:06 +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 SkSGScene_DEFINED
|
|
|
|
#define SkSGScene_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#include "include/core/SkTypes.h"
|
2018-01-22 17:57:06 +00:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class SkCanvas;
|
2019-02-12 14:33:21 +00:00
|
|
|
struct SkPoint;
|
2018-01-22 17:57:06 +00:00
|
|
|
|
|
|
|
namespace sksg {
|
|
|
|
|
2019-07-22 16:05:41 +00:00
|
|
|
class InvalidationController;
|
2018-01-22 17:57:06 +00:00
|
|
|
class RenderNode;
|
|
|
|
|
|
|
|
/**
|
2020-03-26 19:58:56 +00:00
|
|
|
* Holds a scene root. Provides high-level methods for rendering.
|
2018-01-22 17:57:06 +00:00
|
|
|
*
|
|
|
|
*/
|
2018-07-16 21:44:06 +00:00
|
|
|
class Scene final {
|
2018-01-22 17:57:06 +00:00
|
|
|
public:
|
2020-03-26 19:58:56 +00:00
|
|
|
static std::unique_ptr<Scene> Make(sk_sp<RenderNode> root);
|
2018-01-22 17:57:06 +00:00
|
|
|
~Scene();
|
2018-07-16 21:44:06 +00:00
|
|
|
Scene(const Scene&) = delete;
|
|
|
|
Scene& operator=(const Scene&) = delete;
|
2018-01-22 17:57:06 +00:00
|
|
|
|
|
|
|
void render(SkCanvas*) const;
|
2020-03-26 19:58:56 +00:00
|
|
|
void revalidate(InvalidationController* = nullptr);
|
2019-02-12 14:33:21 +00:00
|
|
|
const RenderNode* nodeAt(const SkPoint&) const;
|
2018-01-22 17:57:06 +00:00
|
|
|
|
|
|
|
private:
|
2020-03-26 19:58:56 +00:00
|
|
|
explicit Scene(sk_sp<RenderNode> root);
|
2018-01-22 17:57:06 +00:00
|
|
|
|
|
|
|
const sk_sp<RenderNode> fRoot;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace sksg
|
|
|
|
|
|
|
|
#endif // SkSGScene_DEFINED
|