| Flutter Impeller |

Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
impeller::DlDispatcherBase Class Referenceabstract

`#include <dl_dispatcher.h>`

Inheritance diagram for impeller::DlDispatcherBase:

## Public Member Functions
void | setAntiAlias (bool aa) override
void | setDrawStyle (flutter::DlDrawStyle style) override
void | setColor (flutter::DlColor color) override
void | setStrokeWidth (DlScalar width) override
void | setStrokeMiter (DlScalar limit) override
void | setStrokeCap (flutter::DlStrokeCap cap) override
void | setStrokeJoin (flutter::DlStrokeJoin join) override
void | setColorSource (const flutter::DlColorSource *source) override
void | setColorFilter (const flutter::DlColorFilter *filter) override
void | setInvertColors (bool invert) override
void | setBlendMode (flutter::DlBlendMode mode) override
void | setMaskFilter (const flutter::DlMaskFilter *filter) override
void | setImageFilter (const flutter::DlImageFilter *filter) override
void | save (uint32_t total_content_depth) override
void | saveLayer (const DlRect &bounds, const flutter::SaveLayerOptions &options, uint32_t total_content_depth, flutter::DlBlendMode max_content_mode, const flutter::DlImageFilter *backdrop, std::optional< int64_t > backdrop_id) override
void | restore () override
void | translate (DlScalar tx, DlScalar ty) override
void | scale (DlScalar sx, DlScalar sy) override
void | rotate (DlScalar degrees) override
void | skew (DlScalar sx, DlScalar sy) override
void | transform2DAffine (DlScalar mxx, DlScalar mxy, DlScalar mxt, DlScalar myx, DlScalar myy, DlScalar myt) override
void | transformFullPerspective (DlScalar mxx, DlScalar mxy, DlScalar mxz, DlScalar mxt, DlScalar myx, DlScalar myy, DlScalar myz, DlScalar myt, DlScalar mzx, DlScalar mzy, DlScalar mzz, DlScalar mzt, DlScalar mwx, DlScalar mwy, DlScalar mwz, DlScalar mwt) override
void | transformReset () override
void | clipRect (const DlRect &rect, flutter::DlClipOp clip_op, bool is_aa) override
void | clipOval (const DlRect &bounds, flutter::DlClipOp clip_op, bool is_aa) override
void | clipRoundRect (const DlRoundRect &rrect, flutter::DlClipOp clip_op, bool is_aa) override
void | clipRoundSuperellipse (const DlRoundSuperellipse &rse, flutter::DlClipOp clip_op, bool is_aa) override
void | clipPath (const DlPath &path, flutter::DlClipOp clip_op, bool is_aa) override
void | drawColor (flutter::DlColor color, flutter::DlBlendMode mode) override
void | drawPaint () override
void | drawLine (const DlPoint &p0, const DlPoint &p1) override
void | drawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length) override
void | drawRect (const DlRect &rect) override
void | drawOval (const DlRect &bounds) override
void | drawCircle (const DlPoint &center, DlScalar radius) override
void | drawRoundRect (const DlRoundRect &rrect) override
void | drawDiffRoundRect (const DlRoundRect &outer, const DlRoundRect &inner) override
void | drawRoundSuperellipse (const DlRoundSuperellipse &rse) override
void | drawPath (const DlPath &path) override
void | drawArc (const DlRect &oval_bounds, DlScalar start_degrees, DlScalar sweep_degrees, bool use_center) override
void | drawPoints (flutter::DlPointMode mode, uint32_t count, const DlPoint points[]) override
void | drawVertices (const std::shared_ptr< flutter::DlVertices > &vertices, flutter::DlBlendMode dl_mode) override
void | drawImage (const sk_sp< flutter::DlImage > image, const DlPoint &point, flutter::DlImageSampling sampling, bool render_with_attributes) override
void | drawImageRect (const sk_sp< flutter::DlImage > image, const DlRect &src, const DlRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, flutter::DlSrcRectConstraint constraint) override
void | drawImageNine (const sk_sp< flutter::DlImage > image, const DlIRect &center, const DlRect &dst, flutter::DlFilterMode filter, bool render_with_attributes) override
void | drawAtlas (const sk_sp< flutter::DlImage > atlas, const RSTransform xform[], const DlRect tex[], const flutter::DlColor colors[], int count, flutter::DlBlendMode mode, flutter::DlImageSampling sampling, const DlRect *cull_rect, bool render_with_attributes) override
void | drawDisplayList (const sk_sp< flutter::DisplayList > display_list, DlScalar opacity) override
void | drawTextBlob (const sk_sp< SkTextBlob > blob, DlScalar x, DlScalar y) override
void | drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, DlScalar x, DlScalar y) override
void | drawShadow (const DlPath &path, const flutter::DlColor color, const DlScalar elevation, bool transparent_occluder, DlScalar dpr) override
virtual Canvas & | GetCanvas ()=0

## Static Protected Member Functions
static void | SimplifyOrDrawPath (Canvas &canvas, const DlPath &cache, const Paint &paint)

## Protected Attributes
Paint | paint_
Matrix | initial_matrix_

## Detailed Description

Definition at line 31 of file dl_dispatcher.h.

## Member Function Documentation

## ◆ clipOval()

void impeller::DlDispatcherBase::clipOval | ( | const DlRect & | bounds,
|  | flutter::DlClipOp | clip_op,
|  | bool | is_aa
| ) |  |
| override

Definition at line 449 of file dl_dispatcher.cc.

451 {
452 AUTO_DEPTH_WATCHER(0u);
453
454 EllipseGeometry geom(bounds);
455 GetCanvas().ClipGeometry(geom, ToClipOperation(clip_op));
456 }
impeller::Canvas::ClipGeometry
void ClipGeometry(const Geometry &geometry, Entity::ClipOperation clip_op, bool is_aa=true)
Definition: canvas.cc:686
impeller::DlDispatcherBase::GetCanvas
virtual Canvas & GetCanvas()=0
AUTO_DEPTH_WATCHER
#define AUTO_DEPTH_WATCHER(d)
Definition: dl_dispatcher.cc:115
impeller::ToClipOperation
static Entity::ClipOperation ToClipOperation(flutter::DlClipOp clip_op)
Definition: dl_dispatcher.cc:429

References AUTO_DEPTH_WATCHER, impeller::Canvas::ClipGeometry(), GetCanvas(), and impeller::ToClipOperation().

## ◆ clipPath()

void impeller::DlDispatcherBase::clipPath | ( | const DlPath & | path,
|  | flutter::DlClipOp | clip_op,
|  | bool | is_aa
| ) |  |
| override

Definition at line 500 of file dl_dispatcher.cc.

502 {
503 AUTO_DEPTH_WATCHER(0u);
504
505 auto clip_op = ToClipOperation(sk_op);
506
507 DlRect rect;
508 if (path.IsRect(&rect)) {
509 RectGeometry geom(rect);
510 GetCanvas().ClipGeometry(geom, clip_op, /*is_aa=*/is_aa);
511 } else if (path.IsOval(&rect)) {
512 EllipseGeometry geom(rect);
513 GetCanvas().ClipGeometry(geom, clip_op);
514 } else {
515 SkRRect rrect;
516 if (path.IsSkRRect(&rrect) && rrect.isSimple()) {
517 RoundRectGeometry geom(flutter::ToDlRect(rrect.rect()),
518 flutter::ToDlSize(rrect.getSimpleRadii()));
519 GetCanvas().ClipGeometry(geom, clip_op);
520 } else {
521 FillPathGeometry geom(path.GetPath());
522 GetCanvas().ClipGeometry(geom, clip_op);
523 }
524 }
525 }
impeller::DlRect
flutter::DlRect DlRect
Definition: dl_dispatcher.h:25

