| 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 447 of file dl_dispatcher.cc.

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

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 498 of file dl_dispatcher.cc.

500 {
501 AUTO_DEPTH_WATCHER(0u);
502
503 auto clip_op = ToClipOperation(sk_op);
504
505 DlRect rect;
506 if (path.IsRect(&rect)) {
507 FillRectGeometry geom(rect);
508 GetCanvas().ClipGeometry(geom, clip_op, /*is_aa=*/is_aa);
509 } else if (path.IsOval(&rect)) {
510 EllipseGeometry geom(rect);
511 GetCanvas().ClipGeometry(geom, clip_op);
512 } else {
513 DlRoundRect rrect;
514 if (path.IsRoundRect(&rrect) && rrect.GetRadii().AreAllCornersSame()) {
515 RoundRectGeometry geom(rrect.GetBounds(), rrect.GetRadii().top_left);
516 GetCanvas().ClipGeometry(geom, clip_op);
517 } else {
518 FillPathGeometry geom(path);
519 GetCanvas().ClipGeometry(geom, clip_op);
520 }
521 }
522 }
impeller::DlRect
flutter::DlRect DlRect
Definition: dl_dispatcher.h:25
impeller::DlRoundRect
flutter::DlRoundRect DlRoundRect
Definition: dl_dispatcher.h:27

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 437 of file dl_dispatcher.cc.

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

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 457 of file dl_dispatcher.cc.

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

References 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 479 of file dl_dispatcher.cc.

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

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 643 of file dl_dispatcher.cc.

646 {
647 AUTO_DEPTH_WATCHER(1u);
648
649 GetCanvas().DrawArc(Arc(oval_bounds, Degrees(start_degrees),
650 Degrees(sweep_degrees), use_center),
651 paint_);
652 }
use_center
bool use_center
Definition: aiks_dl_basic_unittests.cc:764
impeller::Canvas::DrawArc
void DrawArc(const Arc &arc, const Paint &paint)
Definition: canvas.cc:679
impeller::DlDispatcherBase::paint_
Paint paint_
Definition: dl_dispatcher.h:260

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

## ◆ 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 763 of file dl_dispatcher.cc.

771 {
772 AUTO_DEPTH_WATCHER(1u);
773
774 auto geometry =
775 DlAtlasGeometry(atlas->impeller_texture(), //
776 xform, //
777 tex, //
778 colors, //
779 static_cast<size_t>(count), //
780 mode, //
781 skia_conversions::ToSamplerDescriptor(sampling), //
782 ToOptRect(cull_rect) //
783 );
784 auto atlas_contents = std::make_shared<AtlasContents>();
785 atlas_contents->SetGeometry(&geometry);
786
787 GetCanvas().DrawAtlas(atlas_contents, paint_);
788 }
impeller::Canvas::DrawAtlas
void DrawAtlas(const std::shared_ptr< AtlasContents > &atlas_contents, const Paint &paint)
Definition: canvas.cc:1118
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:139

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 574 of file dl_dispatcher.cc.

574 {
575 AUTO_DEPTH_WATCHER(1u);
576
577 GetCanvas().DrawCircle(center, radius, paint_);
578 }
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:804

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 525 of file dl_dispatcher.cc.

526 {
527 AUTO_DEPTH_WATCHER(1u);
528
529 Paint paint;
530 paint.color = skia_conversions::ToColor(color);
531 paint.blend_mode = dl_mode;
532 GetCanvas().DrawPaint(paint);
533 }
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:341
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 550 of file dl_dispatcher.cc.

553 {
554 AUTO_DEPTH_WATCHER(1u);
555
556 GetCanvas().DrawDashedLine(p0, p1, on_length, off_length, paint_);
557 }
impeller::Canvas::DrawDashedLine
void DrawDashedLine(const Point &p0, const Point &p1, Scalar on_length, Scalar off_length, const Paint &paint)
Definition: canvas.cc:606

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

