| Flutter Impeller |

dl_dispatcher.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "impeller/display_list/dl_dispatcher.h"
6
7 #include <algorithm>
8 #include <cstring>
9 #include <memory>
10 #include <optional>
11 #include <utility>
12 #include <vector>
13
14 #include "flutter/fml/logging.h"
15 #include "flutter/fml/trace_event.h"
16 #include "impeller/aiks/color_filter.h"
17 #include "impeller/core/formats.h"
18 #include "impeller/display_list/dl_vertices_geometry.h"
19 #include "impeller/display_list/nine_patch_converter.h"
20 #include "impeller/display_list/skia_conversions.h"
21 #include "impeller/entity/contents/filters/filter_contents.h"
22 #include "impeller/entity/contents/filters/inputs/filter_input.h"
23 #include "impeller/entity/contents/runtime_effect_contents.h"
24 #include "impeller/entity/entity.h"
25 #include "impeller/geometry/path.h"
26 #include "impeller/geometry/path_builder.h"
27 #include "impeller/geometry/scalar.h"
28 #include "impeller/geometry/sigma.h"
29
30 #if IMPELLER_ENABLE_3D
31 #include "impeller/entity/contents/scene_contents.h"
32 #endif // IMPELLER_ENABLE_3D
33
34 namespace impeller {
35
36 #define UNIMPLEMENTED \
37 FML_DLOG(ERROR) << "Unimplemented detail in " << __FUNCTION__;
38
39 DlDispatcher::DlDispatcher() = default;
40
41 DlDispatcher::DlDispatcher(Rect cull_rect) : canvas_(cull_rect) {}
42
43 DlDispatcher::DlDispatcher(IRect cull_rect) : canvas_(cull_rect) {}
44
45 DlDispatcher::~DlDispatcher() = default;
46
47 static BlendMode ToBlendMode(flutter::DlBlendMode mode) {
48 switch (mode) {
49 case flutter::DlBlendMode::kClear:
50 return BlendMode::kClear;
51 case flutter::DlBlendMode::kSrc:
52 return BlendMode::kSource;
53 case flutter::DlBlendMode::kDst:
54 return BlendMode::kDestination;
55 case flutter::DlBlendMode::kSrcOver:
56 return BlendMode::kSourceOver;
57 case flutter::DlBlendMode::kDstOver:
58 return BlendMode::kDestinationOver;
59 case flutter::DlBlendMode::kSrcIn:
60 return BlendMode::kSourceIn;
61 case flutter::DlBlendMode::kDstIn:
62 return BlendMode::kDestinationIn;
63 case flutter::DlBlendMode::kSrcOut:
64 return BlendMode::kSourceOut;
65 case flutter::DlBlendMode::kDstOut:
66 return BlendMode::kDestinationOut;
67 case flutter::DlBlendMode::kSrcATop:
68 return BlendMode::kSourceATop;
69 case flutter::DlBlendMode::kDstATop:
70 return BlendMode::kDestinationATop;
71 case flutter::DlBlendMode::kXor:
72 return BlendMode::kXor;
73 case flutter::DlBlendMode::kPlus:
74 return BlendMode::kPlus;
75 case flutter::DlBlendMode::kModulate:
76 return BlendMode::kModulate;
77 case flutter::DlBlendMode::kScreen:
78 return BlendMode::kScreen;
79 case flutter::DlBlendMode::kOverlay:
80 return BlendMode::kOverlay;
81 case flutter::DlBlendMode::kDarken:
82 return BlendMode::kDarken;
83 case flutter::DlBlendMode::kLighten:
84 return BlendMode::kLighten;
85 case flutter::DlBlendMode::kColorDodge:
86 return BlendMode::kColorDodge;
87 case flutter::DlBlendMode::kColorBurn:
88 return BlendMode::kColorBurn;
89 case flutter::DlBlendMode::kHardLight:
90 return BlendMode::kHardLight;
91 case flutter::DlBlendMode::kSoftLight:
92 return BlendMode::kSoftLight;
93 case flutter::DlBlendMode::kDifference:
94 return BlendMode::kDifference;
95 case flutter::DlBlendMode::kExclusion:
96 return BlendMode::kExclusion;
97 case flutter::DlBlendMode::kMultiply:
98 return BlendMode::kMultiply;
99 case flutter::DlBlendMode::kHue:
100 return BlendMode::kHue;
101 case flutter::DlBlendMode::kSaturation:
102 return BlendMode::kSaturation;
103 case flutter::DlBlendMode::kColor:
104 return BlendMode::kColor;
105 case flutter::DlBlendMode::kLuminosity:
106 return BlendMode::kLuminosity;
107 }
108 FML_UNREACHABLE();
109 }
110
111 static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode) {
112 switch (tile_mode) {
113 case flutter::DlTileMode::kClamp:
114 return Entity::TileMode::kClamp;
115 case flutter::DlTileMode::kRepeat:
116 return Entity::TileMode::kRepeat;
117 case flutter::DlTileMode::kMirror:
118 return Entity::TileMode::kMirror;
119 case flutter::DlTileMode::kDecal:
120 return Entity::TileMode::kDecal;
121 }
122 }
123
124 static impeller::SamplerDescriptor ToSamplerDescriptor(
125 const flutter::DlImageSampling options) {
126 impeller::SamplerDescriptor desc;
127 switch (options) {
128 case flutter::DlImageSampling::kNearestNeighbor:
129 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kNearest;
130 desc.label = "Nearest Sampler";
131 break;
132 case flutter::DlImageSampling::kLinear:
133 // Impeller doesn't support cubic sampling, but linear is closer to correct
134 // than nearest for this case.
135 case flutter::DlImageSampling::kCubic:
136 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
137 desc.label = "Linear Sampler";
138 break;
139 case flutter::DlImageSampling::kMipmapLinear:
140 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
141 desc.mip_filter = impeller::MipFilter::kLinear;
142 desc.label = "Mipmap Linear Sampler";
143 break;
144 }
145 return desc;
146 }
147
148 static impeller::SamplerDescriptor ToSamplerDescriptor(
149 const flutter::DlFilterMode options) {
150 impeller::SamplerDescriptor desc;
151 switch (options) {
152 case flutter::DlFilterMode::kNearest:
153 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kNearest;
154 desc.label = "Nearest Sampler";
155 break;
156 case flutter::DlFilterMode::kLinear:
157 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
158 desc.label = "Linear Sampler";
159 break;
160 default:
161 break;
162 }
163 return desc;
164 }
165
166 static Matrix ToMatrix(const SkMatrix& m) {
167 return Matrix{
168 // clang-format off
169 m[0], m[3], 0, m[6],
170 m[1], m[4], 0, m[7],
171 0, 0, 1, 0,
172 m[2], m[5], 0, m[8],
173 // clang-format on
174 };
175 }
176
177 // |flutter::DlOpReceiver|
178 void DlDispatcher::setAntiAlias(bool aa) {
179 // Nothing to do because AA is implicit.
180 }
181
182 static Paint::Style ToStyle(flutter::DlDrawStyle style) {
183 switch (style) {
184 case flutter::DlDrawStyle::kFill:
185 return Paint::Style::kFill;
186 case flutter::DlDrawStyle::kStroke:
187 return Paint::Style::kStroke;
188 case flutter::DlDrawStyle::kStrokeAndFill:
189 UNIMPLEMENTED;
190 break;
191 }
192 return Paint::Style::kFill;
193 }
194
195 // |flutter::DlOpReceiver|
196 void DlDispatcher::setDrawStyle(flutter::DlDrawStyle style) {
197 paint_.style = ToStyle(style);
198 }
199
200 // |flutter::DlOpReceiver|
201 void DlDispatcher::setColor(flutter::DlColor color) {
202 paint_.color = {
203 color.getRedF(),
204 color.getGreenF(),
205 color.getBlueF(),
206 color.getAlphaF(),
207 };
208 }
209
210 // |flutter::DlOpReceiver|
211 void DlDispatcher::setStrokeWidth(SkScalar width) {
212 paint_.stroke_width = width;
213 }
214
215 // |flutter::DlOpReceiver|
216 void DlDispatcher::setStrokeMiter(SkScalar limit) {
217 paint_.stroke_miter = limit;
218 }
219
220 // |flutter::DlOpReceiver|
221 void DlDispatcher::setStrokeCap(flutter::DlStrokeCap cap) {
222 switch (cap) {
223 case flutter::DlStrokeCap::kButt:
224 paint_.stroke_cap = Cap::kButt;
225 break;
226 case flutter::DlStrokeCap::kRound:
227 paint_.stroke_cap = Cap::kRound;
228 break;
229 case flutter::DlStrokeCap::kSquare:
230 paint_.stroke_cap = Cap::kSquare;
231 break;
232 }
233 }
234
235 // |flutter::DlOpReceiver|
236 void DlDispatcher::setStrokeJoin(flutter::DlStrokeJoin join) {
237 switch (join) {
238 case flutter::DlStrokeJoin::kMiter:
239 paint_.stroke_join = Join::kMiter;
240 break;
241 case flutter::DlStrokeJoin::kRound:
242 paint_.stroke_join = Join::kRound;
243 break;
244 case flutter::DlStrokeJoin::kBevel:
245 paint_.stroke_join = Join::kBevel;
246 break;
247 }
248 }
249
250 static std::vector<Color> ToColors(const flutter::DlColor colors[], int count) {
251 auto result = std::vector<Color>();
252 if (colors == nullptr) {
253 return result;
254 }
255 for (int i = 0; i < count; i++) {
256 result.push_back(skia_conversions::ToColor(colors[i]));
257 }
258 return result;
259 }
260
261 static std::optional<ColorSource::Type> ToColorSourceType(
262 flutter::DlColorSourceType type) {
263 switch (type) {
264 case flutter::DlColorSourceType::kColor:
265 return ColorSource::Type::kColor;
266 case flutter::DlColorSourceType::kImage:
267 return ColorSource::Type::kImage;
268 case flutter::DlColorSourceType::kLinearGradient:
269 return ColorSource::Type::kLinearGradient;
270 case flutter::DlColorSourceType::kRadialGradient:
271 return ColorSource::Type::kRadialGradient;
272 case flutter::DlColorSourceType::kConicalGradient:
273 return ColorSource::Type::kConicalGradient;
274 case flutter::DlColorSourceType::kSweepGradient:
275 return ColorSource::Type::kSweepGradient;
276 case flutter::DlColorSourceType::kRuntimeEffect:
277 return ColorSource::Type::kRuntimeEffect;
278 #ifdef IMPELLER_ENABLE_3D
279 case flutter::DlColorSourceType::kScene:
280 return ColorSource::Type::kScene;
281 #endif // IMPELLER_ENABLE_3D
282 }
283 }
284
285 // |flutter::DlOpReceiver|
286 void DlDispatcher::setColorSource(const flutter::DlColorSource* source) {
287 if (!source) {
288 paint_.color_source = ColorSource::MakeColor();
289 return;
290 }
291
292 std::optional<ColorSource::Type> type = ToColorSourceType(source->type());
293
294 if (!type.has_value()) {
295 FML_LOG(ERROR) << "Requested ColorSourceType::kUnknown";
296 paint_.color_source = ColorSource::MakeColor();
297 return;
298 }
299
300 switch (type.value()) {
301 case ColorSource::Type::kColor: {
302 const flutter::DlColorColorSource* color = source->asColor();
303
304 paint_.color_source = ColorSource::MakeColor();
305 setColor(color->color());
306 FML_DCHECK(color);
307 return;
308 }
309 case ColorSource::Type::kLinearGradient: {
310 const flutter::DlLinearGradientColorSource* linear =
311 source->asLinearGradient();
312 FML_DCHECK(linear);
313 auto start_point = skia_conversions::ToPoint(linear->start_point());
314 auto end_point = skia_conversions::ToPoint(linear->end_point());
315 std::vector<Color> colors;
316 std::vector<float> stops;
317 skia_conversions::ConvertStops(linear, colors, stops);
318
319 auto tile_mode = ToTileMode(linear->tile_mode());
320 auto matrix = ToMatrix(linear->matrix());
321
322 paint_.color_source = ColorSource::MakeLinearGradient(
323 start_point, end_point, std::move(colors), std::move(stops),
324 tile_mode, matrix);
325 return;
326 }
327 case ColorSource::Type::kConicalGradient: {
328 const flutter::DlConicalGradientColorSource* conical_gradient =
329 source->asConicalGradient();
330 FML_DCHECK(conical_gradient);
331 Point center = skia_conversions::ToPoint(conical_gradient->end_center());
332 SkScalar radius = conical_gradient->end_radius();
333 Point focus_center =
334 skia_conversions::ToPoint(conical_gradient->start_center());
335 SkScalar focus_radius = conical_gradient->start_radius();
336 std::vector<Color> colors;
337 std::vector<float> stops;
338 skia_conversions::ConvertStops(conical_gradient, colors, stops);
339
340 auto tile_mode = ToTileMode(conical_gradient->tile_mode());
341 auto matrix = ToMatrix(conical_gradient->matrix());
342
343 paint_.color_source = ColorSource::MakeConicalGradient(
344 center, radius, std::move(colors), std::move(stops), focus_center,
345 focus_radius, tile_mode, matrix);
346 return;
347 }
348 case ColorSource::Type::kRadialGradient: {
349 const flutter::DlRadialGradientColorSource* radialGradient =
350 source->asRadialGradient();
351 FML_DCHECK(radialGradient);
352 auto center = skia_conversions::ToPoint(radialGradient->center());
353 auto radius = radialGradient->radius();
354 std::vector<Color> colors;
355 std::vector<float> stops;
356 skia_conversions::ConvertStops(radialGradient, colors, stops);
357
358 auto tile_mode = ToTileMode(radialGradient->tile_mode());
359 auto matrix = ToMatrix(radialGradient->matrix());
360 paint_.color_source =
361 ColorSource::MakeRadialGradient(center, radius, std::move(colors),
362 std::move(stops), tile_mode, matrix);
363 return;
364 }
365 case ColorSource::Type::kSweepGradient: {
366 const flutter::DlSweepGradientColorSource* sweepGradient =
367 source->asSweepGradient();
368 FML_DCHECK(sweepGradient);
369
370 auto center = skia_conversions::ToPoint(sweepGradient->center());
371 auto start_angle = Degrees(sweepGradient->start());
372 auto end_angle = Degrees(sweepGradient->end());
373 std::vector<Color> colors;
374 std::vector<float> stops;
375 skia_conversions::ConvertStops(sweepGradient, colors, stops);
376
377 auto tile_mode = ToTileMode(sweepGradient->tile_mode());
378 auto matrix = ToMatrix(sweepGradient->matrix());
379 paint_.color_source = ColorSource::MakeSweepGradient(
380 center, start_angle, end_angle, std::move(colors), std::move(stops),
381 tile_mode, matrix);
382 return;
383 }
384 case ColorSource::Type::kImage: {
385 const flutter::DlImageColorSource* image_color_source = source->asImage();
386 FML_DCHECK(image_color_source &&
387 image_color_source->image()->impeller_texture());
388 auto texture = image_color_source->image()->impeller_texture();
389 auto x_tile_mode = ToTileMode(image_color_source->horizontal_tile_mode());
390 auto y_tile_mode = ToTileMode(image_color_source->vertical_tile_mode());
391 auto desc = ToSamplerDescriptor(image_color_source->sampling());
392 auto matrix = ToMatrix(image_color_source->matrix());
393 paint_.color_source = ColorSource::MakeImage(texture, x_tile_mode,
394 y_tile_mode, desc, matrix);
395 return;
396 }
397 case ColorSource::Type::kRuntimeEffect: {
398 const flutter::DlRuntimeEffectColorSource* runtime_effect_color_source =
399 source->asRuntimeEffect();
400 auto runtime_stage =
401 runtime_effect_color_source->runtime_effect()->runtime_stage();
402 auto uniform_data = runtime_effect_color_source->uniform_data();
403 auto samplers = runtime_effect_color_source->samplers();
404
405 std::vector<RuntimeEffectContents::TextureInput> texture_inputs;
406
407 for (auto& sampler : samplers) {
408 if (sampler == nullptr) {
409 return;
410 }
411 auto* image = sampler->asImage();
412 if (!sampler->asImage()) {
413 UNIMPLEMENTED;
414 return;
415 }
416 FML_DCHECK(image->image()->impeller_texture());
417 texture_inputs.push_back({
418 .sampler_descriptor = ToSamplerDescriptor(image->sampling()),
419 .texture = image->image()->impeller_texture(),
420 });
421 }
422
423 paint_.color_source = ColorSource::MakeRuntimeEffect(
424 runtime_stage, uniform_data, texture_inputs);
425 return;
426 }
427 case ColorSource::Type::kScene: {
428 #ifdef IMPELLER_ENABLE_3D
429 const flutter::DlSceneColorSource* scene_color_source = source->asScene();
430 std::shared_ptr<scene::Node> scene_node =
431 scene_color_source->scene_node();
432 Matrix camera_transform = scene_color_source->camera_matrix();
433
434 paint_.color_source =
435 ColorSource::MakeScene(scene_node, camera_transform);
436 #else // IMPELLER_ENABLE_3D
437 FML_LOG(ERROR) << "ColorSourceType::kScene can only be used if Impeller "
438 "Scene is enabled.";
439 #endif // IMPELLER_ENABLE_3D
440 return;
441 }
442 }
443 }
444
445 static std::shared_ptr<ColorFilter> ToColorFilter(
446 const flutter::DlColorFilter* filter) {
447 if (filter == nullptr) {
448 return nullptr;
449 }
450 switch (filter->type()) {
451 case flutter::DlColorFilterType::kBlend: {
452 auto dl_blend = filter->asBlend();
453 auto blend_mode = ToBlendMode(dl_blend->mode());
454 auto color = skia_conversions::ToColor(dl_blend->color());
455 return ColorFilter::MakeBlend(blend_mode, color);
456 }
457 case flutter::DlColorFilterType::kMatrix: {
458 const flutter::DlMatrixColorFilter* dl_matrix = filter->asMatrix();
459 impeller::ColorMatrix color_matrix;
460 dl_matrix->get_matrix(color_matrix.array);
461 return ColorFilter::MakeMatrix(color_matrix);
462 }
463 case flutter::DlColorFilterType::kSrgbToLinearGamma:
464 return ColorFilter::MakeSrgbToLinear();
465 case flutter::DlColorFilterType::kLinearToSrgbGamma:
466 return ColorFilter::MakeLinearToSrgb();
467 }
468 return nullptr;
469 }
470
471 // |flutter::DlOpReceiver|
472 void DlDispatcher::setColorFilter(const flutter::DlColorFilter* filter) {
473 paint_.color_filter = ToColorFilter(filter);
474 }
475
476 // |flutter::DlOpReceiver|
477 void DlDispatcher::setInvertColors(bool invert) {
478 paint_.invert_colors = invert;
479 }
480
481 // |flutter::DlOpReceiver|
482 void DlDispatcher::setBlendMode(flutter::DlBlendMode dl_mode) {
483 paint_.blend_mode = ToBlendMode(dl_mode);
484 }
485
486 // |flutter::DlOpReceiver|
487 void DlDispatcher::setPathEffect(const flutter::DlPathEffect* effect) {
488 // Needs https://github.com/flutter/flutter/issues/95434
489 UNIMPLEMENTED;
490 }
491
492 static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style) {
493 switch (blur_style) {
494 case flutter::DlBlurStyle::kNormal:
495 return FilterContents::BlurStyle::kNormal;
496 case flutter::DlBlurStyle::kSolid:
497 return FilterContents::BlurStyle::kSolid;
498 case flutter::DlBlurStyle::kOuter:
499 return FilterContents::BlurStyle::kOuter;
500 case flutter::DlBlurStyle::kInner:
501 return FilterContents::BlurStyle::kInner;
502 }
503 }
504
505 // |flutter::DlOpReceiver|
506 void DlDispatcher::setMaskFilter(const flutter::DlMaskFilter* filter) {
507 // Needs https://github.com/flutter/flutter/issues/95434
508 if (filter == nullptr) {
509 paint_.mask_blur_descriptor = std::nullopt;
510 return;
511 }
512 switch (filter->type()) {
513 case flutter::DlMaskFilterType::kBlur: {
514 auto blur = filter->asBlur();
515
516 paint_.mask_blur_descriptor = {
517 .style = ToBlurStyle(blur->style()),
518 .sigma = Sigma(blur->sigma()),
519 };
520 break;
521 }
522 }
523 }
524
525 static std::shared_ptr<ImageFilter> ToImageFilter(
526 const flutter::DlImageFilter* filter) {
527 if (filter == nullptr) {
528 return nullptr;
529 }
530
531 switch (filter->type()) {
532 case flutter::DlImageFilterType::kBlur: {
533 auto blur = filter->asBlur();
534 auto sigma_x = Sigma(blur->sigma_x());
535 auto sigma_y = Sigma(blur->sigma_y());
536 auto tile_mode = ToTileMode(blur->tile_mode());
537 return ImageFilter::MakeBlur(
538 sigma_x, sigma_y, FilterContents::BlurStyle::kNormal, tile_mode);
539 }
540 case flutter::DlImageFilterType::kDilate: {
541 auto dilate = filter->asDilate();
542 FML_DCHECK(dilate);
543 if (dilate->radius_x() < 0 || dilate->radius_y() < 0) {
544 return nullptr;
545 }
546 auto radius_x = Radius(dilate->radius_x());
547 auto radius_y = Radius(dilate->radius_y());
548 return ImageFilter::MakeDilate(radius_x, radius_y);
549 }
550 case flutter::DlImageFilterType::kErode: {
551 auto erode = filter->asErode();
552 FML_DCHECK(erode);
553 if (erode->radius_x() < 0 || erode->radius_y() < 0) {
554 return nullptr;
555 }
556 auto radius_x = Radius(erode->radius_x());
557 auto radius_y = Radius(erode->radius_y());
558 return ImageFilter::MakeErode(radius_x, radius_y);
559 }
560 case flutter::DlImageFilterType::kMatrix: {
561 auto matrix_filter = filter->asMatrix();
562 FML_DCHECK(matrix_filter);
563 auto matrix = ToMatrix(matrix_filter->matrix());
564 auto desc = ToSamplerDescriptor(matrix_filter->sampling());
565 return ImageFilter::MakeMatrix(matrix, desc);
566 }
567 case flutter::DlImageFilterType::kCompose: {
568 auto compose = filter->asCompose();
569 FML_DCHECK(compose);
570 auto outer_dl_filter = compose->outer();
571 auto inner_dl_filter = compose->inner();
572 auto outer_filter = ToImageFilter(outer_dl_filter.get());
573 auto inner_filter = ToImageFilter(inner_dl_filter.get());
574 if (!outer_filter) {
575 return inner_filter;
576 }
577 if (!inner_filter) {
578 return outer_filter;
579 }
580 FML_DCHECK(outer_filter && inner_filter);
581
582 return ImageFilter::MakeCompose(*inner_filter, *outer_filter);
583 }
584 case flutter::DlImageFilterType::kColorFilter: {
585 auto color_filter_image_filter = filter->asColorFilter();
586 FML_DCHECK(color_filter_image_filter);
587 auto color_filter =
588 ToColorFilter(color_filter_image_filter->color_filter().get());
589 if (!color_filter) {
590 return nullptr;
591 }
592 // When color filters are used as image filters, set the color filter's
593 // "absorb opacity" flag to false. For image filters, the snapshot
594 // opacity needs to be deferred until the result of the filter chain is
595 // being blended with the layer.
596 return ImageFilter::MakeFromColorFilter(*color_filter);
597 }
598 case flutter::DlImageFilterType::kLocalMatrix: {
599 auto local_matrix_filter = filter->asLocalMatrix();
600 FML_DCHECK(local_matrix_filter);
601 auto internal_filter = local_matrix_filter->image_filter();
602 FML_DCHECK(internal_filter);
603
604 auto image_filter = ToImageFilter(internal_filter.get());
605 if (!image_filter) {
606 return nullptr;
607 }
608
609 auto matrix = ToMatrix(local_matrix_filter->matrix());
610 return ImageFilter::MakeLocalMatrix(matrix, *image_filter);
611 }
612 }
613 }
614
615 // |flutter::DlOpReceiver|
616 void DlDispatcher::setImageFilter(const flutter::DlImageFilter* filter) {
617 paint_.image_filter = ToImageFilter(filter);
618 }
619
620 // |flutter::DlOpReceiver|
621 void DlDispatcher::save() {
622 canvas_.Save();
623 }
624
625 // |flutter::DlOpReceiver|
626 void DlDispatcher::saveLayer(const SkRect& bounds,
627 const flutter::SaveLayerOptions options,
628 const flutter::DlImageFilter* backdrop) {
629 auto paint = options.renders_with_attributes() ? paint_ : Paint{};
630 auto promise = options.content_is_clipped()
631 ? ContentBoundsPromise::kMayClipContents
632 : ContentBoundsPromise::kContainsContents;
633 canvas_.SaveLayer(paint, skia_conversions::ToRect(bounds),
634 ToImageFilter(backdrop), promise);
635 }
636
637 // |flutter::DlOpReceiver|
638 void DlDispatcher::restore() {
639 canvas_.Restore();
640 }
641
642 // |flutter::DlOpReceiver|
643 void DlDispatcher::translate(SkScalar tx, SkScalar ty) {
644 canvas_.Translate({tx, ty, 0.0});
645 }
646
647 // |flutter::DlOpReceiver|
648 void DlDispatcher::scale(SkScalar sx, SkScalar sy) {
649 canvas_.Scale({sx, sy, 1.0});
650 }
651
652 // |flutter::DlOpReceiver|
653 void DlDispatcher::rotate(SkScalar degrees) {
654 canvas_.Rotate(Degrees{degrees});
655 }
656
657 // |flutter::DlOpReceiver|
658 void DlDispatcher::skew(SkScalar sx, SkScalar sy) {
659 canvas_.Skew(sx, sy);
660 }
661
662 // |flutter::DlOpReceiver|
663 void DlDispatcher::transform2DAffine(SkScalar mxx,
664 SkScalar mxy,
665 SkScalar mxt,
666 SkScalar myx,
667 SkScalar myy,
668 SkScalar myt) {
669 // clang-format off
670 transformFullPerspective(
671 mxx, mxy, 0, mxt,
672 myx, myy, 0, myt,
673 0 , 0, 1, 0,
674 0 , 0, 0, 1
675 );
676 // clang-format on
677 }
678
679 // |flutter::DlOpReceiver|
680 void DlDispatcher::transformFullPerspective(SkScalar mxx,
681 SkScalar mxy,
682 SkScalar mxz,
683 SkScalar mxt,
684 SkScalar myx,
685 SkScalar myy,
686 SkScalar myz,
687 SkScalar myt,
688 SkScalar mzx,
689 SkScalar mzy,
690 SkScalar mzz,
691 SkScalar mzt,
692 SkScalar mwx,
693 SkScalar mwy,
694 SkScalar mwz,
695 SkScalar mwt) {
696 // The order of arguments is row-major but Impeller matrices are
697 // column-major.
698 // clang-format off
699 auto transform = Matrix{
700 mxx, myx, mzx, mwx,
701 mxy, myy, mzy, mwy,
702 mxz, myz, mzz, mwz,
703 mxt, myt, mzt, mwt
704 };
705 // clang-format on
706 canvas_.Transform(transform);
707 }
708
709 // |flutter::DlOpReceiver|
710 void DlDispatcher::transformReset() {
711 canvas_.ResetTransform();
712 canvas_.Transform(initial_matrix_);
713 }
714
715 static Entity::ClipOperation ToClipOperation(
716 flutter::DlCanvas::ClipOp clip_op) {
717 switch (clip_op) {
718 case flutter::DlCanvas::ClipOp::kDifference:
719 return Entity::ClipOperation::kDifference;
720 case flutter::DlCanvas::ClipOp::kIntersect:
721 return Entity::ClipOperation::kIntersect;
722 }
723 }
724
725 // |flutter::DlOpReceiver|
726 void DlDispatcher::clipRect(const SkRect& rect, ClipOp clip_op, bool is_aa) {
727 canvas_.ClipRect(skia_conversions::ToRect(rect), ToClipOperation(clip_op));
728 }
729
730 // |flutter::DlOpReceiver|
731 void DlDispatcher::clipRRect(const SkRRect& rrect, ClipOp sk_op, bool is_aa) {
732 auto clip_op = ToClipOperation(sk_op);
733 if (rrect.isRect()) {
734 canvas_.ClipRect(skia_conversions::ToRect(rrect.rect()), clip_op);
735 } else if (rrect.isOval()) {
736 canvas_.ClipOval(skia_conversions::ToRect(rrect.rect()), clip_op);
737 } else if (rrect.isSimple()) {
738 canvas_.ClipRRect(skia_conversions::ToRect(rrect.rect()),
739 skia_conversions::ToSize(rrect.getSimpleRadii()),
740 clip_op);
741 } else {
742 canvas_.ClipPath(skia_conversions::ToPath(rrect), clip_op);
743 }
744 }
745
746 // |flutter::DlOpReceiver|
747 void DlDispatcher::clipPath(const SkPath& path, ClipOp sk_op, bool is_aa) {
748 UNIMPLEMENTED;
749 }
750
751 const Path& DlDispatcher::GetOrCachePath(const CacheablePath& cache) {
752 if (cache.cached_impeller_path.IsEmpty() && !cache.sk_path.isEmpty()) {
753 cache.cached_impeller_path = skia_conversions::ToPath(cache.sk_path);
754 }
755 return cache.cached_impeller_path;
756 }
757
758 // |flutter::DlOpReceiver|
759 void DlDispatcher::clipPath(const CacheablePath& cache,
760 ClipOp sk_op,
761 bool is_aa) {
762 auto clip_op = ToClipOperation(sk_op);
763
764 SkRect rect;
765 if (cache.sk_path.isRect(&rect)) {
766 canvas_.ClipRect(skia_conversions::ToRect(rect), clip_op);
767 } else if (cache.sk_path.isOval(&rect)) {
768 canvas_.ClipOval(skia_conversions::ToRect(rect), clip_op);
769 } else {
770 SkRRect rrect;
771 if (cache.sk_path.isRRect(&rrect) && rrect.isSimple()) {
772 canvas_.ClipRRect(skia_conversions::ToRect(rrect.rect()),
773 skia_conversions::ToSize(rrect.getSimpleRadii()),
774 clip_op);
775 } else {
776 canvas_.ClipPath(GetOrCachePath(cache), clip_op);
777 }
778 }
779 }
780
781 // |flutter::DlOpReceiver|
782 void DlDispatcher::drawColor(flutter::DlColor color,
783 flutter::DlBlendMode dl_mode) {
784 Paint paint;
785 paint.color = skia_conversions::ToColor(color);
786 paint.blend_mode = ToBlendMode(dl_mode);
787 canvas_.DrawPaint(paint);
788 }
789
790 // |flutter::DlOpReceiver|
791 void DlDispatcher::drawPaint() {
792 canvas_.DrawPaint(paint_);
793 }
794
795 // |flutter::DlOpReceiver|
796 void DlDispatcher::drawLine(const SkPoint& p0, const SkPoint& p1) {
797 canvas_.DrawLine(skia_conversions::ToPoint(p0), skia_conversions::ToPoint(p1),
798 paint_);
799 }
800
801 // |flutter::DlOpReceiver|
802 void DlDispatcher::drawRect(const SkRect& rect) {
803 canvas_.DrawRect(skia_conversions::ToRect(rect), paint_);
804 }
805
806 // |flutter::DlOpReceiver|
807 void DlDispatcher::drawOval(const SkRect& bounds) {
808 canvas_.DrawOval(skia_conversions::ToRect(bounds), paint_);
809 }
810
811 // |flutter::DlOpReceiver|
812 void DlDispatcher::drawCircle(const SkPoint& center, SkScalar radius) {
813 canvas_.DrawCircle(skia_conversions::ToPoint(center), radius, paint_);
814 }
815
816 // |flutter::DlOpReceiver|
817 void DlDispatcher::drawRRect(const SkRRect& rrect) {
818 if (rrect.isSimple()) {
819 canvas_.DrawRRect(skia_conversions::ToRect(rrect.rect()),
820 skia_conversions::ToSize(rrect.getSimpleRadii()), paint_);
821 } else {
822 canvas_.DrawPath(skia_conversions::ToPath(rrect), paint_);
823 }
824 }
825
826 // |flutter::DlOpReceiver|
827 void DlDispatcher::drawDRRect(const SkRRect& outer, const SkRRect& inner) {
828 PathBuilder builder;
829 builder.AddPath(skia_conversions::ToPath(outer));
830 builder.AddPath(skia_conversions::ToPath(inner));
831 canvas_.DrawPath(builder.TakePath(FillType::kOdd), paint_);
832 }
833
834 // |flutter::DlOpReceiver|
835 void DlDispatcher::drawPath(const SkPath& path) {
836 UNIMPLEMENTED;
837 }
838
839 // |flutter::DlOpReceiver|
840 void DlDispatcher::drawPath(const CacheablePath& cache) {
841 SimplifyOrDrawPath(canvas_, cache, paint_);
842 }
843
844 void DlDispatcher::SimplifyOrDrawPath(CanvasType& canvas,
845 const CacheablePath& cache,
846 const Paint& paint) {
847 SkRect rect;
848
849 // We can't "optimize" a path into a rectangle if it's open.
850 bool closed;
851 if (cache.sk_path.isRect(&rect, &closed) && closed) {
852 canvas.DrawRect(skia_conversions::ToRect(rect), paint);
853 return;
854 }
855
856 SkRRect rrect;
857 if (cache.sk_path.isRRect(&rrect) && rrect.isSimple()) {
858 canvas.DrawRRect(skia_conversions::ToRect(rrect.rect()),
859 skia_conversions::ToSize(rrect.getSimpleRadii()), paint);
860 return;
861 }
862
863 SkRect oval;
864 if (cache.sk_path.isOval(&oval)) {
865 canvas.DrawOval(skia_conversions::ToRect(oval), paint);
866 return;
867 }
868
869 canvas.DrawPath(GetOrCachePath(cache), paint);
870 }
871
872 // |flutter::DlOpReceiver|
873 void DlDispatcher::drawArc(const SkRect& oval_bounds,
874 SkScalar start_degrees,
875 SkScalar sweep_degrees,
876 bool use_center) {
877 PathBuilder builder;
878 builder.AddArc(skia_conversions::ToRect(oval_bounds), Degrees(start_degrees),
879 Degrees(sweep_degrees), use_center);
880 canvas_.DrawPath(builder.TakePath(), paint_);
881 }
882
883 // |flutter::DlOpReceiver|
884 void DlDispatcher::drawPoints(PointMode mode,
885 uint32_t count,
886 const SkPoint points[]) {
887 Paint paint = paint_;
888 paint.style = Paint::Style::kStroke;
889 switch (mode) {
890 case flutter::DlCanvas::PointMode::kPoints: {
891 // Cap::kButt is also treated as a square.
892 auto point_style = paint.stroke_cap == Cap::kRound ? PointStyle::kRound
893 : PointStyle::kSquare;
894 auto radius = paint.stroke_width;
895 if (radius > 0) {
896 radius /= 2.0;
897 }
898 canvas_.DrawPoints(skia_conversions::ToPoints(points, count), radius,
899 paint, point_style);
900 } break;
901 case flutter::DlCanvas::PointMode::kLines:
902 for (uint32_t i = 1; i < count; i += 2) {
903 Point p0 = skia_conversions::ToPoint(points[i - 1]);
904 Point p1 = skia_conversions::ToPoint(points[i]);
905 canvas_.DrawLine(p0, p1, paint);
906 }
907 break;
908 case flutter::DlCanvas::PointMode::kPolygon:
909 if (count > 1) {
910 Point p0 = skia_conversions::ToPoint(points[0]);
911 for (uint32_t i = 1; i < count; i++) {
912 Point p1 = skia_conversions::ToPoint(points[i]);
913 canvas_.DrawLine(p0, p1, paint);
914 p0 = p1;
915 }
916 }
917 break;
918 }
919 }
920
921 // |flutter::DlOpReceiver|
922 void DlDispatcher::drawVertices(const flutter::DlVertices* vertices,
923 flutter::DlBlendMode dl_mode) {
924 canvas_.DrawVertices(MakeVertices(vertices), ToBlendMode(dl_mode), paint_);
925 }
926
927 // |flutter::DlOpReceiver|
928 void DlDispatcher::drawImage(const sk_sp<flutter::DlImage> image,
929 const SkPoint point,
930 flutter::DlImageSampling sampling,
931 bool render_with_attributes) {
932 if (!image) {
933 return;
934 }
935
936 auto texture = image->impeller_texture();
937 if (!texture) {
938 return;
939 }
940
941 const auto size = texture->GetSize();
942 const auto src = SkRect::MakeWH(size.width, size.height);
943 const auto dest =
944 SkRect::MakeXYWH(point.fX, point.fY, size.width, size.height);
945
946 drawImageRect(image, // image
947 src, // source rect
948 dest, // destination rect
949 sampling, // sampling options
950 render_with_attributes, // render with attributes
951 SrcRectConstraint::kStrict // constraint
952 );
953 }
954
955 // |flutter::DlOpReceiver|
956 void DlDispatcher::drawImageRect(
957 const sk_sp<flutter::DlImage> image,
958 const SkRect& src,
959 const SkRect& dst,
960 flutter::DlImageSampling sampling,
961 bool render_with_attributes,
962 SrcRectConstraint constraint = SrcRectConstraint::kFast) {
963 canvas_.DrawImageRect(
964 std::make_shared<Image>(image->impeller_texture()), // image
965 skia_conversions::ToRect(src), // source rect
966 skia_conversions::ToRect(dst), // destination rect
967 render_with_attributes ? paint_ : Paint(), // paint
968 ToSamplerDescriptor(sampling) // sampling
969 );
970 }
971
972 // |flutter::DlOpReceiver|
973 void DlDispatcher::drawImageNine(const sk_sp<flutter::DlImage> image,
974 const SkIRect& center,
975 const SkRect& dst,
976 flutter::DlFilterMode filter,
977 bool render_with_attributes) {
978 NinePatchConverter converter = {};
979 converter.DrawNinePatch(
980 std::make_shared<Image>(image->impeller_texture()),
981 Rect::MakeLTRB(center.fLeft, center.fTop, center.fRight, center.fBottom),
982 skia_conversions::ToRect(dst), ToSamplerDescriptor(filter), &canvas_,
983 &paint_);
984 }
985
986 // |flutter::DlOpReceiver|
987 void DlDispatcher::drawAtlas(const sk_sp<flutter::DlImage> atlas,
988 const SkRSXform xform[],
989 const SkRect tex[],
990 const flutter::DlColor colors[],
991 int count,
992 flutter::DlBlendMode mode,
993 flutter::DlImageSampling sampling,
994 const SkRect* cull_rect,
995 bool render_with_attributes) {
996 canvas_.DrawAtlas(std::make_shared<Image>(atlas->impeller_texture()),
997 skia_conversions::ToRSXForms(xform, count),
998 skia_conversions::ToRects(tex, count),
999 ToColors(colors, count), ToBlendMode(mode),
1000 ToSamplerDescriptor(sampling),
1001 skia_conversions::ToRect(cull_rect), paint_);
1002 }
1003
1004 // |flutter::DlOpReceiver|
1005 void DlDispatcher::drawDisplayList(
1006 const sk_sp<flutter::DisplayList> display_list,
1007 SkScalar opacity) {
1008 // Save all values that must remain untouched after the operation.
1009 Paint saved_paint = paint_;
1010 Matrix saved_initial_matrix = initial_matrix_;
1011 int restore_count = canvas_.GetSaveCount();
1012
1013 // The display list may alter the clip, which must be restored to the current
1014 // clip at the end of playback.
1015 canvas_.Save();
1016
1017 // Establish a new baseline for interpreting the new DL.
1018 // Matrix and clip are left untouched, the current
1019 // transform is saved as the new base matrix, and paint
1020 // values are reset to defaults.
1021 initial_matrix_ = canvas_.GetCurrentTransform();
1022 paint_ = Paint();
1023
1024 // Handle passed opacity in the most brute-force way by using
1025 // a SaveLayer. If the display_list is able to inherit the
1026 // opacity, this could also be handled by modulating all of its
1027 // attribute settings (for example, color), by the indicated
1028 // opacity.
1029 if (opacity < SK_Scalar1) {
1030 Paint save_paint;
1031 save_paint.color = Color(0, 0, 0, opacity);
1032 canvas_.SaveLayer(save_paint);
1033 }
1034
1035 // TODO(131445): Remove this restriction if we can correctly cull with
1036 // perspective transforms.
1037 if (display_list->has_rtree() && !initial_matrix_.HasPerspective()) {
1038 // The canvas remembers the screen-space culling bounds clipped by
1039 // the surface and the history of clip calls. DisplayList can cull
1040 // the ops based on a rectangle expressed in its "destination bounds"
1041 // so we need the canvas to transform those into the current local
1042 // coordinate space into which the DisplayList will be rendered.
1043 auto cull_bounds = canvas_.GetCurrentLocalCullingBounds();
1044 if (cull_bounds.has_value()) {
1045 Rect cull_rect = cull_bounds.value();
1046 display_list->Dispatch(
1047 *this, SkRect::MakeLTRB(cull_rect.GetLeft(), cull_rect.GetTop(),
1048 cull_rect.GetRight(), cull_rect.GetBottom()));
1049 } else {
1050 display_list->Dispatch(*this);
1051 }
1052 } else {
1053 display_list->Dispatch(*this);
1054 }
1055
1056 // Restore all saved state back to what it was before we interpreted
1057 // the display_list
1058 canvas_.RestoreToCount(restore_count);
1059 initial_matrix_ = saved_initial_matrix;
1060 paint_ = saved_paint;
1061 }
1062
1063 // |flutter::DlOpReceiver|
1064 void DlDispatcher::drawTextBlob(const sk_sp<SkTextBlob> blob,
1065 SkScalar x,
1066 SkScalar y) {
1067 // When running with Impeller enabled Skia text blobs are converted to
1068 // Impeller text frames in paragraph_skia.cc
1069 UNIMPLEMENTED;
1070 }
1071
1072 void DlDispatcher::drawTextFrame(const std::shared_ptr<TextFrame>& text_frame,
1073 SkScalar x,
1074 SkScalar y) {
1075 canvas_.DrawTextFrame(text_frame, //
1076 impeller::Point{x, y}, //
1077 paint_ //
1078 );
1079 }
1080
1081 // |flutter::DlOpReceiver|
1082 void DlDispatcher::drawShadow(const SkPath& path,
1083 const flutter::DlColor color,
1084 const SkScalar elevation,
1085 bool transparent_occluder,
1086 SkScalar dpr) {
1087 UNIMPLEMENTED;
1088 }
1089
1090 // |flutter::DlOpReceiver|
1091 void DlDispatcher::drawShadow(const CacheablePath& cache,
1092 const flutter::DlColor color,
1093 const SkScalar elevation,
1094 bool transparent_occluder,
1095 SkScalar dpr) {
1096 Color spot_color = skia_conversions::ToColor(color);
1097 spot_color.alpha *= 0.25;
1098
1099 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
1100 {
1101 Scalar max =
1102 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
1103 Scalar min =
1104 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
1105 Scalar luminance = (min + max) * 0.5;
1106
1107 Scalar alpha_adjust =
1108 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
1109 spot_color.alpha;
1110 Scalar color_alpha =
1111 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
1112 luminance;
1113 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
1114
1115 Scalar greyscale_alpha =
1116 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
1117
1118 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
1119 Scalar tonal_alpha = color_scale + greyscale_alpha;
1120 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
1121 spot_color = Color(unpremul_scale * spot_color.red,
1122 unpremul_scale * spot_color.green,
1123 unpremul_scale * spot_color.blue, tonal_alpha);
1124 }
1125
1126 Vector3 light_position(0, -1, 1);
1127 Scalar occluder_z = dpr * elevation;
1128
1129 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
1130
1131 Paint paint;
1132 paint.style = Paint::Style::kFill;
1133 paint.color = spot_color;
1134 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
1135 .style = FilterContents::BlurStyle::kNormal,
1136 .sigma = Radius{kLightRadius * occluder_z /
1137 canvas_.GetCurrentTransform().GetScale().y},
1138 };
1139
1140 canvas_.Save();
1141 canvas_.PreConcat(
1142 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
1143
1144 SimplifyOrDrawPath(canvas_, cache, paint);
1145
1146 canvas_.Restore();
1147 }
1148
1149 Picture DlDispatcher::EndRecordingAsPicture() {
1150 TRACE_EVENT0("impeller", "DisplayListDispatcher::EndRecordingAsPicture");
1151 return canvas_.EndRecordingAsPicture();
1152 }
1153
1154 } // namespace impeller
impeller::DlDispatcher::setBlendMode
void setBlendMode(flutter::DlBlendMode mode) override
Definition: dl_dispatcher.cc:482
impeller::DlDispatcher::drawTextBlob
void drawTextBlob(const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
Definition: dl_dispatcher.cc:1064
impeller::Paint::stroke_cap
Cap stroke_cap
Definition: paint.h:60
impeller::Matrix::HasPerspective
constexpr bool HasPerspective() const
Definition: matrix.h:321
impeller::Canvas::DrawPoints
void DrawPoints(std::vector< Point > points, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:683
impeller::Entity::ClipOperation::kIntersect
@ kIntersect
path.h
impeller::Entity::TileMode::kClamp
@ kClamp
impeller::Canvas::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: canvas.cc:756
impeller::Canvas::ClipOval
void ClipOval(const Rect &bounds, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:570
impeller::ColorSource::Type::kScene
@ kScene
impeller::DlDispatcher::save
void save() override
Definition: dl_dispatcher.cc:621
impeller::ColorSource::Type::kLinearGradient
@ kLinearGradient
impeller::DlDispatcher::drawOval
void drawOval(const SkRect &bounds) override
Definition: dl_dispatcher.cc:807
impeller::ToClipOperation
static Entity::ClipOperation ToClipOperation(flutter::DlCanvas::ClipOp clip_op)
Definition: dl_dispatcher.cc:715
impeller::Cap::kRound
@ kRound
impeller::Cap::kSquare
@ kSquare
impeller::BlendMode::kDestinationATop
@ kDestinationATop
impeller::DlDispatcher::DlDispatcher
DlDispatcher()
impeller::Canvas::DrawRRect
void DrawRRect(const Rect &rect, const Size &corner_radii, const Paint &paint)
Definition: canvas.cc:488
impeller::DlDispatcher::drawImageRect
void drawImageRect(const sk_sp< flutter::DlImage > image, const SkRect &src, const SkRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
Definition: dl_dispatcher.cc:956
impeller::DlDispatcher::scale
void scale(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:648
impeller::ImageFilter::MakeDilate
static std::shared_ptr< ImageFilter > MakeDilate(Radius radius_x, Radius radius_y)
Definition: image_filter.cc:29
impeller::skia_conversions::ToPoints
std::vector< Point > ToPoints(const SkPoint points[], int count)
Definition: skia_conversions.cc:31
impeller::Entity::ClipOperation::kDifference
@ kDifference
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Canvas::RestoreToCount
void RestoreToCount(size_t count)
Definition: canvas.cc:284
impeller::Canvas::DrawImageRect
void DrawImageRect(const std::shared_ptr< Image > &image, Rect source, Rect dest, const Paint &paint, SamplerDescriptor sampler={}, SourceRectConstraint src_rect_constraint=SourceRectConstraint::kFast)
Definition: canvas.cc:717
impeller::ContentBoundsPromise::kMayClipContents
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
impeller::ColorSource::Type::kRadialGradient
@ kRadialGradient
impeller::Paint::Style::kStroke
@ kStroke
impeller::skia_conversions::ConvertStops
void ConvertStops(const flutter::DlGradientColorSourceBase *gradient, std::vector< Color > &colors, std::vector< float > &stops)
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the st...
Definition: skia_conversions.cc:198
entity.h
impeller::ColorSource::MakeLinearGradient
static ColorSource MakeLinearGradient(Point start_point, Point end_point, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:45
impeller::Paint
Definition: paint.h:23
impeller::FillType::kOdd
@ kOdd
impeller::skia_conversions::ToSize
Size ToSize(const SkPoint &point)
Definition: skia_conversions.cc:144
impeller::DlDispatcher::drawRRect
void drawRRect(const SkRRect &rrect) override
Definition: dl_dispatcher.cc:817
impeller::Canvas::Skew
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:272
impeller::BlendMode
BlendMode
Definition: color.h:59
impeller::FilterContents::BlurStyle
BlurStyle
Definition: filter_contents.h:26
impeller::Color
Definition: color.h:124
impeller::DlDispatcher::clipRRect
void clipRRect(const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:731
impeller::ToImageFilter
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
Definition: dl_dispatcher.cc:525
impeller::NinePatchConverter::DrawNinePatch
void DrawNinePatch(const std::shared_ptr< Image > &image, Rect center, Rect dst, const SamplerDescriptor &sampler, CanvasType *canvas, Paint *paint)
Definition: nine_patch_converter.cc:60
impeller::BlendMode::kLuminosity
@ kLuminosity
impeller::Paint::color
Color color
Definition: paint.h:55
impeller::Entity::TileMode::kDecal
@ kDecal
impeller::BlendMode::kSource
@ kSource
impeller::DlDispatcher::drawArc
void drawArc(const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
Definition: dl_dispatcher.cc:873
impeller::BlendMode::kColorDodge
@ kColorDodge
impeller::DlDispatcher::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: dl_dispatcher.cc:1149
impeller::Canvas::DrawTextFrame
void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:821
impeller::BlendMode::kDestination
@ kDestination
impeller::DlDispatcher::drawPaint
void drawPaint() override
Definition: dl_dispatcher.cc:791
dl_dispatcher.h
impeller::DlDispatcher::setStrokeJoin
void setStrokeJoin(flutter::DlStrokeJoin join) override
Definition: dl_dispatcher.cc:236
impeller::Canvas
Definition: canvas.h:58
impeller::BlendMode::kDarken
@ kDarken
impeller::PathBuilder::AddPath
PathBuilder & AddPath(const Path &path)
Definition: path_builder.cc:425
formats.h
impeller::PathBuilder
Definition: path_builder.h:14
impeller::Paint::MaskBlurDescriptor::style
FilterContents::BlurStyle style
Definition: paint.h:40
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::DlDispatcher::setImageFilter
void setImageFilter(const flutter::DlImageFilter *filter) override
Definition: dl_dispatcher.cc:616
impeller::Vector2
Point Vector2
Definition: point.h:320
impeller::Canvas::ResetTransform
void ResetTransform()
Definition: canvas.cc:239
impeller::DlDispatcher::transform2DAffine
void transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
Definition: dl_dispatcher.cc:663
impeller::Canvas::DrawVertices
void DrawVertices(const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint)
Definition: canvas.cc:865
impeller::DlDispatcher::transformFullPerspective
void transformFullPerspective(SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
Definition: dl_dispatcher.cc:680
impeller::BlendMode::kColor
@ kColor
impeller::skia_conversions::ToRects
std::vector< Rect > ToRects(const SkRect tex[], int count)
Definition: skia_conversions.cc:23
impeller::Color::alpha
Scalar alpha
Definition: color.h:143
impeller::MakeVertices
std::shared_ptr< impeller::VerticesGeometry > MakeVertices(const flutter::DlVertices *vertices)
Definition: dl_vertices_geometry.cc:31
impeller::ImageFilter::MakeBlur
static std::shared_ptr< ImageFilter > MakeBlur(Sigma sigma_x, Sigma sigma_y, FilterContents::BlurStyle blur_style, Entity::TileMode tile_mode)
Definition: image_filter.cc:20
impeller::BlendMode::kDestinationOver
@ kDestinationOver
impeller::BlendMode::kPlus
@ kPlus
impeller::DlDispatcher::drawRect
void drawRect(const SkRect &rect) override
Definition: dl_dispatcher.cc:802
impeller::Paint::MaskBlurDescriptor
Definition: paint.h:39
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:148
impeller::ColorSource::MakeSweepGradient
static ColorSource MakeSweepGradient(Point center, Degrees start_angle, Degrees end_angle, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:138
impeller::BlendMode::kOverlay
@ kOverlay
impeller::ColorSource::MakeColor
static ColorSource MakeColor()
Definition: color_source.cc:41
impeller::ColorSource::MakeImage
static ColorSource MakeImage(std::shared_ptr< Texture > texture, Entity::TileMode x_tile_mode, Entity::TileMode y_tile_mode, SamplerDescriptor sampler_descriptor, Matrix effect_transform)
Definition: color_source.cc:163
impeller::FilterContents::BlurStyle::kNormal
@ kNormal
Blurred inside and outside.
impeller::DlDispatcher::drawLine
void drawLine(const SkPoint &p0, const SkPoint &p1) override
Definition: dl_dispatcher.cc:796
impeller::Cap::kButt
@ kButt
impeller::DlDispatcher::drawColor
void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override
Definition: dl_dispatcher.cc:782
impeller::Entity::TileMode::kRepeat
@ kRepeat
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
impeller::DlDispatcher::drawImage
void drawImage(const sk_sp< flutter::DlImage > image, const SkPoint point, flutter::DlImageSampling sampling, bool render_with_attributes) override
Definition: dl_dispatcher.cc:928
impeller::Canvas::DrawLine
void DrawLine(const Point &p0, const Point &p1, const Paint &paint)
Definition: canvas.cc:430
impeller::DlDispatcher::~DlDispatcher
~DlDispatcher()
impeller::Paint::color_source
ColorSource color_source
Definition: paint.h:56
impeller::Color::green
Scalar green
Definition: color.h:133
impeller::Canvas::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: canvas.cc:441
impeller::Canvas::GetCurrentTransform
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:247
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:36
impeller::DlDispatcher::restore
void restore() override
Definition: dl_dispatcher.cc:638
impeller::ToTileMode
static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode)
Definition: dl_dispatcher.cc:111
impeller::BlendMode::kModulate
@ kModulate
impeller::DlDispatcher::drawPath
void drawPath(const SkPath &path) override
Definition: dl_dispatcher.cc:835
impeller::DlDispatcher::clipRect
void clipRect(const SkRect &rect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:726
impeller::Join::kMiter
@ kMiter
runtime_effect_contents.h
impeller::DlDispatcher::drawDisplayList
void drawDisplayList(const sk_sp< flutter::DisplayList > display_list, SkScalar opacity) override
Definition: dl_dispatcher.cc:1005
impeller::Canvas::SaveLayer
void SaveLayer(const Paint &paint, std::optional< Rect > bounds=std::nullopt, const std::shared_ptr< ImageFilter > &backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown)
Definition: canvas.cc:786
impeller::BlendMode::kSourceOut
@ kSourceOut
impeller::ImageFilter::MakeFromColorFilter
static std::shared_ptr< ImageFilter > MakeFromColorFilter(const ColorFilter &color_filter)
Definition: image_filter.cc:52
impeller::BlendMode::kSaturation
@ kSaturation
impeller::Entity::TileMode::kMirror
@ kMirror
impeller::Paint::stroke_miter
Scalar stroke_miter
Definition: paint.h:62
impeller::BlendMode::kDifference
@ kDifference
impeller::DlDispatcher::setStrokeWidth
void setStrokeWidth(SkScalar width) override
Definition: dl_dispatcher.cc:211
impeller::ToMatrix
static Matrix ToMatrix(const SkMatrix &m)
Definition: dl_dispatcher.cc:166
path_builder.h
impeller::ToColors
static std::vector< Color > ToColors(const flutter::DlColor colors[], int count)
Definition: dl_dispatcher.cc:250
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::SamplerDescriptor::mag_filter
MinMagFilter mag_filter
Definition: sampler_descriptor.h:17
impeller::skia_conversions::ToRect
Rect ToRect(const SkRect &rect)
Definition: skia_conversions.cc:12
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
impeller::kColor
@ kColor
Definition: geometry.h:51
impeller::BlendMode::kLighten
@ kLighten
impeller::Paint::color_filter
std::shared_ptr< ColorFilter > color_filter
Definition: paint.h:68
impeller::DlDispatcher::setColorFilter
void setColorFilter(const flutter::DlColorFilter *filter) override
Definition: dl_dispatcher.cc:472
impeller::Picture
Definition: picture.h:20
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::SamplerDescriptor::min_filter
MinMagFilter min_filter
Definition: sampler_descriptor.h:16
impeller::BlendMode::kSoftLight
@ kSoftLight
filter_contents.h
impeller::BlendMode::kColorBurn
@ kColorBurn
impeller::TRect::GetLeft
constexpr auto GetLeft() const
Definition: rect.h:318
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:264
scene_contents.h
skia_conversions.h
impeller::DlDispatcher::drawImageNine
void drawImageNine(const sk_sp< flutter::DlImage > image, const SkIRect &center, const SkRect &dst, flutter::DlFilterMode filter, bool render_with_attributes) override
Definition: dl_dispatcher.cc:973
impeller::DlDispatcher::saveLayer
void saveLayer(const SkRect &bounds, const flutter::SaveLayerOptions options, const flutter::DlImageFilter *backdrop) override
Definition: dl_dispatcher.cc:626
impeller::BlendMode::kHardLight
@ kHardLight
sigma.h
impeller::DlDispatcher::transformReset
void transformReset() override
Definition: dl_dispatcher.cc:710
impeller::Radius
For convolution filters, the "radius" is the size of the convolution kernel to use on the local space...
Definition: sigma.h:48
impeller::FilterContents::BlurStyle::kSolid
@ kSolid
Solid inside, blurred outside.
impeller::Matrix::GetScale
constexpr Vector3 GetScale() const
Definition: matrix.h:306
impeller::Path
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:51
impeller::ColorSource::MakeConicalGradient
static ColorSource MakeConicalGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Point focus_center, Scalar focus_radius, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:74
impeller::ColorFilter::MakeBlend
static std::shared_ptr< ColorFilter > MakeBlend(BlendMode blend_mode, Color color)
Definition: color_filter.cc:23
impeller::Canvas::Save
void Save()
Definition: canvas.cc:136
impeller::ColorSource::Type::kRuntimeEffect
@ kRuntimeEffect
impeller::BlendMode::kClear
@ kClear
impeller::DlDispatcher::drawDRRect
void drawDRRect(const SkRRect &outer, const SkRRect &inner) override
Definition: dl_dispatcher.cc:827
impeller::DlDispatcher::clipPath
void clipPath(const SkPath &path, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:747
impeller::MinMagFilter::kLinear
@ kLinear
impeller::Paint::style
Style style
Definition: paint.h:63
impeller::ImageFilter::MakeLocalMatrix
static std::shared_ptr< ImageFilter > MakeLocalMatrix(const Matrix &matrix, const ImageFilter &internal_filter)
Definition: image_filter.cc:57
impeller::Paint::Style::kFill
@ kFill
impeller::ToColorSourceType
static std::optional< ColorSource::Type > ToColorSourceType(flutter::DlColorSourceType type)
Definition: dl_dispatcher.cc:261
impeller::ColorMatrix::array
Scalar array[20]
Definition: color.h:118
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:515
impeller::DlDispatcher::setMaskFilter
void setMaskFilter(const flutter::DlMaskFilter *filter) override
Definition: dl_dispatcher.cc:506
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:182
impeller::Color::red
Scalar red
Definition: color.h:128
impeller::Sigma
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
Definition: sigma.h:32
impeller::Canvas::Restore
bool Restore()
Definition: canvas.cc:208
impeller::ImageFilter::MakeErode
static std::shared_ptr< ImageFilter > MakeErode(Radius radius_x, Radius radius_y)
Definition: image_filter.cc:34
impeller::Canvas::DrawAtlas
void DrawAtlas(const std::shared_ptr< Image > &atlas, std::vector< Matrix > transforms, std::vector< Rect > texture_coordinates, std::vector< Color > colors, BlendMode blend_mode, SamplerDescriptor sampler, std::optional< Rect > cull_rect, const Paint &paint)
Definition: canvas.cc:925
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:292
impeller::PathBuilder::TakePath
Path TakePath(FillType fill=FillType::kNonZero)
Definition: path_builder.cc:22
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:302
filter_input.h
impeller::NinePatchConverter
Definition: nine_patch_converter.h:18
impeller::ToBlurStyle
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
Definition: dl_dispatcher.cc:492
impeller::Canvas::GetSaveCount
size_t GetSaveCount() const
Definition: canvas.cc:280
impeller::Join::kRound
@ kRound
impeller::DlDispatcher::drawShadow
void drawShadow(const SkPath &path, const flutter::DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
Definition: dl_dispatcher.cc:1082
impeller::Vector3::y
Scalar y
Definition: vector.h:24
impeller::FilterContents::BlurStyle::kInner
@ kInner
Blurred inside, nothing outside.
impeller::DlDispatcher::setAntiAlias
void setAntiAlias(bool aa) override
Definition: dl_dispatcher.cc:178
impeller::DlDispatcher::setInvertColors
void setInvertColors(bool invert) override
Definition: dl_dispatcher.cc:477
impeller::DlDispatcher::drawVertices
void drawVertices(const flutter::DlVertices *vertices, flutter::DlBlendMode dl_mode) override
Definition: dl_dispatcher.cc:922
impeller::skia_conversions::ToPoint
Point ToPoint(const SkPoint &point)
Definition: skia_conversions.cc:140
impeller::Entity::TileMode
TileMode
Definition: entity.h:42
impeller::SamplerDescriptor::mip_filter
MipFilter mip_filter
Definition: sampler_descriptor.h:18
impeller::DlDispatcher::setColorSource
void setColorSource(const flutter::DlColorSource *source) override
Definition: dl_dispatcher.cc:286
impeller::ColorSource::MakeRadialGradient
static ColorSource MakeRadialGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:108
impeller::ImageFilter::MakeMatrix
static std::shared_ptr< ImageFilter > MakeMatrix(const Matrix &matrix, SamplerDescriptor sampler_descriptor)
Definition: image_filter.cc:39
dl_vertices_geometry.h
impeller::ColorFilter::MakeMatrix
static std::shared_ptr< ColorFilter > MakeMatrix(ColorMatrix color_matrix)
Definition: color_filter.cc:28
impeller::Canvas::ClipRRect
void ClipRRect(const Rect &rect, const Size &corner_radii, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:590
scalar.h
impeller::Canvas::PreConcat
void PreConcat(const Matrix &transform)
Definition: canvas.cc:235
impeller::DlDispatcher::drawTextFrame
void drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
Definition: dl_dispatcher.cc:1072
impeller::ImageFilter::MakeCompose
static std::shared_ptr< ImageFilter > MakeCompose(const ImageFilter &inner, const ImageFilter &outer)
Definition: image_filter.cc:46
impeller::BlendMode::kDestinationIn
@ kDestinationIn
impeller::DlDispatcher::skew
void skew(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:658
impeller::Join::kBevel
@ kBevel
impeller::ColorSource::Type::kImage
@ kImage
impeller::ColorSource::MakeRuntimeEffect
static ColorSource MakeRuntimeEffect(std::shared_ptr< RuntimeStage > runtime_stage, std::shared_ptr< std::vector< uint8_t >> uniform_data, std::vector< RuntimeEffectContents::TextureInput > texture_inputs)
Definition: color_source.cc:193
impeller::Canvas::DrawOval
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:461
impeller::BlendMode::kExclusion
@ kExclusion
impeller::BlendMode::kDestinationOut
@ kDestinationOut
impeller::FilterContents::BlurStyle::kOuter
@ kOuter
Nothing inside, blurred outside.
impeller::TRect::GetRight
constexpr auto GetRight() const
Definition: rect.h:322
impeller::Canvas::Rotate
void Rotate(Radians radians)
Definition: canvas.cc:276
impeller::ColorSource::Type::kConicalGradient
@ kConicalGradient
impeller::ColorFilter::MakeLinearToSrgb
static std::shared_ptr< ColorFilter > MakeLinearToSrgb()
Definition: color_filter.cc:36
impeller::DlDispatcher::setDrawStyle
void setDrawStyle(flutter::DlDrawStyle style) override
Definition: dl_dispatcher.cc:196
impeller::TPoint< Scalar >
impeller::Canvas::Transform
void Transform(const Matrix &transform)
Definition: canvas.cc:243
impeller::skia_conversions::ToRSXForms
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
Definition: skia_conversions.cc:157
impeller::Paint::invert_colors
bool invert_colors
Definition: paint.h:65
impeller::DlDispatcher::setColor
void setColor(flutter::DlColor color) override
Definition: dl_dispatcher.cc:201
impeller::MipFilter::kLinear
@ kLinear
impeller::Canvas::GetCurrentLocalCullingBounds
const std::optional< Rect > GetCurrentLocalCullingBounds() const
Definition: canvas.cc:251
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::BlendMode::kScreen
@ kScreen
impeller::SamplerDescriptor::label
std::string label
Definition: sampler_descriptor.h:24
impeller::Entity::ClipOperation
ClipOperation
Definition: entity.h:61
impeller::ToBlendMode
static BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: dl_dispatcher.cc:47
impeller::DlDispatcher::rotate
void rotate(SkScalar degrees) override
Definition: dl_dispatcher.cc:653
impeller::TRect::GetBottom
constexpr auto GetBottom() const
Definition: rect.h:324
impeller::Degrees
Definition: scalar.h:46
color_filter.h
impeller::Paint::Style
Style
Definition: paint.h:34
impeller::BlendMode::kHue
@ kHue
impeller::Canvas::ClipRect
void ClipRect(const Rect &rect, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:549
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Definition: dl_dispatcher.cc:124
impeller::TRect< Scalar >::MakeLTRB
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:129
impeller::ToColorFilter
static std::shared_ptr< ColorFilter > ToColorFilter(const flutter::DlColorFilter *filter)
Definition: dl_dispatcher.cc:445
impeller::ColorFilter::MakeSrgbToLinear
static std::shared_ptr< ColorFilter > MakeSrgbToLinear()
Definition: color_filter.cc:32
nine_patch_converter.h
impeller::BlendMode::kXor
@ kXor
impeller::Color::blue
Scalar blue
Definition: color.h:138
impeller::ColorSource::Type::kSweepGradient
@ kSweepGradient
impeller::DlDispatcher::setStrokeMiter
void setStrokeMiter(SkScalar limit) override
Definition: dl_dispatcher.cc:216
impeller::ColorMatrix
Definition: color.h:117
impeller::ContentBoundsPromise::kContainsContents
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
impeller::DlDispatcher::drawPoints
void drawPoints(PointMode mode, uint32_t count, const SkPoint points[]) override
Definition: dl_dispatcher.cc:884
impeller::DlDispatcher::drawAtlas
void drawAtlas(const sk_sp< flutter::DlImage > atlas, const SkRSXform xform[], const SkRect tex[], const flutter::DlColor colors[], int count, flutter::DlBlendMode mode, flutter::DlImageSampling sampling, const SkRect *cull_rect, bool render_with_attributes) override
Definition: dl_dispatcher.cc:987
impeller
Definition: aiks_blur_unittests.cc:20
impeller::BlendMode::kSourceATop
@ kSourceATop
impeller::Paint::mask_blur_descriptor
std::optional< MaskBlurDescriptor > mask_blur_descriptor
Definition: paint.h:69
impeller::BlendMode::kMultiply
@ kMultiply
impeller::TRect::GetTop
constexpr auto GetTop() const
Definition: rect.h:320
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:59
impeller::skia_conversions::ToPath
Path ToPath(const SkPath &path, Point shift)
Definition: skia_conversions.cc:49
impeller::ColorSource::Type::kColor
@ kColor
impeller::DlDispatcher::translate
void translate(SkScalar tx, SkScalar ty) override
Definition: dl_dispatcher.cc:643
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::PathBuilder::AddArc
PathBuilder & AddArc(const Rect &oval_bounds, Radians start, Radians sweep, bool use_center=false)
Definition: path_builder.cc:313
impeller::Vector3
Definition: vector.h:20
impeller::DlDispatcher::setStrokeCap
void setStrokeCap(flutter::DlStrokeCap cap) override
Definition: dl_dispatcher.cc:221
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::Paint::blend_mode
BlendMode blend_mode
Definition: paint.h:64
impeller::DlDispatcher::setPathEffect
void setPathEffect(const flutter::DlPathEffect *effect) override
Definition: dl_dispatcher.cc:487
impeller::DlDispatcher::drawCircle
void drawCircle(const SkPoint &center, SkScalar radius) override
Definition: dl_dispatcher.cc:812
impeller::Paint::image_filter
std::shared_ptr< ImageFilter > image_filter
Definition: paint.h:67
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:61
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:260
impeller::Canvas::ClipPath
void ClipPath(const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:539