/src/skia/src/core/SkRuntimeBlender.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2023 Google LLC |
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 | | #ifndef SkRuntimeBlender_DEFINED |
8 | | #define SkRuntimeBlender_DEFINED |
9 | | |
10 | | #include "include/core/SkData.h" |
11 | | #include "include/core/SkFlattenable.h" |
12 | | #include "include/core/SkRefCnt.h" |
13 | | #include "include/effects/SkRuntimeEffect.h" |
14 | | #include "include/private/base/SkSpan_impl.h" |
15 | | #include "src/core/SkBlenderBase.h" |
16 | | |
17 | | #include <utility> |
18 | | #include <vector> |
19 | | |
20 | | class SkReadBuffer; |
21 | | class SkWriteBuffer; |
22 | | struct SkStageRec; |
23 | | |
24 | | class SkRuntimeBlender : public SkBlenderBase { |
25 | | public: |
26 | | SkRuntimeBlender(sk_sp<SkRuntimeEffect> effect, |
27 | | sk_sp<const SkData> uniforms, |
28 | | SkSpan<const SkRuntimeEffect::ChildPtr> children) |
29 | | : fEffect(std::move(effect)) |
30 | | , fUniforms(std::move(uniforms)) |
31 | 3.49k | , fChildren(children.begin(), children.end()) {} |
32 | | |
33 | 0 | SkRuntimeEffect* asRuntimeEffect() const override { return fEffect.get(); } |
34 | | |
35 | 243 | BlenderType type() const override { return BlenderType::kRuntime; } |
36 | | |
37 | | bool onAppendStages(const SkStageRec& rec) const override; |
38 | | |
39 | | void flatten(SkWriteBuffer& buffer) const override; |
40 | | |
41 | | SK_FLATTENABLE_HOOKS(SkRuntimeBlender) |
42 | | |
43 | 729 | sk_sp<SkRuntimeEffect> effect() const { return fEffect; } |
44 | 243 | sk_sp<const SkData> uniforms() const { return fUniforms; } |
45 | 243 | SkSpan<const SkRuntimeEffect::ChildPtr> children() const { return fChildren; } |
46 | | |
47 | | private: |
48 | | sk_sp<SkRuntimeEffect> fEffect; |
49 | | sk_sp<const SkData> fUniforms; |
50 | | std::vector<SkRuntimeEffect::ChildPtr> fChildren; |
51 | | }; |
52 | | |
53 | | #endif |