References AUTO_DEPTH_WATCHER, impeller::Canvas::ClipGeometry(), GetCanvas(), and impeller::ToClipOperation().

## ◆ clipRect()

void impeller::DlDispatcherBase::clipRect | ( | const DlRect & | rect,
|  | flutter::DlClipOp | clip_op,
|  | bool | is_aa
| ) |  |
| override

Definition at line 439 of file dl_dispatcher.cc.

441 {
442 AUTO_DEPTH_WATCHER(0u);
443
444 RectGeometry geom(rect);
445 GetCanvas().ClipGeometry(geom, ToClipOperation(clip_op), /*is_aa=*/is_aa);
446 }

References AUTO_DEPTH_WATCHER, impeller::Canvas::ClipGeometry(), GetCanvas(), and impeller::ToClipOperation().

## ◆ clipRoundRect()

void impeller::DlDispatcherBase::clipRoundRect | ( | const DlRoundRect & | rrect,
|  | flutter::DlClipOp | clip_op,
|  | bool | is_aa
| ) |  |
| override

Definition at line 459 of file dl_dispatcher.cc.

461 {
462 AUTO_DEPTH_WATCHER(0u);
463
464 auto clip_op = ToClipOperation(sk_op);
465 if (rrect.IsRect()) {
466 RectGeometry geom(rrect.GetBounds());
467 GetCanvas().ClipGeometry(geom, clip_op, /*is_aa=*/is_aa);
468 } else if (rrect.IsOval()) {
469 EllipseGeometry geom(rrect.GetBounds());
470 GetCanvas().ClipGeometry(geom, clip_op);
471 } else if (rrect.GetRadii().AreAllCornersSame()) {
472 RoundRectGeometry geom(rrect.GetBounds(), rrect.GetRadii().top_left);
473 GetCanvas().ClipGeometry(geom, clip_op);
474 } else {
475 FillPathGeometry geom(PathBuilder{}.AddRoundRect(rrect).TakePath());
476 GetCanvas().ClipGeometry(geom, clip_op);
477 }
478 }

References impeller::PathBuilder::AddRoundRect(), AUTO_DEPTH_WATCHER, impeller::Canvas::ClipGeometry(), GetCanvas(), and impeller::ToClipOperation().

## ◆ clipRoundSuperellipse()

void impeller::DlDispatcherBase::clipRoundSuperellipse | ( | const DlRoundSuperellipse & | rse,
|  | flutter::DlClipOp | clip_op,
|  | bool | is_aa
| ) |  |
| override

Definition at line 481 of file dl_dispatcher.cc.

483 {
484 AUTO_DEPTH_WATCHER(0u);
485
486 auto clip_op = ToClipOperation(sk_op);
487 if (rse.IsRect()) {
488 RectGeometry geom(rse.GetBounds());
489 GetCanvas().ClipGeometry(geom, clip_op, /*is_aa=*/is_aa);
490 } else if (rse.IsOval()) {
491 EllipseGeometry geom(rse.GetBounds());
492 GetCanvas().ClipGeometry(geom, clip_op);
493 } else {
494 RoundSuperellipseGeometry geom(rse.GetBounds(), rse.GetRadii());
495 GetCanvas().ClipGeometry(geom, clip_op);
496 }
497 }

References AUTO_DEPTH_WATCHER, impeller::Canvas::ClipGeometry(), GetCanvas(), and impeller::ToClipOperation().

## ◆ drawArc()

void impeller::DlDispatcherBase::drawArc | ( | const DlRect & | oval_bounds,
|  | DlScalar | start_degrees,
|  | DlScalar | sweep_degrees,
|  | bool | use_center
| ) |  |
| override

Definition at line 682 of file dl_dispatcher.cc.

685 {
686 AUTO_DEPTH_WATCHER(1u);
687
688 if (paint_.stroke_width >
689 std::max(oval_bounds.GetWidth(), oval_bounds.GetHeight())) {
690 // This is a special case for rendering arcs whose stroke width is so large
691 // you are effectively drawing a sector of a circle.
692 // https://github.com/flutter/flutter/issues/158567
693 DlRect expanded_rect = oval_bounds.Expand(Size(paint_.stroke_width / 2));
694 PathBuilder builder;
695 Paint fill_paint = paint_;
696 fill_paint.style = Paint::Style::kFill;
697 fill_paint.stroke_width = 1;
698 builder.AddArc(expanded_rect, Degrees(start_degrees),
699 Degrees(sweep_degrees),
700 /*use_center=*/true);
701 GetCanvas().DrawPath(builder.TakePath(), fill_paint);
702 } else {
703 PathBuilder builder;
704 builder.AddArc(oval_bounds, Degrees(start_degrees), Degrees(sweep_degrees),
705 use_center);
706 GetCanvas().DrawPath(builder.TakePath(), paint_);
707 }
708 }
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:309
impeller::DlDispatcherBase::paint_
Paint paint_
Definition: dl_dispatcher.h:260
impeller::Size
TSize< Scalar > Size
Definition: size.h:159
impeller::Paint::Style::kFill
@ kFill
impeller::Paint::style
Style style
Definition: paint.h:83
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:79

References impeller::PathBuilder::AddArc(), AUTO_DEPTH_WATCHER, impeller::Canvas::DrawPath(), GetCanvas(), impeller::Paint::kFill, paint_, impeller::Paint::stroke_width, impeller::Paint::style, and impeller::PathBuilder::TakePath().

## ◆ drawAtlas()

void impeller::DlDispatcherBase::drawAtlas | ( | const sk_sp< flutter::DlImage > | atlas,
|  | const RSTransform | xform[],
|  | const DlRect | tex[],
|  | const flutter::DlColor | colors[],
|  | int | count,
|  | flutter::DlBlendMode | mode,
|  | flutter::DlImageSampling | sampling,
|  | const DlRect * | cull_rect,
|  | bool | render_with_attributes
| ) |  |
| override

Definition at line 819 of file dl_dispatcher.cc.

827 {
828 AUTO_DEPTH_WATCHER(1u);
829
830 auto geometry =
831 DlAtlasGeometry(atlas->impeller_texture(), //
832 xform, //
833 tex, //
834 colors, //
835 static_cast<size_t>(count), //
836 mode, //
837 skia_conversions::ToSamplerDescriptor(sampling), //
838 ToOptRect(cull_rect) //
839 );
840 auto atlas_contents = std::make_shared<AtlasContents>();
841 atlas_contents->SetGeometry(&geometry);
842
843 GetCanvas().DrawAtlas(atlas_contents, paint_);
844 }
impeller::Canvas::DrawAtlas
void DrawAtlas(const std::shared_ptr< AtlasContents > &atlas_contents, const Paint &paint)
Definition: canvas.cc:977
impeller::skia_conversions::ToSamplerDescriptor
impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Definition: skia_conversions.cc:24
impeller::ToOptRect
static std::optional< const Rect > ToOptRect(const flutter::DlRect *rect)
Definition: dl_dispatcher.cc:141

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawAtlas(), GetCanvas(), paint_, impeller::ToOptRect(), and impeller::skia_conversions::ToSamplerDescriptor().

