#include <fragment_shader.h>
Definition at line 25 of file fragment_shader.h.
◆ ~ReusableFragmentShader()
flutter::ReusableFragmentShader::~ReusableFragmentShader |
( |
| ) |
|
|
overridedefault |
◆ Create()
Definition at line 36 of file fragment_shader.cc.
39 {
40 auto* fragment_program =
42 uint64_t float_count =
44 uint64_t sampler_count =
46
47 auto res = fml::MakeRefCounted<ReusableFragmentShader>(
48 fml::Ref(fragment_program), float_count, sampler_count);
49 res->AssociateWithDartWrapper(wrapper);
50
51 void* raw_uniform_data =
52 reinterpret_cast<void*>(res->uniform_data_->writable_data());
54 float_count);
55}
DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, void *data, intptr_t length)
@ Dart_TypedData_kFloat32
◆ Dispose()
void flutter::ReusableFragmentShader::Dispose |
( |
| ) |
|
Definition at line 114 of file fragment_shader.cc.
114 {
115 uniform_data_.
reset();
116 program_ = nullptr;
117 samplers_.clear();
119}
void reset(T *ptr=nullptr)
◆ SetImageSampler()
Definition at line 69 of file fragment_shader.cc.
70 {
74 if (index >= samplers_.size()) {
76 }
77 if (!
image->image()->isUIThreadSafe()) {
79 }
80
81
82
83 samplers_[index] = std::make_shared<DlImageColorSource>(
86
87
88 FML_DCHECK(samplers_[index]->isUIThreadSafe());
89
90 auto* uniform_floats =
92 uniform_floats[float_count_ + 2 * index] =
image->
width();
93 uniform_floats[float_count_ + 2 * index + 1] =
image->
height();
94}
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
#define FML_DCHECK(condition)
sk_sp< const SkImage > image
Dart_Handle ToDart(const T &object)
◆ shader()
Implements flutter::Shader.
Definition at line 96 of file fragment_shader.cc.
97 {
99
100
101
102
103 auto uniform_data = std::make_shared<std::vector<uint8_t>>();
104 uniform_data->resize(uniform_data_->
size());
105 memcpy(uniform_data->data(), uniform_data_->
bytes(), uniform_data->size());
106
107 auto source = program_->MakeDlColorSource(std::move(uniform_data), samplers_);
108
109
112}
const uint8_t * bytes() const
#define FML_CHECK(condition)
◆ ValidateSamplers()
bool flutter::ReusableFragmentShader::ValidateSamplers |
( |
| ) |
|
Definition at line 57 of file fragment_shader.cc.
57 {
58 for (
auto i = 0u;
i < samplers_.size();
i += 1) {
59 if (samplers_[
i] ==
nullptr) {
60 return false;
61 }
62
63
65 }
66 return true;
67}
The documentation for this class was generated from the following files: