| 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, ClipOp clip_op, bool is_aa) override
void | clipOval (const DlRect &bounds, ClipOp clip_op, bool is_aa) override
void | clipRoundRect (const DlRoundRect &rrect, ClipOp clip_op, bool is_aa) override
void | clipPath (const DlPath &path, ClipOp 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 | drawPath (const DlPath &path) override
void | drawArc (const DlRect &oval_bounds, DlScalar start_degrees, DlScalar sweep_degrees, bool use_center) override
void | drawPoints (PointMode 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, SrcRectConstraint 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 30 of file dl_dispatcher.h.

## Member Function Documentation

## ◆ clipOval()

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

Definition at line 441 of file dl_dispatcher.cc.

443 {
444 AUTO_DEPTH_WATCHER(0u);
445
446 EllipseGeometry geom(bounds);
447 GetCanvas().ClipGeometry(geom, ToClipOperation(clip_op));
448 }
impeller::Canvas::ClipGeometry
void ClipGeometry(const Geometry &geometry, Entity::ClipOperation clip_op, bool is_aa=true)
Definition: canvas.cc:566
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::DlCanvas::ClipOp clip_op)
Definition: dl_dispatcher.cc:420

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

## ◆ clipPath()

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

Definition at line 473 of file dl_dispatcher.cc.

473 {
474 AUTO_DEPTH_WATCHER(0u);
475
476 auto clip_op = ToClipOperation(sk_op);
477
478 DlRect rect;
479 if (path.IsRect(&rect)) {
480 RectGeometry geom(rect);
481 GetCanvas().ClipGeometry(geom, clip_op, /*is_aa=*/is_aa);
482 } else if (path.IsOval(&rect)) {
483 EllipseGeometry geom(rect);
484 GetCanvas().ClipGeometry(geom, clip_op);
485 } else {
486 SkRRect rrect;
487 if (path.IsSkRRect(&rrect) && rrect.isSimple()) {
488 RoundRectGeometry geom(skia_conversions::ToRect(rrect.rect()),
489 skia_conversions::ToSize(rrect.getSimpleRadii()));
490 GetCanvas().ClipGeometry(geom, clip_op);
491 } else {
492 FillPathGeometry geom(path.GetPath());
493 GetCanvas().ClipGeometry(geom, clip_op);
494 }
495 }
496 }
impeller::skia_conversions::ToSize
Size ToSize(const SkPoint &point)
Definition: skia_conversions.cc:85
impeller::skia_conversions::ToRect
Rect ToRect(const SkRect &rect)
Definition: skia_conversions.cc:31
impeller::DlRect
flutter::DlRect DlRect
Definition: dl_dispatcher.h:25

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

## ◆ clipRect()

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

Definition at line 431 of file dl_dispatcher.cc.

433 {
434 AUTO_DEPTH_WATCHER(0u);
435
436 RectGeometry geom(rect);
437 GetCanvas().ClipGeometry(geom, ToClipOperation(clip_op), /*is_aa=*/is_aa);
438 }

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

## ◆ clipRoundRect()

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

Definition at line 451 of file dl_dispatcher.cc.

453 {
454 AUTO_DEPTH_WATCHER(0u);
455
456 auto clip_op = ToClipOperation(sk_op);
457 if (rrect.IsRect()) {
458 RectGeometry geom(rrect.GetBounds());
459 GetCanvas().ClipGeometry(geom, clip_op, /*is_aa=*/is_aa);
460 } else if (rrect.IsOval()) {
461 EllipseGeometry geom(rrect.GetBounds());
462 GetCanvas().ClipGeometry(geom, clip_op);
463 } else if (rrect.GetRadii().AreAllCornersSame()) {
464 RoundRectGeometry geom(rrect.GetBounds(), rrect.GetRadii().top_left);
465 GetCanvas().ClipGeometry(geom, clip_op);
466 } else {
467 FillPathGeometry geom(PathBuilder{}.AddRoundRect(rrect).TakePath());
468 GetCanvas().ClipGeometry(geom, clip_op);
469 }
470 }

References impeller::PathBuilder::AddRoundRect(), 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 639 of file dl_dispatcher.cc.

642 {
643 AUTO_DEPTH_WATCHER(1u);
644
645 if (paint_.stroke_width >
646 std::max(oval_bounds.GetWidth(), oval_bounds.GetHeight())) {
647 // This is a special case for rendering arcs whose stroke width is so large
648 // you are effectively drawing a sector of a circle.
649 // https://github.com/flutter/flutter/issues/158567
650 DlRect expanded_rect = oval_bounds.Expand(Size(paint_.stroke_width / 2));
651 PathBuilder builder;
652 Paint fill_paint = paint_;
653 fill_paint.style = Paint::Style::kFill;
654 fill_paint.stroke_width = 1;
655 builder.AddArc(expanded_rect, Degrees(start_degrees),
656 Degrees(sweep_degrees),
657 /*use_center=*/true);
658 GetCanvas().DrawPath(builder.TakePath(), fill_paint);
659 } else {
660 PathBuilder builder;
661 builder.AddArc(oval_bounds, Degrees(start_degrees), Degrees(sweep_degrees),
662 use_center);
663 GetCanvas().DrawPath(builder.TakePath(), paint_);
664 }
665 }
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:293
impeller::DlDispatcherBase::paint_
Paint paint_
Definition: dl_dispatcher.h:245
impeller::Size
TSize< Scalar > Size
Definition: size.h:171
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 776 of file dl_dispatcher.cc.

784 {
785 AUTO_DEPTH_WATCHER(1u);
786
787 auto geometry =
788 DlAtlasGeometry(atlas->impeller_texture(), //
789 xform, //
790 tex, //
791 colors, //
792 static_cast<size_t>(count), //
793 skia_conversions::ToBlendMode(mode), //
794 skia_conversions::ToSamplerDescriptor(sampling), //
795 skia_conversions::ToRect(cull_rect) //
796 );
797 auto atlas_contents = std::make_shared<AtlasContents>();
798 atlas_contents->SetGeometry(&geometry);
799
800 GetCanvas().DrawAtlas(atlas_contents, paint_);
801 }
impeller::Canvas::DrawAtlas
void DrawAtlas(const std::shared_ptr< AtlasContents > &atlas_contents, const Paint &paint)
Definition: canvas.cc:852
impeller::skia_conversions::ToBlendMode
BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: skia_conversions.cc:176
impeller::skia_conversions::ToSamplerDescriptor
impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Definition: skia_conversions.cc:141

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

## ◆ drawCircle()

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

Definition at line 580 of file dl_dispatcher.cc.

580 {
581 AUTO_DEPTH_WATCHER(1u);
582
583 GetCanvas().DrawCircle(center, radius, paint_);
584 }
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:543

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

500 {
501 AUTO_DEPTH_WATCHER(1u);
502
503 Paint paint;
504 paint.color = skia_conversions::ToColor(color);
505 paint.blend_mode = skia_conversions::ToBlendMode(dl_mode);
506 GetCanvas().DrawPaint(paint);
507 }
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:308
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:89

References AUTO_DEPTH_WATCHER, impeller::Paint::blend_mode, impeller::Paint::color, impeller::Canvas::DrawPaint(), GetCanvas(), impeller::skia_conversions::ToBlendMode(), 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 523 of file dl_dispatcher.cc.

526 {
527 AUTO_DEPTH_WATCHER(1u);
528
529 Scalar length = p0.GetDistance(p1);
530 // Reasons to defer to regular DrawLine:
531 // length is non-positive - drawLine will draw appropriate "dot"
532 // off_length is non-positive - no gaps, drawLine will draw it solid
533 // on_length is negative - invalid dashing
534 // Note that a 0 length "on" dash will draw "dot"s every "off" distance
535 // apart
536 if (length > 0.0f && on_length >= 0.0f && off_length > 0.0f) {
537 Point delta = (p1 - p0) / length; // length > 0 already tested
538 PathBuilder builder;
539
540 Scalar consumed = 0.0f;
541 while (consumed < length) {
542 builder.MoveTo(p0 + delta * consumed);
543
544 Scalar dash_end = consumed + on_length;
545 if (dash_end < length) {
546 builder.LineTo(p0 + delta * dash_end);
547 } else {
548 builder.LineTo(p1);
549 // Should happen anyway due to the math, but let's make it explicit
550 // in case of bit errors. We're done with this line.
551 break;
552 }
553
554 consumed = dash_end + off_length;
555 }
556
557 Paint stroke_paint = paint_;
558 stroke_paint.style = Paint::Style::kStroke;
559 GetCanvas().DrawPath(builder.TakePath(), stroke_paint);
560 } else {
561 drawLine(p0, p1);
562 }
563 }
impeller::DlDispatcherBase::drawLine
void drawLine(const DlPoint &p0, const DlPoint &p1) override
Definition: dl_dispatcher.cc:517
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 594 of file dl_dispatcher.cc.

595 {
596 AUTO_DEPTH_WATCHER(1u);
597
598 PathBuilder builder;
599 builder.AddRoundRect(outer);
600 builder.AddRoundRect(inner);
601 builder.SetBounds(outer.GetBounds().Union(inner.GetBounds()));
602 GetCanvas().DrawPath(builder.TakePath(FillType::kOdd), paint_);
603 }
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 804 of file dl_dispatcher.cc.

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

715 {
716 AUTO_DEPTH_WATCHER(1u);
717
718 if (!image) {
719 return;
720 }
721
722 auto texture = image->impeller_texture();
723 if (!texture) {
724 return;
725 }
726
727 const auto size = texture->GetSize();
728 const auto src = DlRect::MakeWH(size.width, size.height);
729 const auto dest = DlRect::MakeXYWH(point.x, point.y, size.width, size.height);
730
731 drawImageRect(image, // image
732 src, // source rect
733 dest, // destination rect
734 sampling, // sampling options
735 render_with_attributes, // render with attributes
736 SrcRectConstraint::kStrict // constraint
737 );
738 }
impeller::DlDispatcherBase::drawImageRect
void drawImageRect(const sk_sp< flutter::DlImage > image, const DlRect &src, const DlRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
Definition: dl_dispatcher.cc:741

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

764 {
765 AUTO_DEPTH_WATCHER(9u);
766
767 NinePatchConverter converter = {};
768 converter.DrawNinePatch(image->impeller_texture(),
769 Rect::MakeLTRB(center.GetLeft(), center.GetTop(),
770 center.GetRight(), center.GetBottom()),
771 dst, ToSamplerDescriptor(filter), &GetCanvas(),
772 &paint_);
773 }
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,
|  | SrcRectConstraint | constraint = `SrcRectConstraint::kFast`
| ) |  |
| override

Definition at line 741 of file dl_dispatcher.cc.

747 {
748 AUTO_DEPTH_WATCHER(1u);
749
750 GetCanvas().DrawImageRect(
751 image->impeller_texture(), // image
752 src, // source rect
753 dst, // destination rect
754 render_with_attributes ? paint_ : Paint(), // paint
755 skia_conversions::ToSamplerDescriptor(sampling) // sampling
756 );
757 }
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:679

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

517 {
518 AUTO_DEPTH_WATCHER(1u);
519
520 GetCanvas().DrawLine(p0, p1, paint_);
521 }
impeller::Canvas::DrawLine
void DrawLine(const Point &p0, const Point &p1, const Paint &paint, bool reuse_depth=false)
Definition: canvas.cc:455

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

573 {
574 AUTO_DEPTH_WATCHER(1u);
575
576 GetCanvas().DrawOval(bounds, paint_);
577 }
impeller::Canvas::DrawOval
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:486

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

## ◆ drawPaint()

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

Definition at line 510 of file dl_dispatcher.cc.

510 {
511 AUTO_DEPTH_WATCHER(1u);
512
513 GetCanvas().DrawPaint(paint_);
514 }

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

## ◆ drawPath()

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

Definition at line 606 of file dl_dispatcher.cc.

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

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

## ◆ drawPoints()

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

Definition at line 668 of file dl_dispatcher.cc.

670 {
671 AUTO_DEPTH_WATCHER(1u);
672
673 Paint paint = paint_;
674 paint.style = Paint::Style::kStroke;
675 switch (mode) {
676 case flutter::DlCanvas::PointMode::kPoints: {
677 // Cap::kButt is also treated as a square.
678 PointStyle point_style = paint.stroke_cap == Cap::kRound
679 ? PointStyle::kRound
680 : PointStyle::kSquare;
681 Scalar radius = paint.stroke_width;
682 if (radius > 0) {
683 radius /= 2.0;
684 }
685 GetCanvas().DrawPoints(points, count, radius, paint, point_style);
686 } break;
687 case flutter::DlCanvas::PointMode::kLines:
688 for (uint32_t i = 1; i < count; i += 2) {
689 Point p0 = points[i - 1];
690 Point p1 = points[i];
691 GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
692 }
693 break;
694 case flutter::DlCanvas::PointMode::kPolygon:
695 if (count > 1) {
696 Point p0 = points[0];
697 for (uint32_t i = 1; i < count; i++) {
698 Point p1 = points[i];
699 GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
700 p0 = p1;
701 }
702 }
703 break;
704 }
705 }
impeller::Canvas::DrawPoints
void DrawPoints(const Point points[], uint32_t count, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:647
impeller::PointStyle
PointStyle
Definition: canvas.h:60
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 566 of file dl_dispatcher.cc.

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

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

## ◆ drawRoundRect()

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

Definition at line 587 of file dl_dispatcher.cc.

587 {
588 AUTO_DEPTH_WATCHER(1u);
589
590 GetCanvas().DrawRoundRect(rrect, paint_);
591 }
impeller::Canvas::DrawRoundRect
void DrawRoundRect(const RoundRect &rect, const Paint &paint)
Definition: canvas.cc:516

References AUTO_DEPTH_WATCHER, impeller::Canvas::DrawRoundRect(), 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 893 of file dl_dispatcher.cc.

897 {
898 AUTO_DEPTH_WATCHER(1u);
899
900 Color spot_color = skia_conversions::ToColor(color);
901 spot_color.alpha *= 0.25;
902
903 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
904 {
905 Scalar max =
906 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
907 Scalar min =
908 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
909 Scalar luminance = (min + max) * 0.5;
910
911 Scalar alpha_adjust =
912 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
913 spot_color.alpha;
914 Scalar color_alpha =
915 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
916 luminance;
917 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
918
919 Scalar greyscale_alpha =
920 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
921
922 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
923 Scalar tonal_alpha = color_scale + greyscale_alpha;
924 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
925 spot_color = Color(unpremul_scale * spot_color.red,
926 unpremul_scale * spot_color.green,
927 unpremul_scale * spot_color.blue, tonal_alpha);
928 }
929
930 Vector3 light_position(0, -1, 1);
931 Scalar occluder_z = dpr * elevation;
932
933 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
934
935 Paint paint;
936 paint.style = Paint::Style::kFill;
937 paint.color = spot_color;
938 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
939 .style = FilterContents::BlurStyle::kNormal,
940 .sigma = Radius{kLightRadius * occluder_z /
941 GetCanvas().GetCurrentTransform().GetScale().y},
942 };
943
944 GetCanvas().Save(1u);
945 GetCanvas().PreConcat(
946 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
947
948 SimplifyOrDrawPath(GetCanvas(), path, paint);
949 AUTO_DEPTH_CHECK();
950
951 GetCanvas().Restore();
952 }
impeller::Canvas::Restore
bool Restore()
Definition: canvas.cc:1204
impeller::Canvas::PreConcat
void PreConcat(const Matrix &transform)
Definition: canvas.cc:226
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:328
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 871 of file dl_dispatcher.cc.

873 {
874 // When running with Impeller enabled Skia text blobs are converted to
875 // Impeller text frames in paragraph_skia.cc
876 UNIMPLEMENTED;
877 }
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 880 of file dl_dispatcher.cc.

883 {
884 AUTO_DEPTH_WATCHER(1u);
885
886 GetCanvas().DrawTextFrame(text_frame, //
887 impeller::Point{x, y}, //
888 paint_ //
889 );
890 }
impeller::Canvas::DrawTextFrame
void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:1346
x
int32_t x
Definition: dl_golden_unittests.cc:443
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 707 of file dl_dispatcher.cc.

709 {}

## ◆ GetCanvas()

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

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

## ◆ restore()

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

Definition at line 329 of file dl_dispatcher.cc.

329 {
330 GetCanvas().Restore();
331 }

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

## ◆ rotate()

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

Definition at line 348 of file dl_dispatcher.cc.

348 {
349 AUTO_DEPTH_WATCHER(0u);
350
351 GetCanvas().Rotate(Degrees{degrees});
352 }
impeller::Canvas::Rotate
void Rotate(Radians radians)
Definition: canvas.cc:258

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

## ◆ save()

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

Definition at line 293 of file dl_dispatcher.cc.

293 {
294 AUTO_DEPTH_WATCHER(1u);
295
296 GetCanvas().Save(total_content_depth);
297 }

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

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

341 {
342 AUTO_DEPTH_WATCHER(0u);
343
344 GetCanvas().Scale({sx, sy, 1.0});
345 }
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:246

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

## ◆ setAntiAlias()

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

Definition at line 140 of file dl_dispatcher.cc.

140 {
141 AUTO_DEPTH_WATCHER(0u);
142
143 // Nothing to do because AA is implicit.
144 }

References AUTO_DEPTH_WATCHER.

## ◆ setBlendMode()

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

Definition at line 243 of file dl_dispatcher.cc.

243 {
244 AUTO_DEPTH_WATCHER(0u);
245
246 paint_.blend_mode = skia_conversions::ToBlendMode(dl_mode);
247 }
impeller::Paint::blend_mode
BlendMode blend_mode
Definition: paint.h:84

References AUTO_DEPTH_WATCHER, impeller::Paint::blend_mode, paint_, and impeller::skia_conversions::ToBlendMode().

## ◆ setColor()

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

Definition at line 167 of file dl_dispatcher.cc.

167 {
168 AUTO_DEPTH_WATCHER(0u);
169
170 paint_.color = skia_conversions::ToColor(color);
171 }
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 229 of file dl_dispatcher.cc.

229 {
230 AUTO_DEPTH_WATCHER(0u);
231
232 paint_.color_filter = filter;
233 }
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 222 of file dl_dispatcher.cc.

222 {
223 AUTO_DEPTH_WATCHER(0u);
224
225 paint_.color_source = source;
226 }
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 160 of file dl_dispatcher.cc.

160 {
161 AUTO_DEPTH_WATCHER(0u);
162
163 paint_.style = ToStyle(style);
164 }
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:146

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

## ◆ setImageFilter()

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

Definition at line 286 of file dl_dispatcher.cc.

286 {
287 AUTO_DEPTH_WATCHER(0u);
288
289 paint_.image_filter = filter;
290 }
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 236 of file dl_dispatcher.cc.

236 {
237 AUTO_DEPTH_WATCHER(0u);
238
239 paint_.invert_colors = invert;
240 }
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 263 of file dl_dispatcher.cc.

263 {
264 AUTO_DEPTH_WATCHER(0u);
265
266 // Needs https://github.com/flutter/flutter/issues/95434
267 if (filter == nullptr) {
268 paint_.mask_blur_descriptor = std::nullopt;
269 return;
270 }
271 switch (filter->type()) {
272 case flutter::DlMaskFilterType::kBlur: {
273 auto blur = filter->asBlur();
274
275 paint_.mask_blur_descriptor = {
276 .style = ToBlurStyle(blur->style()),
277 .sigma = Sigma(blur->sigma()),
278 .respect_ctm = blur->respectCTM(),
279 };
280 break;
281 }
282 }
283 }
impeller::ToBlurStyle
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
Definition: dl_dispatcher.cc:249
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 188 of file dl_dispatcher.cc.

188 {
189 AUTO_DEPTH_WATCHER(0u);
190
191 switch (cap) {
192 case flutter::DlStrokeCap::kButt:
193 paint_.stroke_cap = Cap::kButt;
194 break;
195 case flutter::DlStrokeCap::kRound:
196 paint_.stroke_cap = Cap::kRound;
197 break;
198 case flutter::DlStrokeCap::kSquare:
199 paint_.stroke_cap = Cap::kSquare;
200 break;
201 }
202 }
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 205 of file dl_dispatcher.cc.

205 {
206 AUTO_DEPTH_WATCHER(0u);
207
208 switch (join) {
209 case flutter::DlStrokeJoin::kMiter:
210 paint_.stroke_join = Join::kMiter;
211 break;
212 case flutter::DlStrokeJoin::kRound:
213 paint_.stroke_join = Join::kRound;
214 break;
215 case flutter::DlStrokeJoin::kBevel:
216 paint_.stroke_join = Join::kBevel;
217 break;
218 }
219 }
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 181 of file dl_dispatcher.cc.

181 {
182 AUTO_DEPTH_WATCHER(0u);
183
184 paint_.stroke_miter = limit;
185 }
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 174 of file dl_dispatcher.cc.

174 {
175 AUTO_DEPTH_WATCHER(0u);
176
177 paint_.stroke_width = width;
178 }

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

614 {
615 DlRect rect;
616
617 // We can't "optimize" a path into a rectangle if it's open.
618 bool closed;
619 if (path.IsRect(&rect, &closed) && closed) {
620 canvas.DrawRect(rect, paint);
621 return;
622 }
623
624 SkRRect rrect;
625 if (path.IsSkRRect(&rrect) && rrect.isSimple()) {
626 canvas.DrawRoundRect(flutter::ToDlRoundRect(rrect), paint);
627 return;
628 }
629
630 if (path.IsOval(&rect)) {
631 canvas.DrawOval(rect, paint);
632 return;
633 }
634
635 canvas.DrawPath(path.GetPath(), paint);
636 }

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

355 {
356 AUTO_DEPTH_WATCHER(0u);
357
358 GetCanvas().Skew(sx, sy);
359 }
impeller::Canvas::Skew
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:254

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

367 {
368 AUTO_DEPTH_WATCHER(0u);
369
370 // clang-format off
371 transformFullPerspective(
372 mxx, mxy, 0, mxt,
373 myx, myy, 0, myt,
374 0 , 0, 1, 0,
375 0 , 0, 0, 1
376 );
377 // clang-format on
378 }
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:381

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

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

413 {
414 AUTO_DEPTH_WATCHER(0u);
415
416 GetCanvas().ResetTransform();
417 GetCanvas().Transform(initial_matrix_);
418 }
impeller::Canvas::ResetTransform
void ResetTransform()
Definition: canvas.cc:230

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

334 {
335 AUTO_DEPTH_WATCHER(0u);
336
337 GetCanvas().Translate({tx, ty, 0.0});
338 }
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:242

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

## Member Data Documentation

## ◆ initial_matrix_

Matrix impeller::DlDispatcherBase::initial_matrix_
| protected

Definition at line 246 of file dl_dispatcher.h.

Referenced by drawDisplayList(), and transformReset().

## ◆ paint_

Paint impeller::DlDispatcherBase::paint_
| protected

Definition at line 245 of file dl_dispatcher.h.

Referenced by drawArc(), drawAtlas(), drawCircle(), drawDashedLine(), drawDiffRoundRect(), drawDisplayList(), drawImageNine(), drawImageRect(), drawLine(), drawOval(), drawPaint(), drawPath(), drawPoints(), drawRect(), drawRoundRect(), 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