## ◆ drawDiffRoundRect()

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

Definition at line 588 of file dl_dispatcher.cc.

589 {
590 AUTO_DEPTH_WATCHER(1u);
591
592 GetCanvas().DrawDiffRoundRect(outer, inner, paint_);
593 }
impeller::Canvas::DrawDiffRoundRect
void DrawDiffRoundRect(const RoundRect &outer, const RoundRect &inner, const Paint &paint)
Definition: canvas.cc:766

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

## ◆ drawDisplayList()

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

Definition at line 791 of file dl_dispatcher.cc.

793 {
794 AUTO_DEPTH_WATCHER(display_list->total_depth());
795
796 // Save all values that must remain untouched after the operation.
797 Paint saved_paint = paint_;
798 Matrix saved_initial_matrix = initial_matrix_;
799
800 // Establish a new baseline for interpreting the new DL.
801 // Matrix and clip are left untouched, the current
802 // transform is saved as the new base matrix, and paint
803 // values are reset to defaults.
804 initial_matrix_ = GetCanvas().GetCurrentTransform();
805 paint_ = Paint();
806
807 // Handle passed opacity in the most brute-force way by using
808 // a SaveLayer. If the display_list is able to inherit the
809 // opacity, this could also be handled by modulating all of its
810 // attribute settings (for example, color), by the indicated
811 // opacity.
812 int restore_count = GetCanvas().GetSaveCount();
813 if (opacity < SK_Scalar1) {
814 Paint save_paint;
815 save_paint.color = Color(0, 0, 0, opacity);
816 GetCanvas().SaveLayer(save_paint, display_list->GetBounds(), nullptr,
817 ContentBoundsPromise::kContainsContents,
818 display_list->total_depth(),
819 display_list->can_apply_group_opacity());
820 } else {
821 // The display list may alter the clip, which must be restored to the
822 // current clip at the end of playback.
823 GetCanvas().Save(display_list->total_depth());
824 }
825
826 // TODO(131445): Remove this restriction if we can correctly cull with
827 // perspective transforms.
828 if (display_list->has_rtree() && !initial_matrix_.HasPerspective()) {
829 // The canvas remembers the screen-space culling bounds clipped by
830 // the surface and the history of clip calls. DisplayList can cull
831 // the ops based on a rectangle expressed in its "destination bounds"
832 // so we need the canvas to transform those into the current local
833 // coordinate space into which the DisplayList will be rendered.
834 auto global_culling_bounds = GetCanvas().GetLocalCoverageLimit();
835 if (global_culling_bounds.has_value()) {
836 Rect cull_rect = global_culling_bounds->TransformBounds(
837 GetCanvas().GetCurrentTransform().Invert());
838 display_list->Dispatch(*this, cull_rect);
839 } else {
840 // If the culling bounds are empty, this display list can be skipped
841 // entirely.
842 }
843 } else {
844 display_list->Dispatch(*this);
845 }
846
847 // Restore all saved state back to what it was before we interpreted
848 // the display_list
849 AUTO_DEPTH_CHECK();
850 GetCanvas().RestoreToCount(restore_count);
851 initial_matrix_ = saved_initial_matrix;
852 paint_ = saved_paint;
853 }
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:1201
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:1238
impeller::Canvas::GetCurrentTransform
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:272
impeller::Canvas::RestoreToCount
void RestoreToCount(size_t count)
Definition: canvas.cc:319
impeller::Canvas::GetSaveCount
size_t GetSaveCount() const
Definition: canvas.cc:311
impeller::Canvas::Save
void Save(uint32_t total_content_depth=kMaxDepth)
Definition: canvas.cc:1184
impeller::DlDispatcherBase::initial_matrix_
Matrix initial_matrix_
Definition: dl_dispatcher.h:261
AUTO_DEPTH_CHECK
#define AUTO_DEPTH_CHECK()
Definition: dl_dispatcher.cc:114
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:418
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, GetCanvas(), impeller::Canvas::GetCurrentTransform(), impeller::Canvas::GetLocalCoverageLimit(), impeller::Canvas::GetSaveCount(), 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 699 of file dl_dispatcher.cc.