## ◆ drawCircle()

void impeller::DlDispatcherBase::drawCircle | ( | const DlPoint & | center,
|  | DlScalar | radius
| ) |  |
| override

Definition at line 609 of file dl_dispatcher.cc.

609 {
610 AUTO_DEPTH_WATCHER(1u);
611
612 GetCanvas().DrawCircle(center, radius, paint_);
613 }
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:663

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawCircle(), GetCanvas(), and paint_.

## ◆ drawColor()

void impeller::DlDispatcherBase::drawColor | ( | flutter::DlColor | color,
|  | flutter::DlBlendMode | mode
| ) |  |
| override

Definition at line 528 of file dl_dispatcher.cc.

529 {
530 AUTO_DEPTH_WATCHER(1u);
531
532 Paint paint;
533 paint.color = skia_conversions::ToColor(color);
534 paint.blend_mode = dl_mode;
535 GetCanvas().DrawPaint(paint);
536 }
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:324
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:13

References AUTO_DEPTH_WATCHER, impeller::Paint::blend_mode, impeller::Paint::color, impeller::Canvas::DrawPaint(), GetCanvas(), and impeller::skia_conversions::ToColor().

## ◆ drawDashedLine()

void impeller::DlDispatcherBase::drawDashedLine | ( | const DlPoint & | p0,
|  | const DlPoint & | p1,
|  | DlScalar | on_length,
|  | DlScalar | off_length
| ) |  |
| override

Definition at line 552 of file dl_dispatcher.cc.

555 {
556 AUTO_DEPTH_WATCHER(1u);
557
558 Scalar length = p0.GetDistance(p1);
559 // Reasons to defer to regular DrawLine:
560 // length is non-positive - drawLine will draw appropriate "dot"
561 // off_length is non-positive - no gaps, drawLine will draw it solid
562 // on_length is negative - invalid dashing
563 // Note that a 0 length "on" dash will draw "dot"s every "off" distance
564 // apart
565 if (length > 0.0f && on_length >= 0.0f && off_length > 0.0f) {
566 Point delta = (p1 - p0) / length; // length > 0 already tested
567 PathBuilder builder;
568
569 Scalar consumed = 0.0f;
570 while (consumed < length) {
571 builder.MoveTo(p0 + delta * consumed);
572
573 Scalar dash_end = consumed + on_length;
574 if (dash_end < length) {
575 builder.LineTo(p0 + delta * dash_end);
576 } else {
577 builder.LineTo(p1);
578 // Should happen anyway due to the math, but let's make it explicit
579 // in case of bit errors. We're done with this line.
580 break;
581 }
582
583 consumed = dash_end + off_length;
584 }
585
586 Paint stroke_paint = paint_;
587 stroke_paint.style = Paint::Style::kStroke;
588 GetCanvas().DrawPath(builder.TakePath(), stroke_paint);
589 } else {
590 drawLine(p0, p1);
591 }
592 }
impeller::DlDispatcherBase::drawLine
void drawLine(const DlPoint &p0, const DlPoint &p1) override
Definition: dl_dispatcher.cc:546
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Point
TPoint< Scalar > Point
Definition: point.h:327
impeller::Paint::Style::kStroke
@ kStroke

References AUTO_DEPTH_WATCHER, drawLine(), impeller::Canvas::DrawPath(), GetCanvas(), impeller::Paint::kStroke, impeller::PathBuilder::LineTo(), impeller::PathBuilder::MoveTo(), paint_, impeller::Paint::style, and impeller::PathBuilder::TakePath().

## ◆ drawDiffRoundRect()

void impeller::DlDispatcherBase::drawDiffRoundRect | ( | const DlRoundRect & | outer,
|  | const DlRoundRect & | inner
| ) |  |
| override

Definition at line 623 of file dl_dispatcher.cc.

624 {
625 AUTO_DEPTH_WATCHER(1u);
626
627 PathBuilder builder;
628 builder.AddRoundRect(outer);
629 builder.AddRoundRect(inner);
630 builder.SetBounds(outer.GetBounds().Union(inner.GetBounds()));
631 GetCanvas().DrawPath(builder.TakePath(FillType::kOdd), paint_);
632 }
impeller::FillType::kOdd
@ kOdd

References impeller::PathBuilder::AddRoundRect(), AUTO_DEPTH_WATCHER, impeller::Canvas::DrawPath(), GetCanvas(), impeller::kOdd, paint_, impeller::PathBuilder::SetBounds(), and impeller::PathBuilder::TakePath().

## ◆ drawDisplayList()

void impeller::DlDispatcherBase::drawDisplayList | ( | const sk_sp< flutter::DisplayList > | display_list,
|  | DlScalar | opacity
| ) |  |
| override

Definition at line 847 of file dl_dispatcher.cc.

