forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
display_list_runtime_effect.h
85 lines (58 loc) · 2.24 KB
/
display_list_runtime_effect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_DISPLAY_LIST_RUNTIME_EFFECT_H_
#define FLUTTER_DISPLAY_LIST_RUNTIME_EFFECT_H_
#include <memory>
#include "flutter/fml/macros.h"
#include "flutter/impeller/runtime_stage/runtime_stage.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/effects/SkRuntimeEffect.h"
namespace flutter {
class DlRuntimeEffect : public SkRefCnt {
public:
static sk_sp<DlRuntimeEffect> MakeSkia(
const sk_sp<SkRuntimeEffect>& runtime_effect);
static sk_sp<DlRuntimeEffect> MakeImpeller(
std::shared_ptr<impeller::RuntimeStage> runtime_stage);
virtual sk_sp<SkRuntimeEffect> skia_runtime_effect() const = 0;
virtual std::shared_ptr<impeller::RuntimeStage> runtime_stage() const = 0;
protected:
DlRuntimeEffect();
virtual ~DlRuntimeEffect();
private:
FML_DISALLOW_COPY_AND_ASSIGN(DlRuntimeEffect);
};
class DlRuntimeEffectSkia final : public DlRuntimeEffect {
public:
explicit DlRuntimeEffectSkia(const sk_sp<SkRuntimeEffect>& runtime_effect);
// |DlRuntimeEffect|
sk_sp<SkRuntimeEffect> skia_runtime_effect() const override;
// |DlRuntimeEffect|
std::shared_ptr<impeller::RuntimeStage> runtime_stage() const override;
private:
DlRuntimeEffectSkia() = delete;
// |DlRuntimeEffect|
~DlRuntimeEffectSkia() override;
sk_sp<SkRuntimeEffect> skia_runtime_effect_;
FML_DISALLOW_COPY_AND_ASSIGN(DlRuntimeEffectSkia);
friend DlRuntimeEffect;
};
class DlRuntimeEffectImpeller final : public DlRuntimeEffect {
public:
explicit DlRuntimeEffectImpeller(
std::shared_ptr<impeller::RuntimeStage> runtime_stage);
// |DlRuntimeEffect|
sk_sp<SkRuntimeEffect> skia_runtime_effect() const override;
// |DlRuntimeEffect|
std::shared_ptr<impeller::RuntimeStage> runtime_stage() const override;
private:
DlRuntimeEffectImpeller() = delete;
// |DlRuntimeEffect|
~DlRuntimeEffectImpeller() override;
std::shared_ptr<impeller::RuntimeStage> runtime_stage_;
FML_DISALLOW_COPY_AND_ASSIGN(DlRuntimeEffectImpeller);
friend DlRuntimeEffect;
};
} // namespace flutter
#endif // FLUTTER_DISPLAY_LIST_RUNTIME_EFFECT_H_