702 {
703 AUTO_DEPTH_WATCHER(1u);
704
705 if (!image) {
706 return;
707 }
708
709 auto texture = image->impeller_texture();
710 if (!texture) {
711 return;
712 }
713
714 const auto size = texture->GetSize();
715 const auto src = DlRect::MakeWH(size.width, size.height);
716 const auto dest = DlRect::MakeXYWH(point.x, point.y, size.width, size.height);
717
718 drawImageRect(image, // image
719 src, // source rect
720 dest, // destination rect
721 sampling, // sampling options
722 render_with_attributes, // render with attributes
723 flutter::DlSrcRectConstraint::kStrict // constraint
724 );
725 }
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:728

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 747 of file dl_dispatcher.cc.

751 {
752 AUTO_DEPTH_WATCHER(9u);
753
754 NinePatchConverter converter = {};
755 converter.DrawNinePatch(image->impeller_texture(),
756 Rect::MakeLTRB(center.GetLeft(), center.GetTop(),
757 center.GetRight(), center.GetBottom()),
758 dst, ToSamplerDescriptor(filter), &GetCanvas(),
759 &paint_);
760 }
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlFilterMode options)
Definition: dl_dispatcher.cc:121
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 728 of file dl_dispatcher.cc.

734 {
735 AUTO_DEPTH_WATCHER(1u);
736
737 GetCanvas().DrawImageRect(
738 image->impeller_texture(), // image
739 src, // source rect
740 dst, // destination rect
741 render_with_attributes ? paint_ : Paint(), // paint
742 skia_conversions::ToSamplerDescriptor(sampling) // sampling
743 );
744 }
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:940

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 543 of file dl_dispatcher.cc.

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

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

## ◆ drawOval()

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

Definition at line 567 of file dl_dispatcher.cc.

567 {
568 AUTO_DEPTH_WATCHER(1u);
569
570 GetCanvas().DrawOval(bounds, paint_);
571 }
impeller::Canvas::DrawOval
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:650

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

## ◆ drawPaint()

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

Definition at line 536 of file dl_dispatcher.cc.

536 {
537 AUTO_DEPTH_WATCHER(1u);
538
539 GetCanvas().DrawPaint(paint_);
540 }

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

## ◆ drawPath()

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

Definition at line 603 of file dl_dispatcher.cc.

603 {
604 AUTO_DEPTH_WATCHER(1u);
605
606 SimplifyOrDrawPath(GetCanvas(), path, paint_);
607 }
impeller::DlDispatcherBase::SimplifyOrDrawPath
static void SimplifyOrDrawPath(Canvas &canvas, const DlPath &cache, const Paint &paint)
Definition: dl_dispatcher.cc:609

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 655 of file dl_dispatcher.cc.

