137 {
138 {
142
143 const auto& mutators =
params.mutatorsStack();
144
145 std::vector<const FlutterPlatformViewMutation*> mutations_array;
146
147 for (
auto i = mutators.Bottom();
i != mutators.Top(); ++
i) {
148 const auto& mutator = *
i;
149 switch (mutator->GetType()) {
151 mutations_array.push_back(
152 mutations_referenced_
154 .get());
155 } break;
157 mutations_array.push_back(
158 mutations_referenced_
160 .get());
161 } break;
162 case MutatorType::kClipPath: {
163
164 } break;
165 case MutatorType::kTransform: {
166 const auto&
matrix = mutator->GetMatrix();
167 if (!
matrix.isIdentity()) {
168 mutations_array.push_back(
170 .get());
171 }
172 } break;
173 case MutatorType::kOpacity: {
174 const double opacity =
175 std::clamp(mutator->GetAlphaFloat(), 0.0f, 1.0f);
176 if (opacity < 1.0) {
177 mutations_array.push_back(
180 }
181 } break;
183 break;
184 }
185 }
186
187 if (!mutations_array.empty()) {
188
189
190 if (!root_surface_transformation_.
isIdentity()) {
191 mutations_array.push_back(
192 mutations_referenced_
195 }
196
197 auto mutations =
198 std::make_unique<std::vector<const FlutterPlatformViewMutation*>>(
199 mutations_array.rbegin(), mutations_array.rend());
200 mutations_arrays_referenced_.emplace_back(std::move(mutations));
201
203 view.
mutations = mutations_arrays_referenced_.back().get()->data();
204 }
205
206 platform_views_referenced_.emplace_back(
207 std::make_unique<FlutterPlatformView>(view));
208 }
209
211
214 layer.
platform_view = platform_views_referenced_.back().get();
215
216 const auto layer_bounds =
218 params.finalBoundingRect().y(),
219 params.sizePoints().width() * device_pixel_ratio_,
220 params.sizePoints().height() * device_pixel_ratio_
221 );
222
223 const auto transformed_layer_bounds =
224 root_surface_transformation_.
mapRect(layer_bounds);
225
226 layer.
offset.
x = transformed_layer_bounds.x();
227 layer.
offset.
y = transformed_layer_bounds.y();
228 layer.
size.
width = transformed_layer_bounds.width();
229 layer.
size.
height = transformed_layer_bounds.height();
230
232
233 presented_layers_.push_back(layer);
234}
static unsigned clamp(SkFixed fx, int max)
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
const EmbeddedViewParams * params
unsigned useCenter Optional< SkMatrix > matrix
static std::unique_ptr< FlutterPlatformViewMutation > ConvertMutation(double opacity)
const myers::Point & get(const myers::Segment &)
const FlutterPlatformView * platform_view
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)