Debian Codegraph @

modules/skottie/src/Composition.h

raw
1 /*
2 * Copyright 2019 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 SkottieComposition_DEFINED
9 #define SkottieComposition_DEFINED
10
11 #include "include/core/SkRefCnt.h"
12 #include "include/core/SkSize.h"
13 #include "include/private/base/SkNoncopyable.h"
14 #include "modules/skottie/src/Layer.h"
15 #include "src/core/SkTHash.h"
16
17 #include <cstddef>
18 #include <vector>
19
20 namespace skjson {
21 class ObjectValue;
22 }
23 namespace sksg {
24 class RenderNode;
25 class Transform;
26 } // namespace sksg
27
28 namespace skottie {
29 namespace internal {
30 class AnimationBuilder;
31
32 class CompositionBuilder final : SkNoncopyable {
33 public:
34 CompositionBuilder(const AnimationBuilder&, const SkSize&, const skjson::ObjectValue&);
35 ~CompositionBuilder();
36
37 sk_sp<sksg::RenderNode> build(const AnimationBuilder&);
38
39 LayerBuilder* layerBuilder(int layer_index);
40
41 sk_sp<sksg::RenderNode> layerContent(const AnimationBuilder&, int layer_index);
42
43 private:
44 const sk_sp<sksg::Transform>& getCameraTransform() const { return fCameraTransform; }
45
46 friend class LayerBuilder;
47
48 const SkSize fSize;
49
50 std::vector<LayerBuilder> fLayerBuilders;
51 skia_private::THashMap<int, size_t> fLayerIndexMap; // Maps layer "ind" to layer builder index.
52
53 sk_sp<sksg::Transform> fCameraTransform;
54 };
55
56 } // namespace internal
57 } // namespace skottie
58
59 #endif // SkottieComposition_DEFINED