657 {
658 AUTO_DEPTH_WATCHER(1u);
659
660 Paint paint = paint_;
661 paint.style = Paint::Style::kStroke;
662 switch (mode) {
663 case flutter::DlPointMode::kPoints: {
664 // Cap::kButt is also treated as a square.
665 PointStyle point_style = paint.stroke.cap == Cap::kRound
666 ? PointStyle::kRound
667 : PointStyle::kSquare;
668 Scalar radius = paint.stroke.width;
669 if (radius > 0) {
670 radius /= 2.0;
671 }
672 GetCanvas().DrawPoints(points, count, radius, paint, point_style);
673 } break;
674 case flutter::DlPointMode::kLines:
675 for (uint32_t i = 1; i < count; i += 2) {
676 Point p0 = points[i - 1];
677 Point p1 = points[i];
678 GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
679 }
680 break;
681 case flutter::DlPointMode::kPolygon:
682 if (count > 1) {
683 Point p0 = points[0];
684 for (uint32_t i = 1; i < count; i++) {
685 Point p1 = points[i];
686 GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
687 p0 = p1;
688 }
689 }
690 break;
691 }
692 }
impeller::Canvas::DrawPoints
void DrawPoints(const Point points[], uint32_t count, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:908
impeller::Scalar
float Scalar
Definition: scalar.h:19
impeller::PointStyle
PointStyle
Definition: canvas.h:65
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::Point
TPoint< Scalar > Point
Definition: point.h:327
impeller::Cap::kRound
@ kRound
impeller::Paint::Style::kStroke
@ kStroke
impeller::Paint::style
Style style
Definition: paint.h:81
points
std::vector< Point > points
Definition: tessellator_libtess.cc:76

References AUTO_DEPTH_WATCHER, impeller::StrokeParameters::cap, impeller::Canvas::DrawLine(), impeller::Canvas::DrawPoints(), GetCanvas(), impeller::kRound, impeller::kSquare, impeller::Paint::kStroke, paint_, points, impeller::Paint::stroke, impeller::Paint::style, and impeller::StrokeParameters::width.

## ◆ drawRect()

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

Definition at line 560 of file dl_dispatcher.cc.

560 {
561 AUTO_DEPTH_WATCHER(1u);
562
563 GetCanvas().DrawRect(rect, paint_);
564 }
impeller::Canvas::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: canvas.cc:632

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

## ◆ drawRoundRect()

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

Definition at line 581 of file dl_dispatcher.cc.

581 {
582 AUTO_DEPTH_WATCHER(1u);
583
584 GetCanvas().DrawRoundRect(rrect, paint_);
585 }
impeller::Canvas::DrawRoundRect
void DrawRoundRect(const RoundRect &rect, const Paint &paint)
Definition: canvas.cc:734

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

## ◆ drawRoundSuperellipse()

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

Definition at line 596 of file dl_dispatcher.cc.

596 {
597 AUTO_DEPTH_WATCHER(1u);
598
599 GetCanvas().DrawRoundSuperellipse(rse, paint_);
600 }
impeller::Canvas::DrawRoundSuperellipse
void DrawRoundSuperellipse(const RoundSuperellipse &rse, const Paint &paint)
Definition: canvas.cc:782

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 878 of file dl_dispatcher.cc.

882 {
883 AUTO_DEPTH_WATCHER(1u);
884
885 Color spot_color = skia_conversions::ToColor(color);
886 spot_color.alpha *= 0.25;
887
888 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
889 {
890 Scalar max =
891 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
892 Scalar min =
893 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
894 Scalar luminance = (min + max) * 0.5;
895
896 Scalar alpha_adjust =
897 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
898 spot_color.alpha;
899 Scalar color_alpha =
900 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
901 luminance;
902 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
903
904 Scalar greyscale_alpha =
905 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
906
907 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
908 Scalar tonal_alpha = color_scale + greyscale_alpha;
909 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
910 spot_color = Color(unpremul_scale * spot_color.red,
911 unpremul_scale * spot_color.green,
912 unpremul_scale * spot_color.blue, tonal_alpha);
913 }
914
915 Vector3 light_position(0, -1, 1);
916 Scalar occluder_z = dpr * elevation;
917
918 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
919
920 Paint paint;
921 paint.style = Paint::Style::kFill;
922 paint.color = spot_color;
923 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
924 .style = FilterContents::BlurStyle::kNormal,
925 .sigma = Radius{kLightRadius * occluder_z /
926 GetCanvas().GetCurrentTransform().GetScale().y},
927 };
928
929 GetCanvas().Save(1u);
930 GetCanvas().PreConcat(
931 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
932
933 SimplifyOrDrawPath(GetCanvas(), path, paint);
934 AUTO_DEPTH_CHECK();
935
936 GetCanvas().Restore();
937 }
impeller::Canvas::Restore
bool Restore()
Definition: canvas.cc:1476
impeller::Canvas::PreConcat
void PreConcat(const Matrix &transform)
Definition: canvas.cc:260
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
Vector3 GetScale() const
Definition: matrix.h:394
impeller::Paint::Style::kFill
@ kFill
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 856 of file dl_dispatcher.cc.

858 {
859 // When running with Impeller enabled Skia text blobs are converted to
860 // Impeller text frames in paragraph_skia.cc
861 UNIMPLEMENTED;
862 }
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:118

References UNIMPLEMENTED.

## ◆ drawTextFrame()

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

Definition at line 865 of file dl_dispatcher.cc.

868 {
869 AUTO_DEPTH_WATCHER(1u);
870
871 GetCanvas().DrawTextFrame(text_frame, //
872 impeller::Point{x, y}, //
873 paint_ //
874 );
875 }
impeller::Canvas::DrawTextFrame
void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:1667
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 694 of file dl_dispatcher.cc.

696 {}

## ◆ 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 336 of file dl_dispatcher.cc.

336 {
337 GetCanvas().Restore();
338 }

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

## ◆ rotate()

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

Definition at line 355 of file dl_dispatcher.cc.

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

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

## ◆ save()

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

Definition at line 300 of file dl_dispatcher.cc.

300 {
301 AUTO_DEPTH_WATCHER(1u);
302
303 GetCanvas().Save(total_content_depth);
304 }

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 307 of file dl_dispatcher.cc.

312 {
313 AUTO_DEPTH_WATCHER(1u);
314
315 auto paint = options.renders_with_attributes() ? paint_ : Paint{};
316 auto promise = options.content_is_clipped()
317 ? ContentBoundsPromise::kMayClipContents
318 : ContentBoundsPromise::kContainsContents;
319 std::optional<Rect> impeller_bounds;
320 // If the content is unbounded but has developer specified bounds, we take
321 // the original bounds so that we clip the content as expected.
322 if (!options.content_is_unbounded() || options.bounds_from_caller()) {
323 impeller_bounds = bounds;
324 }
325
326 GetCanvas().SaveLayer(
327 paint, impeller_bounds, backdrop, promise, total_content_depth,
328 // Unbounded content can still have user specified bounds that require a
329 // saveLayer to be created to perform the clip.
330 options.can_distribute_opacity() && !options.content_is_unbounded(),
331 backdrop_id //
332 );
333 }
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 348 of file dl_dispatcher.cc.

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

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

## ◆ setAntiAlias()

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

Definition at line 147 of file dl_dispatcher.cc.

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

References AUTO_DEPTH_WATCHER.

## ◆ setBlendMode()

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

Definition at line 250 of file dl_dispatcher.cc.

250 {
251 AUTO_DEPTH_WATCHER(0u);
252
253 paint_.blend_mode = dl_mode;
254 }
impeller::Paint::blend_mode
BlendMode blend_mode
Definition: paint.h:82

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

## ◆ setColor()

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

Definition at line 174 of file dl_dispatcher.cc.

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

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 236 of file dl_dispatcher.cc.

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

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

## ◆ setColorSource()

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

Definition at line 229 of file dl_dispatcher.cc.

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

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

## ◆ setDrawStyle()

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

Definition at line 167 of file dl_dispatcher.cc.

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

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

## ◆ setImageFilter()

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

Definition at line 293 of file dl_dispatcher.cc.

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

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

## ◆ setInvertColors()

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

Definition at line 243 of file dl_dispatcher.cc.

243 {
244 AUTO_DEPTH_WATCHER(0u);
245
246 paint_.invert_colors = invert;
247 }
impeller::Paint::invert_colors
bool invert_colors
Definition: paint.h:83

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

## ◆ setMaskFilter()

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

Definition at line 270 of file dl_dispatcher.cc.

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

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 195 of file dl_dispatcher.cc.

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

References AUTO_DEPTH_WATCHER, impeller::StrokeParameters::cap, impeller::kButt, impeller::kRound, impeller::kSquare, paint_, and impeller::Paint::stroke.

## ◆ setStrokeJoin()

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

Definition at line 212 of file dl_dispatcher.cc.

212 {
213 AUTO_DEPTH_WATCHER(0u);
214
215 switch (join) {
216 case flutter::DlStrokeJoin::kMiter:
217 paint_.stroke.join = Join::kMiter;
218 break;
219 case flutter::DlStrokeJoin::kRound:
220 paint_.stroke.join = Join::kRound;
221 break;
222 case flutter::DlStrokeJoin::kBevel:
223 paint_.stroke.join = Join::kBevel;
224 break;
225 }
226 }
impeller::Join::kRound
@ kRound
impeller::Join::kMiter
@ kMiter
impeller::Join::kBevel
@ kBevel
impeller::StrokeParameters::join
Join join
Definition: stroke_parameters.h:31

References AUTO_DEPTH_WATCHER, impeller::StrokeParameters::join, impeller::kBevel, impeller::kMiter, impeller::kRound, paint_, and impeller::Paint::stroke.

## ◆ setStrokeMiter()

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

Definition at line 188 of file dl_dispatcher.cc.

188 {
189 AUTO_DEPTH_WATCHER(0u);
190
191 paint_.stroke.miter_limit = limit;
192 }
impeller::StrokeParameters::miter_limit
Scalar miter_limit
Definition: stroke_parameters.h:32

References AUTO_DEPTH_WATCHER, impeller::StrokeParameters::miter_limit, paint_, and impeller::Paint::stroke.

## ◆ setStrokeWidth()

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

Definition at line 181 of file dl_dispatcher.cc.

181 {
182 AUTO_DEPTH_WATCHER(0u);
183
184 paint_.stroke.width = width;
185 }
impeller::StrokeParameters::width
Scalar width
Definition: stroke_parameters.h:29

References AUTO_DEPTH_WATCHER, paint_, impeller::Paint::stroke, and impeller::StrokeParameters::width.

## ◆ SimplifyOrDrawPath()

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

Definition at line 609 of file dl_dispatcher.cc.

611 {
612 DlRect rect;
613
614 // We can't "optimize" a path into a rectangle if it's open.
615 bool closed;
616 if (path.IsRect(&rect, &closed) && closed) {
617 canvas.DrawRect(rect, paint);
618 return;
619 }
620
621 DlRoundRect rrect;
622 if (path.IsRoundRect(&rrect) && rrect.GetRadii().AreAllCornersSame()) {
623 canvas.DrawRoundRect(rrect, paint);
624 return;
625 }
626
627 if (path.IsOval(&rect)) {
628 canvas.DrawOval(rect, paint);
629 return;
630 }
631
632 DlPoint start;
633 DlPoint end;
634 if (path.IsLine(&start, &end)) {
635 canvas.DrawLine(start, end, paint);
636 return;
637 }
638
639 canvas.DrawPath(path, paint);
640 }
impeller::DlPoint
flutter::DlPoint DlPoint
Definition: dl_dispatcher.h:24
start
const size_t start
Definition: tessellator_libtess.cc:62
end
const size_t end
Definition: tessellator_libtess.cc:63

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

Referenced by drawPath(), and drawShadow().

## ◆ skew()

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

Definition at line 362 of file dl_dispatcher.cc.

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

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 369 of file dl_dispatcher.cc.

374 {
375 AUTO_DEPTH_WATCHER(0u);
376
377 // clang-format off
378 transformFullPerspective(
379 mxx, mxy, 0, mxt,
380 myx, myy, 0, myt,
381 0 , 0, 1, 0,
382 0 , 0, 0, 1
383 );
384 // clang-format on
385 }
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:388

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 388 of file dl_dispatcher.cc.

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

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

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 341 of file dl_dispatcher.cc.

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

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