849 {
850 AUTO_DEPTH_WATCHER(display_list->total_depth());
851
852 // Save all values that must remain untouched after the operation.
853 Paint saved_paint = paint_;
854 Matrix saved_initial_matrix = initial_matrix_;
855
856 // Establish a new baseline for interpreting the new DL.
857 // Matrix and clip are left untouched, the current
858 // transform is saved as the new base matrix, and paint
859 // values are reset to defaults.
860 initial_matrix_ = GetCanvas().GetCurrentTransform();
861 paint_ = Paint();
862
863 // Handle passed opacity in the most brute-force way by using
864 // a SaveLayer. If the display_list is able to inherit the
865 // opacity, this could also be handled by modulating all of its
866 // attribute settings (for example, color), by the indicated
867 // opacity.
868 int restore_count = GetCanvas().GetSaveCount();
869 if (opacity < SK_Scalar1) {
870 Paint save_paint;
871 save_paint.color = Color(0, 0, 0, opacity);
872 GetCanvas().SaveLayer(save_paint, display_list->GetBounds(), nullptr,
873 ContentBoundsPromise::kContainsContents,
874 display_list->total_depth(),
875 display_list->can_apply_group_opacity());
876 } else {
877 // The display list may alter the clip, which must be restored to the
878 // current clip at the end of playback.
879 GetCanvas().Save(display_list->total_depth());
880 }
881
882 // TODO(131445): Remove this restriction if we can correctly cull with
883 // perspective transforms.
884 if (display_list->has_rtree() && !initial_matrix_.HasPerspective()) {
885 // The canvas remembers the screen-space culling bounds clipped by
886 // the surface and the history of clip calls. DisplayList can cull
887 // the ops based on a rectangle expressed in its "destination bounds"
888 // so we need the canvas to transform those into the current local
889 // coordinate space into which the DisplayList will be rendered.
890 auto global_culling_bounds = GetCanvas().GetLocalCoverageLimit();
891 if (global_culling_bounds.has_value()) {
892 Rect cull_rect = global_culling_bounds->TransformBounds(
893 GetCanvas().GetCurrentTransform().Invert());
894 display_list->Dispatch(
895 *this, SkRect::MakeLTRB(cull_rect.GetLeft(), cull_rect.GetTop(),
896 cull_rect.GetRight(), cull_rect.GetBottom()));
897 } else {
898 // If the culling bounds are empty, this display list can be skipped
899 // entirely.
900 }
901 } else {
902 display_list->Dispatch(*this);
903 }
904
905 // Restore all saved state back to what it was before we interpreted
906 // the display_list
907 AUTO_DEPTH_CHECK();
908 GetCanvas().RestoreToCount(restore_count);
909 initial_matrix_ = saved_initial_matrix;
910 paint_ = saved_paint;
911 }
impeller::Canvas::GetLocalCoverageLimit
std::optional< Rect > GetLocalCoverageLimit() const
Return the culling bounds of the current render target, or nullopt if there is no coverage.
Definition: canvas.cc:1060
impeller::Canvas::SaveLayer
void SaveLayer(const Paint &paint, std::optional< Rect > bounds=std::nullopt, const flutter::DlImageFilter *backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown, uint32_t total_content_depth=kMaxDepth, bool can_distribute_opacity=false, std::optional< int64_t > backdrop_id=std::nullopt)
Definition: canvas.cc:1091
impeller::Canvas::GetCurrentTransform
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:254
impeller::Canvas::RestoreToCount
void RestoreToCount(size_t count)
Definition: canvas.cc:301
impeller::Canvas::GetSaveCount
size_t GetSaveCount() const
Definition: canvas.cc:293
impeller::Canvas::Save
void Save(uint32_t total_content_depth=kMaxDepth)
Definition: canvas.cc:1043
impeller::DlDispatcherBase::initial_matrix_
Matrix initial_matrix_
Definition: dl_dispatcher.h:261
AUTO_DEPTH_CHECK
#define AUTO_DEPTH_CHECK()
Definition: dl_dispatcher.cc:116
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:792
impeller::ContentBoundsPromise::kContainsContents
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
impeller::Matrix::HasPerspective
constexpr bool HasPerspective() const
Definition: matrix.h:365
impeller::TRect::TransformBounds
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
Definition: rect.h:476

References AUTO_DEPTH_CHECK, AUTO_DEPTH_WATCHER, impeller::Paint::color, impeller::TRect< T >::GetBottom(), GetCanvas(), impeller::Canvas::GetCurrentTransform(), impeller::TRect< T >::GetLeft(), impeller::Canvas::GetLocalCoverageLimit(), impeller::TRect< T >::GetRight(), impeller::Canvas::GetSaveCount(), impeller::TRect< T >::GetTop(), impeller::Matrix::HasPerspective(), initial_matrix_, impeller::kContainsContents, paint_, impeller::Canvas::RestoreToCount(), impeller::Canvas::Save(), impeller::Canvas::SaveLayer(), and impeller::TRect< T >::TransformBounds().

## ◆ drawImage()

void impeller::DlDispatcherBase::drawImage | ( | const sk_sp< flutter::DlImage > | image,
|  | const DlPoint & | point,
|  | flutter::DlImageSampling | sampling,
|  | bool | render_with_attributes
| ) |  |
| override

Definition at line 755 of file dl_dispatcher.cc.

758 {
759 AUTO_DEPTH_WATCHER(1u);
760
761 if (!image) {
762 return;
763 }
764
765 auto texture = image->impeller_texture();
766 if (!texture) {
767 return;
768 }
769
770 const auto size = texture->GetSize();
771 const auto src = DlRect::MakeWH(size.width, size.height);
772 const auto dest = DlRect::MakeXYWH(point.x, point.y, size.width, size.height);
773
774 drawImageRect(image, // image
775 src, // source rect
776 dest, // destination rect
777 sampling, // sampling options
778 render_with_attributes, // render with attributes
779 flutter::DlSrcRectConstraint::kStrict // constraint
780 );
781 }
impeller::DlDispatcherBase::drawImageRect
void drawImageRect(const sk_sp< flutter::DlImage > image, const DlRect &src, const DlRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, flutter::DlSrcRectConstraint constraint) override
Definition: dl_dispatcher.cc:784

References AUTO_DEPTH_WATCHER, and drawImageRect().

## ◆ drawImageNine()

void impeller::DlDispatcherBase::drawImageNine | ( | const sk_sp< flutter::DlImage > | image,
|  | const DlIRect & | center,
|  | const DlRect & | dst,
|  | flutter::DlFilterMode | filter,
|  | bool | render_with_attributes
| ) |  |
| override

Definition at line 803 of file dl_dispatcher.cc.

807 {
808 AUTO_DEPTH_WATCHER(9u);
809
810 NinePatchConverter converter = {};
811 converter.DrawNinePatch(image->impeller_texture(),
812 Rect::MakeLTRB(center.GetLeft(), center.GetTop(),
813 center.GetRight(), center.GetBottom()),
814 dst, ToSamplerDescriptor(filter), &GetCanvas(),
815 &paint_);
816 }
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlFilterMode options)
Definition: dl_dispatcher.cc:123
impeller::TRect< Scalar >::MakeLTRB
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:129

References AUTO_DEPTH_WATCHER, impeller::NinePatchConverter::DrawNinePatch(), GetCanvas(), impeller::TRect< Scalar >::MakeLTRB(), paint_, and impeller::ToSamplerDescriptor().

## ◆ drawImageRect()

void impeller::DlDispatcherBase::drawImageRect | ( | const sk_sp< flutter::DlImage > | image,
|  | const DlRect & | src,
|  | const DlRect & | dst,
|  | flutter::DlImageSampling | sampling,
|  | bool | render_with_attributes,
|  | flutter::DlSrcRectConstraint | constraint = `flutter::DlSrcRectConstraint::kFast`
| ) |  |
| override

Definition at line 784 of file dl_dispatcher.cc.

790 {
791 AUTO_DEPTH_WATCHER(1u);
792
793 GetCanvas().DrawImageRect(
794 image->impeller_texture(), // image
795 src, // source rect
796 dst, // destination rect
797 render_with_attributes ? paint_ : Paint(), // paint
798 skia_conversions::ToSamplerDescriptor(sampling) // sampling
799 );
800 }
impeller::Canvas::DrawImageRect
void DrawImageRect(const std::shared_ptr< Texture > &image, Rect source, Rect dest, const Paint &paint, const SamplerDescriptor &sampler={}, SourceRectConstraint src_rect_constraint=SourceRectConstraint::kFast)
Definition: canvas.cc:799

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawImageRect(), GetCanvas(), paint_, and impeller::skia_conversions::ToSamplerDescriptor().

Referenced by drawImage().

## ◆ drawLine()

void impeller::DlDispatcherBase::drawLine | ( | const DlPoint & | p0,
|  | const DlPoint & | p1
| ) |  |
| override

Definition at line 546 of file dl_dispatcher.cc.

546 {
547 AUTO_DEPTH_WATCHER(1u);
548
549 GetCanvas().DrawLine(p0, p1, paint_);
550 }
impeller::Canvas::DrawLine
void DrawLine(const Point &p0, const Point &p1, const Paint &paint, bool reuse_depth=false)
Definition: canvas.cc:542

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawLine(), GetCanvas(), and paint_.

