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 "modules/skottie/src/SkottiePriv.h" |
12 | |
13 | #include "include/private/SkTArray.h" |
14 | #include "include/private/SkTHash.h" |
15 | #include "modules/skottie/src/Layer.h" |
16 | |
17 | namespace skottie { |
18 | namespace internal { |
19 | |
20 | class CompositionBuilder final : SkNoncopyable { |
21 | public: |
22 | CompositionBuilder(const AnimationBuilder&, const SkSize&, const skjson::ObjectValue&); |
23 | ~CompositionBuilder(); |
24 | |
25 | sk_sp<sksg::RenderNode> build(const AnimationBuilder&); |
26 | |
27 | private: |
28 | LayerBuilder* layerBuilder(int layer_index); |
29 | |
30 | const sk_sp<sksg::Transform>& getCameraTransform() const { return fCameraTransform; } |
31 | |
32 | friend class LayerBuilder; |
33 | |
34 | const SkSize fSize; |
35 | |
36 | SkSTArray<64, LayerBuilder> fLayerBuilders; |
37 | SkTHashMap<int, size_t> fLayerIndexMap; // Maps layer "ind" to layer builder index. |
38 | |
39 | sk_sp<sksg::Transform> fCameraTransform; |
40 | |
41 | size_t fMotionBlurSamples = 1; |
42 | float fMotionBlurAngle = 0, |
43 | fMotionBlurPhase = 0; |
44 | }; |
45 | |
46 | } // namespace internal |
47 | } // namespace skottie |
48 | |
49 | #endif // SkottieComposition_DEFINED |
50 |