Referenced by drawDashedLine().

## ◆ drawOval()

void impeller::DlDispatcherBase::drawOval | ( | const DlRect & | bounds | ) |
| override

Definition at line 602 of file dl_dispatcher.cc.

602 {
603 AUTO_DEPTH_WATCHER(1u);
604
605 GetCanvas().DrawOval(bounds, paint_);
606 }
impeller::Canvas::DrawOval
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:583

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawOval(), GetCanvas(), and paint_.

## ◆ drawPaint()

void impeller::DlDispatcherBase::drawPaint | ( |  | ) |
| override

Definition at line 539 of file dl_dispatcher.cc.

539 {
540 AUTO_DEPTH_WATCHER(1u);
541
542 GetCanvas().DrawPaint(paint_);
543 }

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawPaint(), GetCanvas(), and paint_.

## ◆ drawPath()

void impeller::DlDispatcherBase::drawPath | ( | const DlPath & | path | ) |
| override

Definition at line 642 of file dl_dispatcher.cc.

642 {
643 AUTO_DEPTH_WATCHER(1u);
644
645 SimplifyOrDrawPath(GetCanvas(), path, paint_);
646 }
impeller::DlDispatcherBase::SimplifyOrDrawPath
static void SimplifyOrDrawPath(Canvas &canvas, const DlPath &cache, const Paint &paint)
Definition: dl_dispatcher.cc:648

References AUTO_DEPTH_WATCHER, GetCanvas(), paint_, and SimplifyOrDrawPath().

## ◆ drawPoints()

void impeller::DlDispatcherBase::drawPoints | ( | flutter::DlPointMode | mode,
|  | uint32_t | count,
|  | const DlPoint | points[]
| ) |  |
| override

Definition at line 711 of file dl_dispatcher.cc.

713 {
714 AUTO_DEPTH_WATCHER(1u);
715
716 Paint paint = paint_;
717 paint.style = Paint::Style::kStroke;
718 switch (mode) {
719 case flutter::DlPointMode::kPoints: {
720 // Cap::kButt is also treated as a square.
721 PointStyle point_style = paint.stroke_cap == Cap::kRound
722 ? PointStyle::kRound
723 : PointStyle::kSquare;
724 Scalar radius = paint.stroke_width;
725 if (radius > 0) {
726 radius /= 2.0;
727 }
728 GetCanvas().DrawPoints(points, count, radius, paint, point_style);
729 } break;
730 case flutter::DlPointMode::kLines:
731 for (uint32_t i = 1; i < count; i += 2) {
732 Point p0 = points[i - 1];
733 Point p1 = points[i];
734 GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
735 }
736 break;
737 case flutter::DlPointMode::kPolygon:
738 if (count > 1) {
739 Point p0 = points[0];
740 for (uint32_t i = 1; i < count; i++) {
741 Point p1 = points[i];
742 GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
743 p0 = p1;
744 }
745 }
746 break;
747 }
748 }
impeller::Canvas::DrawPoints
void DrawPoints(const Point points[], uint32_t count, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:767
impeller::PointStyle
PointStyle
Definition: canvas.h:61
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::Cap::kRound
@ kRound

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawLine(), impeller::Canvas::DrawPoints(), GetCanvas(), impeller::kRound, impeller::kSquare, impeller::Paint::kStroke, paint_, impeller::Paint::stroke_cap, impeller::Paint::stroke_width, and impeller::Paint::style.

## ◆ drawRect()

void impeller::DlDispatcherBase::drawRect | ( | const DlRect & | rect | ) |
| override

Definition at line 595 of file dl_dispatcher.cc.

595 {
596 AUTO_DEPTH_WATCHER(1u);
597
598 GetCanvas().DrawRect(rect, paint_);
599 }
impeller::Canvas::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: canvas.cc:565

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawRect(), GetCanvas(), and paint_.

## ◆ drawRoundRect()

void impeller::DlDispatcherBase::drawRoundRect | ( | const DlRoundRect & | rrect | ) |
| override

Definition at line 616 of file dl_dispatcher.cc.

616 {
617 AUTO_DEPTH_WATCHER(1u);
618
619 GetCanvas().DrawRoundRect(rrect, paint_);
620 }
impeller::Canvas::DrawRoundRect
void DrawRoundRect(const RoundRect &rect, const Paint &paint)
Definition: canvas.cc:613

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawRoundRect(), GetCanvas(), and paint_.

## ◆ drawRoundSuperellipse()

void impeller::DlDispatcherBase::drawRoundSuperellipse | ( | const DlRoundSuperellipse & | rse | ) |
| override

Definition at line 635 of file dl_dispatcher.cc.

635 {
636 AUTO_DEPTH_WATCHER(1u);
637
638 GetCanvas().DrawRoundSuperellipse(rse, paint_);
639 }
impeller::Canvas::DrawRoundSuperellipse
void DrawRoundSuperellipse(const RoundSuperellipse &rse, const Paint &paint)
Definition: canvas.cc:640

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawRoundSuperellipse(), GetCanvas(), and paint_.

## ◆ drawShadow()

void impeller::DlDispatcherBase::drawShadow | ( | const DlPath & | path,
|  | const flutter::DlColor | color,
|  | const DlScalar | elevation,
|  | bool | transparent_occluder,
|  | DlScalar | dpr
| ) |  |
| override

Definition at line 936 of file dl_dispatcher.cc.

940 {
941 AUTO_DEPTH_WATCHER(1u);
942
943 Color spot_color = skia_conversions::ToColor(color);
944 spot_color.alpha *= 0.25;
945
946 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
947 {
948 Scalar max =
949 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
950 Scalar min =
951 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
952 Scalar luminance = (min + max) * 0.5;
953
954 Scalar alpha_adjust =
955 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
956 spot_color.alpha;
957 Scalar color_alpha =
958 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
959 luminance;
960 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
961
962 Scalar greyscale_alpha =
963 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
964
965 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
966 Scalar tonal_alpha = color_scale + greyscale_alpha;
967 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
968 spot_color = Color(unpremul_scale * spot_color.red,
969 unpremul_scale * spot_color.green,
970 unpremul_scale * spot_color.blue, tonal_alpha);
971 }
972
973 Vector3 light_position(0, -1, 1);
974 Scalar occluder_z = dpr * elevation;
975
976 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
977
978 Paint paint;
979 paint.style = Paint::Style::kFill;
980 paint.color = spot_color;
981 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
982 .style = FilterContents::BlurStyle::kNormal,
983 .sigma = Radius{kLightRadius * occluder_z /
984 GetCanvas().GetCurrentTransform().GetScale().y},
985 };
986
987 GetCanvas().Save(1u);
988 GetCanvas().PreConcat(
989 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
990
991 SimplifyOrDrawPath(GetCanvas(), path, paint);
992 AUTO_DEPTH_CHECK();
993
994 GetCanvas().Restore();
995 }
impeller::Canvas::Restore
bool Restore()
Definition: canvas.cc:1329
impeller::Canvas::PreConcat
void PreConcat(const Matrix &transform)
Definition: canvas.cc:242
impeller::FilterContents::BlurStyle::kNormal
@ kNormal
Blurred inside and outside.
impeller::Vector2
Point Vector2
Definition: point.h:331
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
impeller::Matrix::GetScale
constexpr Vector3 GetScale() const
Definition: matrix.h:341
impeller::Vector3::y
Scalar y
Definition: vector.h:24

References impeller::Color::alpha, AUTO_DEPTH_CHECK, AUTO_DEPTH_WATCHER, impeller::Color::blue, impeller::Paint::color, GetCanvas(), impeller::Canvas::GetCurrentTransform(), impeller::Matrix::GetScale(), impeller::Color::green, impeller::Paint::kFill, impeller::FilterContents::kNormal, impeller::Matrix::MakeTranslation(), impeller::Paint::mask_blur_descriptor, impeller::Canvas::PreConcat(), impeller::Color::red, impeller::Canvas::Restore(), impeller::Canvas::Save(), SimplifyOrDrawPath(), impeller::Paint::MaskBlurDescriptor::style, impeller::Paint::style, impeller::skia_conversions::ToColor(), and impeller::Vector3::y.

## ◆ drawTextBlob()

void impeller::DlDispatcherBase::drawTextBlob | ( | const sk_sp< SkTextBlob > | blob,
|  | DlScalar | x,
|  | DlScalar | y
| ) |  |
| override

Definition at line 914 of file dl_dispatcher.cc.

916 {
917 // When running with Impeller enabled Skia text blobs are converted to
918 // Impeller text frames in paragraph_skia.cc
919 UNIMPLEMENTED;
920 }
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:120

References UNIMPLEMENTED.

## ◆ drawTextFrame()

void impeller::DlDispatcherBase::drawTextFrame | ( | const std::shared_ptr< impeller::TextFrame > & | text_frame,
|  | DlScalar | x,
|  | DlScalar | y
| ) |  |
| override

Definition at line 923 of file dl_dispatcher.cc.

926 {
927 AUTO_DEPTH_WATCHER(1u);
928
929 GetCanvas().DrawTextFrame(text_frame, //
930 impeller::Point{x, y}, //
931 paint_ //
932 );
933 }
impeller::Canvas::DrawTextFrame
void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:1520
x
int32_t x
Definition: dl_golden_unittests.cc:458
impeller::TPoint< Scalar >

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawTextFrame(), GetCanvas(), paint_, and x.

## ◆ drawVertices()

void impeller::DlDispatcherBase::drawVertices | ( | const std::shared_ptr< flutter::DlVertices > & | vertices,
|  | flutter::DlBlendMode | dl_mode
| ) |  |
| override

Definition at line 750 of file dl_dispatcher.cc.

752 {}

## ◆ GetCanvas()

virtual Canvas& impeller::DlDispatcherBase::GetCanvas | ( |  | ) |
| pure virtual

Referenced by clipOval(), clipPath(), clipRect(), clipRoundRect(), clipRoundSuperellipse(), drawArc(), drawAtlas(), drawCircle(), drawColor(), drawDashedLine(), drawDiffRoundRect(), drawDisplayList(), drawImageNine(), drawImageRect(), drawLine(), drawOval(), drawPaint(), drawPath(), drawPoints(), drawRect(), drawRoundRect(), drawRoundSuperellipse(), drawShadow(), drawTextFrame(), restore(), rotate(), save(), saveLayer(), scale(), skew(), transformFullPerspective(), transformReset(), and translate().

## ◆ restore()

void impeller::DlDispatcherBase::restore | ( |  | ) |
| override

Definition at line 338 of file dl_dispatcher.cc.

338 {
339 GetCanvas().Restore();
340 }

References GetCanvas(), and impeller::Canvas::Restore().

## ◆ rotate()

void impeller::DlDispatcherBase::rotate | ( | DlScalar | degrees | ) |
| override

Definition at line 357 of file dl_dispatcher.cc.

357 {
358 AUTO_DEPTH_WATCHER(0u);
359
360 GetCanvas().Rotate(Degrees{degrees});
361 }
impeller::Canvas::Rotate
void Rotate(Radians radians)
Definition: canvas.cc:274

References AUTO_DEPTH_WATCHER, GetCanvas(), and impeller::Canvas::Rotate().

## ◆ save()

void impeller::DlDispatcherBase::save | ( | uint32_t | total_content_depth | ) |
| override

Definition at line 302 of file dl_dispatcher.cc.

302 {
303 AUTO_DEPTH_WATCHER(1u);
304
305 GetCanvas().Save(total_content_depth);
306 }

References AUTO_DEPTH_WATCHER, GetCanvas(), and impeller::Canvas::Save().

## ◆ saveLayer()

void impeller::DlDispatcherBase::saveLayer | ( | const DlRect & | bounds,
|  | const flutter::SaveLayerOptions & | options,
|  | uint32_t | total_content_depth,
|  | flutter::DlBlendMode | max_content_mode,
|  | const flutter::DlImageFilter * | backdrop,
|  | std::optional< int64_t > | backdrop_id
| ) |  |
| override

Definition at line 309 of file dl_dispatcher.cc.

314 {
315 AUTO_DEPTH_WATCHER(1u);
316
317 auto paint = options.renders_with_attributes() ? paint_ : Paint{};
318 auto promise = options.content_is_clipped()
319 ? ContentBoundsPromise::kMayClipContents
320 : ContentBoundsPromise::kContainsContents;
321 std::optional<Rect> impeller_bounds;
322 // If the content is unbounded but has developer specified bounds, we take
323 // the original bounds so that we clip the content as expected.
324 if (!options.content_is_unbounded() || options.bounds_from_caller()) {
325 impeller_bounds = bounds;
326 }
327
328 GetCanvas().SaveLayer(
329 paint, impeller_bounds, backdrop, promise, total_content_depth,
330 // Unbounded content can still have user specified bounds that require a
331 // saveLayer to be created to perform the clip.
332 options.can_distribute_opacity() && !options.content_is_unbounded(),
333 backdrop_id //
334 );
335 }
impeller::ContentBoundsPromise::kMayClipContents
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...

References AUTO_DEPTH_WATCHER, GetCanvas(), impeller::kContainsContents, impeller::kMayClipContents, paint_, and impeller::Canvas::SaveLayer().

## ◆ scale()

void impeller::DlDispatcherBase::scale | ( | DlScalar | sx,
|  | DlScalar | sy
| ) |  |
| override

Definition at line 350 of file dl_dispatcher.cc.

350 {
351 AUTO_DEPTH_WATCHER(0u);
352
353 GetCanvas().Scale({sx, sy, 1.0});
354 }
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:262

References AUTO_DEPTH_WATCHER, GetCanvas(), and impeller::Canvas::Scale().

## ◆ setAntiAlias()

void impeller::DlDispatcherBase::setAntiAlias | ( | bool | aa | ) |
| override

Definition at line 149 of file dl_dispatcher.cc.

149 {
150 AUTO_DEPTH_WATCHER(0u);
151
152 // Nothing to do because AA is implicit.
153 }

References AUTO_DEPTH_WATCHER.

## ◆ setBlendMode()

void impeller::DlDispatcherBase::setBlendMode | ( | flutter::DlBlendMode | mode | ) |
| override

Definition at line 252 of file dl_dispatcher.cc.

252 {
253 AUTO_DEPTH_WATCHER(0u);
254
255 paint_.blend_mode = dl_mode;
256 }
impeller::Paint::blend_mode
BlendMode blend_mode
Definition: paint.h:84

References AUTO_DEPTH_WATCHER, impeller::Paint::blend_mode, and paint_.

## ◆ setColor()

void impeller::DlDispatcherBase::setColor | ( | flutter::DlColor | color | ) |
| override

Definition at line 176 of file dl_dispatcher.cc.

176 {
177 AUTO_DEPTH_WATCHER(0u);
178
179 paint_.color = skia_conversions::ToColor(color);
180 }
impeller::Paint::color
Color color
Definition: paint.h:74

References AUTO_DEPTH_WATCHER, impeller::Paint::color, paint_, and impeller::skia_conversions::ToColor().

## ◆ setColorFilter()

void impeller::DlDispatcherBase::setColorFilter | ( | const flutter::DlColorFilter * | filter | ) |
| override

Definition at line 238 of file dl_dispatcher.cc.

238 {
239 AUTO_DEPTH_WATCHER(0u);
240
241 paint_.color_filter = filter;
242 }
impeller::Paint::color_filter
const flutter::DlColorFilter * color_filter
Definition: paint.h:76

References AUTO_DEPTH_WATCHER, impeller::Paint::color_filter, and paint_.

## ◆ setColorSource()

void impeller::DlDispatcherBase::setColorSource | ( | const flutter::DlColorSource * | source | ) |
| override

Definition at line 231 of file dl_dispatcher.cc.

231 {
232 AUTO_DEPTH_WATCHER(0u);
233
234 paint_.color_source = source;
235 }
impeller::Paint::color_source
const flutter::DlColorSource * color_source
Definition: paint.h:75

References AUTO_DEPTH_WATCHER, impeller::Paint::color_source, and paint_.

## ◆ setDrawStyle()

void impeller::DlDispatcherBase::setDrawStyle | ( | flutter::DlDrawStyle | style | ) |
| override

Definition at line 169 of file dl_dispatcher.cc.

169 {
170 AUTO_DEPTH_WATCHER(0u);
171
172 paint_.style = ToStyle(style);
173 }
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:155

References AUTO_DEPTH_WATCHER, paint_, impeller::Paint::style, and impeller::ToStyle().

## ◆ setImageFilter()

void impeller::DlDispatcherBase::setImageFilter | ( | const flutter::DlImageFilter * | filter | ) |
| override

Definition at line 295 of file dl_dispatcher.cc.

295 {
296 AUTO_DEPTH_WATCHER(0u);
297
298 paint_.image_filter = filter;
299 }
impeller::Paint::image_filter
const flutter::DlImageFilter * image_filter
Definition: paint.h:77

References AUTO_DEPTH_WATCHER, impeller::Paint::image_filter, and paint_.

## ◆ setInvertColors()

void impeller::DlDispatcherBase::setInvertColors | ( | bool | invert | ) |
| override

Definition at line 245 of file dl_dispatcher.cc.

245 {
246 AUTO_DEPTH_WATCHER(0u);
247
248 paint_.invert_colors = invert;
249 }
impeller::Paint::invert_colors
bool invert_colors
Definition: paint.h:85

References AUTO_DEPTH_WATCHER, impeller::Paint::invert_colors, and paint_.

## ◆ setMaskFilter()

void impeller::DlDispatcherBase::setMaskFilter | ( | const flutter::DlMaskFilter * | filter | ) |
| override

Definition at line 272 of file dl_dispatcher.cc.

272 {
273 AUTO_DEPTH_WATCHER(0u);
274
275 // Needs https://github.com/flutter/flutter/issues/95434
276 if (filter == nullptr) {
277 paint_.mask_blur_descriptor = std::nullopt;
278 return;
279 }
280 switch (filter->type()) {
281 case flutter::DlMaskFilterType::kBlur: {
282 auto blur = filter->asBlur();
283
284 paint_.mask_blur_descriptor = {
285 .style = ToBlurStyle(blur->style()),
286 .sigma = Sigma(blur->sigma()),
287 .respect_ctm = blur->respectCTM(),
288 };
289 break;
290 }
291 }
292 }
impeller::ToBlurStyle
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
Definition: dl_dispatcher.cc:258
impeller::Paint::mask_blur_descriptor
std::optional< MaskBlurDescriptor > mask_blur_descriptor
Definition: paint.h:87

References AUTO_DEPTH_WATCHER, impeller::Paint::mask_blur_descriptor, paint_, and impeller::ToBlurStyle().

## ◆ setStrokeCap()

void impeller::DlDispatcherBase::setStrokeCap | ( | flutter::DlStrokeCap | cap | ) |
| override

Definition at line 197 of file dl_dispatcher.cc.

197 {
198 AUTO_DEPTH_WATCHER(0u);
199
200 switch (cap) {
201 case flutter::DlStrokeCap::kButt:
202 paint_.stroke_cap = Cap::kButt;
203 break;
204 case flutter::DlStrokeCap::kRound:
205 paint_.stroke_cap = Cap::kRound;
206 break;
207 case flutter::DlStrokeCap::kSquare:
208 paint_.stroke_cap = Cap::kSquare;
209 break;
210 }
211 }
impeller::Cap::kButt
@ kButt
impeller::Cap::kSquare
@ kSquare
impeller::Paint::stroke_cap
Cap stroke_cap
Definition: paint.h:80

References AUTO_DEPTH_WATCHER, impeller::kButt, impeller::kRound, impeller::kSquare, paint_, and impeller::Paint::stroke_cap.

## ◆ setStrokeJoin()

void impeller::DlDispatcherBase::setStrokeJoin | ( | flutter::DlStrokeJoin | join | ) |
| override

Definition at line 214 of file dl_dispatcher.cc.

214 {
215 AUTO_DEPTH_WATCHER(0u);
216
217 switch (join) {
218 case flutter::DlStrokeJoin::kMiter:
219 paint_.stroke_join = Join::kMiter;
220 break;
221 case flutter::DlStrokeJoin::kRound:
222 paint_.stroke_join = Join::kRound;
223 break;
224 case flutter::DlStrokeJoin::kBevel:
225 paint_.stroke_join = Join::kBevel;
226 break;
227 }
228 }
impeller::Join::kRound
@ kRound
impeller::Join::kMiter
@ kMiter
impeller::Join::kBevel
@ kBevel
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:81

References AUTO_DEPTH_WATCHER, impeller::kBevel, impeller::kMiter, impeller::kRound, paint_, and impeller::Paint::stroke_join.

## ◆ setStrokeMiter()

void impeller::DlDispatcherBase::setStrokeMiter | ( | DlScalar | limit | ) |
| override

Definition at line 190 of file dl_dispatcher.cc.

190 {
191 AUTO_DEPTH_WATCHER(0u);
192
193 paint_.stroke_miter = limit;
194 }
impeller::Paint::stroke_miter
Scalar stroke_miter
Definition: paint.h:82

References AUTO_DEPTH_WATCHER, paint_, and impeller::Paint::stroke_miter.

## ◆ setStrokeWidth()

void impeller::DlDispatcherBase::setStrokeWidth | ( | DlScalar | width | ) |
| override

Definition at line 183 of file dl_dispatcher.cc.

183 {
184 AUTO_DEPTH_WATCHER(0u);
185
186 paint_.stroke_width = width;
187 }

References AUTO_DEPTH_WATCHER, paint_, and impeller::Paint::stroke_width.

## ◆ SimplifyOrDrawPath()

void impeller::DlDispatcherBase::SimplifyOrDrawPath | ( | Canvas & | canvas,
|  | const DlPath & | cache,
|  | const Paint & | paint
| ) |  |
| static protected

Definition at line 648 of file dl_dispatcher.cc.

650 {
651 DlRect rect;
652
653 // We can't "optimize" a path into a rectangle if it's open.
654 bool closed;
655 if (path.IsRect(&rect, &closed) && closed) {
656 canvas.DrawRect(rect, paint);
657 return;
658 }
659
660 SkRRect rrect;
661 if (path.IsSkRRect(&rrect) && rrect.isSimple()) {
662 canvas.DrawRoundRect(flutter::ToDlRoundRect(rrect), paint);
663 return;
664 }
665
666 if (path.IsOval(&rect)) {
667 canvas.DrawOval(rect, paint);
668 return;
669 }
670
671 DlPoint start;
672 DlPoint end;
673 if (path.IsLine(&start, &end)) {
674 canvas.DrawLine(start, end, paint);
675 return;
676 }
677
678 canvas.DrawPath(path.GetPath(), paint);
679 }
impeller::DlPoint
flutter::DlPoint DlPoint
Definition: dl_dispatcher.h:24

References impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawRect(), and impeller::Canvas::DrawRoundRect().

Referenced by drawPath(), and drawShadow().

## ◆ skew()

void impeller::DlDispatcherBase::skew | ( | DlScalar | sx,
|  | DlScalar | sy
| ) |  |
| override

Definition at line 364 of file dl_dispatcher.cc.

364 {
365 AUTO_DEPTH_WATCHER(0u);
366
367 GetCanvas().Skew(sx, sy);
368 }
impeller::Canvas::Skew
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:270

References AUTO_DEPTH_WATCHER, GetCanvas(), and impeller::Canvas::Skew().

## ◆ transform2DAffine()

void impeller::DlDispatcherBase::transform2DAffine | ( | DlScalar | mxx,
|  | DlScalar | mxy,
|  | DlScalar | mxt,
|  | DlScalar | myx,
|  | DlScalar | myy,
|  | DlScalar | myt
| ) |  |
| override

Definition at line 371 of file dl_dispatcher.cc.

376 {
377 AUTO_DEPTH_WATCHER(0u);
378
379 // clang-format off
380 transformFullPerspective(
381 mxx, mxy, 0, mxt,
382 myx, myy, 0, myt,
383 0 , 0, 1, 0,
384 0 , 0, 0, 1
385 );
386 // clang-format on
387 }
impeller::DlDispatcherBase::transformFullPerspective
void transformFullPerspective(DlScalar mxx, DlScalar mxy, DlScalar mxz, DlScalar mxt, DlScalar myx, DlScalar myy, DlScalar myz, DlScalar myt, DlScalar mzx, DlScalar mzy, DlScalar mzz, DlScalar mzt, DlScalar mwx, DlScalar mwy, DlScalar mwz, DlScalar mwt) override
Definition: dl_dispatcher.cc:390

References AUTO_DEPTH_WATCHER, and transformFullPerspective().

## ◆ transformFullPerspective()

void impeller::DlDispatcherBase::transformFullPerspective | ( | DlScalar | mxx,
|  | DlScalar | mxy,
|  | DlScalar | mxz,
|  | DlScalar | mxt,
|  | DlScalar | myx,
|  | DlScalar | myy,
|  | DlScalar | myz,
|  | DlScalar | myt,
|  | DlScalar | mzx,
|  | DlScalar | mzy,
|  | DlScalar | mzz,
|  | DlScalar | mzt,
|  | DlScalar | mwx,
|  | DlScalar | mwy,
|  | DlScalar | mwz,
|  | DlScalar | mwt
| ) |  |
| override

Definition at line 390 of file dl_dispatcher.cc.

405 {
406 AUTO_DEPTH_WATCHER(0u);
407
408 // The order of arguments is row-major but Impeller matrices are
409 // column-major.
410 // clang-format off
411 auto transform = Matrix{
412 mxx, myx, mzx, mwx,
413 mxy, myy, mzy, mwy,
414 mxz, myz, mzz, mwz,
415 mxt, myt, mzt, mwt
416 };
417 // clang-format on
418 GetCanvas().Transform(transform);
419 }
impeller::Canvas::Transform
void Transform(const Matrix &transform)
Definition: canvas.cc:250
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214

References AUTO_DEPTH_WATCHER, GetCanvas(), impeller::Canvas::Transform(), and transform.

Referenced by transform2DAffine().

## ◆ transformReset()

void impeller::DlDispatcherBase::transformReset | ( |  | ) |
| override

Definition at line 422 of file dl_dispatcher.cc.

422 {
423 AUTO_DEPTH_WATCHER(0u);
424
425 GetCanvas().ResetTransform();
426 GetCanvas().Transform(initial_matrix_);
427 }
impeller::Canvas::ResetTransform
void ResetTransform()
Definition: canvas.cc:246

References AUTO_DEPTH_WATCHER, GetCanvas(), initial_matrix_, impeller::Canvas::ResetTransform(), and impeller::Canvas::Transform().

## ◆ translate()

void impeller::DlDispatcherBase::translate | ( | DlScalar | tx,
|  | DlScalar | ty
| ) |  |
| override

Definition at line 343 of file dl_dispatcher.cc.

343 {
344 AUTO_DEPTH_WATCHER(0u);
345
346 GetCanvas().Translate({tx, ty, 0.0});
347 }
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:258

References AUTO_DEPTH_WATCHER, GetCanvas(), and impeller::Canvas::Translate().

## Member Data Documentation

## ◆ initial_matrix_

Matrix impeller::DlDispatcherBase::initial_matrix_
| protected

Definition at line 261 of file dl_dispatcher.h.

Referenced by drawDisplayList(), and transformReset().

## ◆ paint_

Paint impeller::DlDispatcherBase::paint_
| protected

Definition at line 260 of file dl_dispatcher.h.

Referenced by drawArc(), drawAtlas(), drawCircle(), drawDashedLine(), drawDiffRoundRect(), drawDisplayList(), drawImageNine(), drawImageRect(), drawLine(), drawOval(), drawPaint(), drawPath(), drawPoints(), drawRect(), drawRoundRect(), drawRoundSuperellipse(), drawTextFrame(), impeller::CanvasDlDispatcher::drawVertices(), saveLayer(), setBlendMode(), setColor(), setColorFilter(), setColorSource(), setDrawStyle(), setImageFilter(), setInvertColors(), setMaskFilter(), setStrokeCap(), setStrokeJoin(), setStrokeMiter(), and setStrokeWidth().

The documentation for this class was generated from the following files:

- impeller/display_list/dl_dispatcher.h
- impeller/display_list/dl_dispatcher.cc