| Flutter Impeller |

Public Member Functions | List of all members
impeller::DlDispatcher Class Referencefinal

`#include <dl_dispatcher.h>`

Inheritance diagram for impeller::DlDispatcher:

## Public Member Functions
| DlDispatcher ()
| DlDispatcher (Rect cull_rect)
| DlDispatcher (IRect cull_rect)
| ~DlDispatcher ()
Picture | EndRecordingAsPicture ()
bool | PrefersImpellerPaths () const override
void | setAntiAlias (bool aa) override
void | setDrawStyle (flutter::DlDrawStyle style) override
void | setColor (flutter::DlColor color) override
void | setStrokeWidth (SkScalar width) override
void | setStrokeMiter (SkScalar 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 | setPathEffect (const flutter::DlPathEffect *effect) override
void | setMaskFilter (const flutter::DlMaskFilter *filter) override
void | setImageFilter (const flutter::DlImageFilter *filter) override
void | save () override
void | saveLayer (const SkRect &bounds, const flutter::SaveLayerOptions options, const flutter::DlImageFilter *backdrop) override
void | restore () override
void | translate (SkScalar tx, SkScalar ty) override
void | scale (SkScalar sx, SkScalar sy) override
void | rotate (SkScalar degrees) override
void | skew (SkScalar sx, SkScalar sy) override
void | transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
void | transformFullPerspective (SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
void | transformReset () override
void | clipRect (const SkRect &rect, ClipOp clip_op, bool is_aa) override
void | clipRRect (const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
void | clipPath (const SkPath &path, ClipOp clip_op, bool is_aa) override
void | clipPath (const CacheablePath &cache, ClipOp clip_op, bool is_aa) override
void | drawColor (flutter::DlColor color, flutter::DlBlendMode mode) override
void | drawPaint () override
void | drawLine (const SkPoint &p0, const SkPoint &p1) override
void | drawRect (const SkRect &rect) override
void | drawOval (const SkRect &bounds) override
void | drawCircle (const SkPoint &center, SkScalar radius) override
void | drawRRect (const SkRRect &rrect) override
void | drawDRRect (const SkRRect &outer, const SkRRect &inner) override
void | drawPath (const SkPath &path) override
void | drawPath (const CacheablePath &cache) override
void | drawArc (const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
void | drawPoints (PointMode mode, uint32_t count, const SkPoint points[]) override
void | drawVertices (const flutter::DlVertices *vertices, flutter::DlBlendMode dl_mode) override
void | drawImage (const sk_sp< flutter::DlImage > image, const SkPoint point, flutter::DlImageSampling sampling, bool render_with_attributes) override
void | drawImageRect (const sk_sp< flutter::DlImage > image, const SkRect &src, const SkRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
void | drawImageNine (const sk_sp< flutter::DlImage > image, const SkIRect &center, const SkRect &dst, flutter::DlFilterMode filter, bool render_with_attributes) override
void | drawAtlas (const sk_sp< flutter::DlImage > atlas, const SkRSXform xform[], const SkRect tex[], const flutter::DlColor colors[], int count, flutter::DlBlendMode mode, flutter::DlImageSampling sampling, const SkRect *cull_rect, bool render_with_attributes) override
void | drawDisplayList (const sk_sp< flutter::DisplayList > display_list, SkScalar opacity) override
void | drawTextBlob (const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
void | drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
void | drawShadow (const SkPath &path, const flutter::DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
void | drawShadow (const CacheablePath &cache, const flutter::DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override

## Detailed Description

Definition at line 14 of file dl_dispatcher.h.

## Constructor & Destructor Documentation

## ◆ DlDispatcher() [1/3]

impeller::DlDispatcher::DlDispatcher | ( |  | ) |
| default

## ◆ DlDispatcher() [2/3]

impeller::DlDispatcher::DlDispatcher | ( | Rect | cull_rect | ) |
| explicit

Definition at line 41 of file dl_dispatcher.cc.

41 : canvas_(cull_rect) {}

## ◆ DlDispatcher() [3/3]

impeller::DlDispatcher::DlDispatcher | ( | IRect | cull_rect | ) |
| explicit

Definition at line 43 of file dl_dispatcher.cc.

43 : canvas_(cull_rect) {}

## ◆ ~DlDispatcher()

impeller::DlDispatcher::~DlDispatcher | ( |  | ) |
| default

## Member Function Documentation

## ◆ clipPath() [1/2]

void impeller::DlDispatcher::clipPath | ( | const CacheablePath & | cache,
|  | ClipOp | clip_op,
|  | bool | is_aa
| ) |  |
| override

Definition at line 759 of file dl_dispatcher.cc.

761 {
762 auto clip_op = ToClipOperation(sk_op);
763
764 SkRect rect;
765 if (cache.sk_path.isRect(&rect)) {
766 canvas_.ClipRect(skia_conversions::ToRect(rect), clip_op);
767 } else if (cache.sk_path.isOval(&rect)) {
768 canvas_.ClipOval(skia_conversions::ToRect(rect), clip_op);
769 } else {
770 SkRRect rrect;
771 if (cache.sk_path.isRRect(&rrect) && rrect.isSimple()) {
772 canvas_.ClipRRect(skia_conversions::ToRect(rrect.rect()),
773 skia_conversions::ToSize(rrect.getSimpleRadii()),
774 clip_op);
775 } else {
776 canvas_.ClipPath(GetOrCachePath(cache), clip_op);
777 }
778 }
779 }

References impeller::Canvas::ClipOval(), impeller::Canvas::ClipPath(), impeller::Canvas::ClipRect(), impeller::Canvas::ClipRRect(), impeller::ToClipOperation(), impeller::skia_conversions::ToRect(), and impeller::skia_conversions::ToSize().

## ◆ clipPath() [2/2]

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

Definition at line 747 of file dl_dispatcher.cc.

747 {
748 UNIMPLEMENTED;
749 }

References UNIMPLEMENTED.

## ◆ clipRect()

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

Definition at line 726 of file dl_dispatcher.cc.

726 {
727 canvas_.ClipRect(skia_conversions::ToRect(rect), ToClipOperation(clip_op));
728 }

References impeller::Canvas::ClipRect(), impeller::ToClipOperation(), and impeller::skia_conversions::ToRect().

## ◆ clipRRect()

void impeller::DlDispatcher::clipRRect | ( | const SkRRect & | rrect,
|  | ClipOp | clip_op,
|  | bool | is_aa
| ) |  |
| override

Definition at line 731 of file dl_dispatcher.cc.

731 {
732 auto clip_op = ToClipOperation(sk_op);
733 if (rrect.isRect()) {
734 canvas_.ClipRect(skia_conversions::ToRect(rrect.rect()), clip_op);
735 } else if (rrect.isOval()) {
736 canvas_.ClipOval(skia_conversions::ToRect(rrect.rect()), clip_op);
737 } else if (rrect.isSimple()) {
738 canvas_.ClipRRect(skia_conversions::ToRect(rrect.rect()),
739 skia_conversions::ToSize(rrect.getSimpleRadii()),
740 clip_op);
741 } else {
742 canvas_.ClipPath(skia_conversions::ToPath(rrect), clip_op);
743 }
744 }

References impeller::Canvas::ClipOval(), impeller::Canvas::ClipPath(), impeller::Canvas::ClipRect(), impeller::Canvas::ClipRRect(), impeller::ToClipOperation(), impeller::skia_conversions::ToPath(), impeller::skia_conversions::ToRect(), and impeller::skia_conversions::ToSize().

## ◆ drawArc()

void impeller::DlDispatcher::drawArc | ( | const SkRect & | oval_bounds,
|  | SkScalar | start_degrees,
|  | SkScalar | sweep_degrees,
|  | bool | use_center
| ) |  |
| override

Definition at line 873 of file dl_dispatcher.cc.

876 {
877 PathBuilder builder;
878 builder.AddArc(skia_conversions::ToRect(oval_bounds), Degrees(start_degrees),
879 Degrees(sweep_degrees), use_center);
880 canvas_.DrawPath(builder.TakePath(), paint_);
881 }

References impeller::PathBuilder::AddArc(), impeller::Canvas::DrawPath(), impeller::PathBuilder::TakePath(), and impeller::skia_conversions::ToRect().

## ◆ drawAtlas()

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

Definition at line 987 of file dl_dispatcher.cc.

995 {
996 canvas_.DrawAtlas(std::make_shared<Image>(atlas->impeller_texture()),
997 skia_conversions::ToRSXForms(xform, count),
998 skia_conversions::ToRects(tex, count),
999 ToColors(colors, count), ToBlendMode(mode),
1000 ToSamplerDescriptor(sampling),
1001 skia_conversions::ToRect(cull_rect), paint_);
1002 }

References impeller::Canvas::DrawAtlas(), impeller::ToBlendMode(), impeller::ToColors(), impeller::skia_conversions::ToRect(), impeller::skia_conversions::ToRects(), impeller::skia_conversions::ToRSXForms(), and impeller::ToSamplerDescriptor().

## ◆ drawCircle()

void impeller::DlDispatcher::drawCircle | ( | const SkPoint & | center,
|  | SkScalar | radius
| ) |  |
| override

Definition at line 812 of file dl_dispatcher.cc.

812 {
813 canvas_.DrawCircle(skia_conversions::ToPoint(center), radius, paint_);
814 }

References impeller::Canvas::DrawCircle(), and impeller::skia_conversions::ToPoint().

## ◆ drawColor()

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

Definition at line 782 of file dl_dispatcher.cc.

783 {
784 Paint paint;
785 paint.color = skia_conversions::ToColor(color);
786 paint.blend_mode = ToBlendMode(dl_mode);
787 canvas_.DrawPaint(paint);
788 }

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

## ◆ drawDisplayList()

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

Definition at line 1005 of file dl_dispatcher.cc.

1007 {
1008 // Save all values that must remain untouched after the operation.
1009 Paint saved_paint = paint_;
1010 Matrix saved_initial_matrix = initial_matrix_;
1011 int restore_count = canvas_.GetSaveCount();
1012
1013 // The display list may alter the clip, which must be restored to the current
1014 // clip at the end of playback.
1015 canvas_.Save();
1016
1017 // Establish a new baseline for interpreting the new DL.
1018 // Matrix and clip are left untouched, the current
1019 // transform is saved as the new base matrix, and paint
1020 // values are reset to defaults.
1021 initial_matrix_ = canvas_.GetCurrentTransform();
1022 paint_ = Paint();
1023
1024 // Handle passed opacity in the most brute-force way by using
1025 // a SaveLayer. If the display_list is able to inherit the
1026 // opacity, this could also be handled by modulating all of its
1027 // attribute settings (for example, color), by the indicated
1028 // opacity.
1029 if (opacity < SK_Scalar1) {
1030 Paint save_paint;
1031 save_paint.color = Color(0, 0, 0, opacity);
1032 canvas_.SaveLayer(save_paint);
1033 }
1034
1035 // TODO(131445): Remove this restriction if we can correctly cull with
1036 // perspective transforms.
1037 if (display_list->has_rtree() && !initial_matrix_.HasPerspective()) {
1038 // The canvas remembers the screen-space culling bounds clipped by
1039 // the surface and the history of clip calls. DisplayList can cull
1040 // the ops based on a rectangle expressed in its "destination bounds"
1041 // so we need the canvas to transform those into the current local
1042 // coordinate space into which the DisplayList will be rendered.
1043 auto cull_bounds = canvas_.GetCurrentLocalCullingBounds();
1044 if (cull_bounds.has_value()) {
1045 Rect cull_rect = cull_bounds.value();
1046 display_list->Dispatch(
1047 *this, SkRect::MakeLTRB(cull_rect.GetLeft(), cull_rect.GetTop(),
1048 cull_rect.GetRight(), cull_rect.GetBottom()));
1049 } else {
1050 display_list->Dispatch(*this);
1051 }
1052 } else {
1053 display_list->Dispatch(*this);
1054 }
1055
1056 // Restore all saved state back to what it was before we interpreted
1057 // the display_list
1058 canvas_.RestoreToCount(restore_count);
1059 initial_matrix_ = saved_initial_matrix;
1060 paint_ = saved_paint;
1061 }

References impeller::Paint::color, impeller::TRect< T >::GetBottom(), impeller::Canvas::GetCurrentLocalCullingBounds(), impeller::Canvas::GetCurrentTransform(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::Canvas::GetSaveCount(), impeller::TRect< T >::GetTop(), impeller::Matrix::HasPerspective(), impeller::Canvas::RestoreToCount(), impeller::Canvas::Save(), and impeller::Canvas::SaveLayer().

Referenced by impeller::testing::TEST_P().

## ◆ drawDRRect()

void impeller::DlDispatcher::drawDRRect | ( | const SkRRect & | outer,
|  | const SkRRect & | inner
| ) |  |
| override

Definition at line 827 of file dl_dispatcher.cc.

827 {
828 PathBuilder builder;
829 builder.AddPath(skia_conversions::ToPath(outer));
830 builder.AddPath(skia_conversions::ToPath(inner));
831 canvas_.DrawPath(builder.TakePath(FillType::kOdd), paint_);
832 }

References impeller::PathBuilder::AddPath(), impeller::Canvas::DrawPath(), impeller::kOdd, impeller::PathBuilder::TakePath(), and impeller::skia_conversions::ToPath().

## ◆ drawImage()

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

Definition at line 928 of file dl_dispatcher.cc.

931 {
932 if (!image) {
933 return;
934 }
935
936 auto texture = image->impeller_texture();
937 if (!texture) {
938 return;
939 }
940
941 const auto size = texture->GetSize();
942 const auto src = SkRect::MakeWH(size.width, size.height);
943 const auto dest =
944 SkRect::MakeXYWH(point.fX, point.fY, size.width, size.height);
945
946 drawImageRect(image, // image
947 src, // source rect
948 dest, // destination rect
949 sampling, // sampling options
950 render_with_attributes, // render with attributes
951 SrcRectConstraint::kStrict // constraint
952 );
953 }

References drawImageRect().

## ◆ drawImageNine()

void impeller::DlDispatcher::drawImageNine | ( | const sk_sp< flutter::DlImage > | image,
|  | const SkIRect & | center,
|  | const SkRect & | dst,
|  | flutter::DlFilterMode | filter,
|  | bool | render_with_attributes
| ) |  |
| override

Definition at line 973 of file dl_dispatcher.cc.

977 {
978 NinePatchConverter converter = {};
979 converter.DrawNinePatch(
980 std::make_shared<Image>(image->impeller_texture()),
981 Rect::MakeLTRB(center.fLeft, center.fTop, center.fRight, center.fBottom),
982 skia_conversions::ToRect(dst), ToSamplerDescriptor(filter), &canvas_,
983 &paint_);
984 }

References impeller::NinePatchConverter::DrawNinePatch(), impeller::TRect< Scalar >::MakeLTRB(), impeller::skia_conversions::ToRect(), and impeller::ToSamplerDescriptor().

## ◆ drawImageRect()

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

Definition at line 956 of file dl_dispatcher.cc.

962 {
963 canvas_.DrawImageRect(
964 std::make_shared<Image>(image->impeller_texture()), // image
965 skia_conversions::ToRect(src), // source rect
966 skia_conversions::ToRect(dst), // destination rect
967 render_with_attributes ? paint_ : Paint(), // paint
968 ToSamplerDescriptor(sampling) // sampling
969 );
970 }

References impeller::Canvas::DrawImageRect(), impeller::skia_conversions::ToRect(), and impeller::ToSamplerDescriptor().

Referenced by drawImage().

## ◆ drawLine()

void impeller::DlDispatcher::drawLine | ( | const SkPoint & | p0,
|  | const SkPoint & | p1
| ) |  |
| override

Definition at line 796 of file dl_dispatcher.cc.

796 {
797 canvas_.DrawLine(skia_conversions::ToPoint(p0), skia_conversions::ToPoint(p1),
798 paint_);
799 }

References impeller::Canvas::DrawLine(), and impeller::skia_conversions::ToPoint().

## ◆ drawOval()

void impeller::DlDispatcher::drawOval | ( | const SkRect & | bounds | ) |
| override

Definition at line 807 of file dl_dispatcher.cc.

807 {
808 canvas_.DrawOval(skia_conversions::ToRect(bounds), paint_);
809 }

References impeller::Canvas::DrawOval(), and impeller::skia_conversions::ToRect().

## ◆ drawPaint()

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

Definition at line 791 of file dl_dispatcher.cc.

791 {
792 canvas_.DrawPaint(paint_);
793 }

References impeller::Canvas::DrawPaint().

## ◆ drawPath() [1/2]

void impeller::DlDispatcher::drawPath | ( | const CacheablePath & | cache | ) |
| override

Definition at line 840 of file dl_dispatcher.cc.

840 {
841 SimplifyOrDrawPath(canvas_, cache, paint_);
842 }

## ◆ drawPath() [2/2]

void impeller::DlDispatcher::drawPath | ( | const SkPath & | path | ) |
| override

Definition at line 835 of file dl_dispatcher.cc.

835 {
836 UNIMPLEMENTED;
837 }

References UNIMPLEMENTED.

## ◆ drawPoints()

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

Definition at line 884 of file dl_dispatcher.cc.

886 {
887 Paint paint = paint_;
888 paint.style = Paint::Style::kStroke;
889 switch (mode) {
890 case flutter::DlCanvas::PointMode::kPoints: {
891 // Cap::kButt is also treated as a square.
892 auto point_style = paint.stroke_cap == Cap::kRound ? PointStyle::kRound
893 : PointStyle::kSquare;
894 auto radius = paint.stroke_width;
895 if (radius > 0) {
896 radius /= 2.0;
897 }
898 canvas_.DrawPoints(skia_conversions::ToPoints(points, count), radius,
899 paint, point_style);
900 } break;
901 case flutter::DlCanvas::PointMode::kLines:
902 for (uint32_t i = 1; i < count; i += 2) {
903 Point p0 = skia_conversions::ToPoint(points[i - 1]);
904 Point p1 = skia_conversions::ToPoint(points[i]);
905 canvas_.DrawLine(p0, p1, paint);
906 }
907 break;
908 case flutter::DlCanvas::PointMode::kPolygon:
909 if (count > 1) {
910 Point p0 = skia_conversions::ToPoint(points[0]);
911 for (uint32_t i = 1; i < count; i++) {
912 Point p1 = skia_conversions::ToPoint(points[i]);
913 canvas_.DrawLine(p0, p1, paint);
914 p0 = p1;
915 }
916 }
917 break;
918 }
919 }

References impeller::Canvas::DrawLine(), impeller::Canvas::DrawPoints(), impeller::kRound, impeller::kSquare, impeller::Paint::kStroke, impeller::Paint::stroke_cap, impeller::Paint::stroke_width, impeller::Paint::style, impeller::skia_conversions::ToPoint(), and impeller::skia_conversions::ToPoints().

## ◆ drawRect()

void impeller::DlDispatcher::drawRect | ( | const SkRect & | rect | ) |
| override

Definition at line 802 of file dl_dispatcher.cc.

802 {
803 canvas_.DrawRect(skia_conversions::ToRect(rect), paint_);
804 }

References impeller::Canvas::DrawRect(), and impeller::skia_conversions::ToRect().

## ◆ drawRRect()

void impeller::DlDispatcher::drawRRect | ( | const SkRRect & | rrect | ) |
| override

Definition at line 817 of file dl_dispatcher.cc.

817 {
818 if (rrect.isSimple()) {
819 canvas_.DrawRRect(skia_conversions::ToRect(rrect.rect()),
820 skia_conversions::ToSize(rrect.getSimpleRadii()), paint_);
821 } else {
822 canvas_.DrawPath(skia_conversions::ToPath(rrect), paint_);
823 }
824 }

References impeller::Canvas::DrawPath(), impeller::Canvas::DrawRRect(), impeller::skia_conversions::ToPath(), impeller::skia_conversions::ToRect(), and impeller::skia_conversions::ToSize().

## ◆ drawShadow() [1/2]

void impeller::DlDispatcher::drawShadow | ( | const CacheablePath & | cache,
|  | const flutter::DlColor | color,
|  | const SkScalar | elevation,
|  | bool | transparent_occluder,
|  | SkScalar | dpr
| ) |  |
| override

Definition at line 1091 of file dl_dispatcher.cc.

1095 {
1096 Color spot_color = skia_conversions::ToColor(color);
1097 spot_color.alpha *= 0.25;
1098
1099 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
1100 {
1101 Scalar max =
1102 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
1103 Scalar min =
1104 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
1105 Scalar luminance = (min + max) * 0.5;
1106
1107 Scalar alpha_adjust =
1108 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
1109 spot_color.alpha;
1110 Scalar color_alpha =
1111 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
1112 luminance;
1113 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
1114
1115 Scalar greyscale_alpha =
1116 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
1117
1118 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
1119 Scalar tonal_alpha = color_scale + greyscale_alpha;
1120 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
1121 spot_color = Color(unpremul_scale * spot_color.red,
1122 unpremul_scale * spot_color.green,
1123 unpremul_scale * spot_color.blue, tonal_alpha);
1124 }
1125
1126 Vector3 light_position(0, -1, 1);
1127 Scalar occluder_z = dpr * elevation;
1128
1129 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
1130
1131 Paint paint;
1132 paint.style = Paint::Style::kFill;
1133 paint.color = spot_color;
1134 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
1135 .style = FilterContents::BlurStyle::kNormal,
1136 .sigma = Radius{kLightRadius * occluder_z /
1137 canvas_.GetCurrentTransform().GetScale().y},
1138 };
1139
1140 canvas_.Save();
1141 canvas_.PreConcat(
1142 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
1143
1144 SimplifyOrDrawPath(canvas_, cache, paint);
1145
1146 canvas_.Restore();
1147 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Paint::color, 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(), impeller::Paint::MaskBlurDescriptor::style, impeller::Paint::style, impeller::skia_conversions::ToColor(), and impeller::Vector3::y.

## ◆ drawShadow() [2/2]

void impeller::DlDispatcher::drawShadow | ( | const SkPath & | path,
|  | const flutter::DlColor | color,
|  | const SkScalar | elevation,
|  | bool | transparent_occluder,
|  | SkScalar | dpr
| ) |  |
| override

Definition at line 1082 of file dl_dispatcher.cc.

1086 {
1087 UNIMPLEMENTED;
1088 }

References UNIMPLEMENTED.

Referenced by impeller::testing::TEST_P().

## ◆ drawTextBlob()

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

Definition at line 1064 of file dl_dispatcher.cc.

1066 {
1067 // When running with Impeller enabled Skia text blobs are converted to
1068 // Impeller text frames in paragraph_skia.cc
1069 UNIMPLEMENTED;
1070 }

References UNIMPLEMENTED.

## ◆ drawTextFrame()

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

Definition at line 1072 of file dl_dispatcher.cc.

1074 {
1075 canvas_.DrawTextFrame(text_frame, //
1076 impeller::Point{x, y}, //
1077 paint_ //
1078 );
1079 }

References impeller::Canvas::DrawTextFrame().

## ◆ drawVertices()

void impeller::DlDispatcher::drawVertices | ( | const flutter::DlVertices * | vertices,
|  | flutter::DlBlendMode | dl_mode
| ) |  |
| override

Definition at line 922 of file dl_dispatcher.cc.

923 {
924 canvas_.DrawVertices(MakeVertices(vertices), ToBlendMode(dl_mode), paint_);
925 }

References impeller::Canvas::DrawVertices(), impeller::MakeVertices(), and impeller::ToBlendMode().

## ◆ EndRecordingAsPicture()

Picture impeller::DlDispatcher::EndRecordingAsPicture | ( |  | ) |

Definition at line 1149 of file dl_dispatcher.cc.

1149 {
1150 TRACE_EVENT0("impeller", "DisplayListDispatcher::EndRecordingAsPicture");
1151 return canvas_.EndRecordingAsPicture();
1152 }

References impeller::Canvas::EndRecordingAsPicture().

Referenced by impeller::DlPlayground::OpenPlaygroundHere(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ PrefersImpellerPaths()

bool impeller::DlDispatcher::PrefersImpellerPaths | ( |  | ) | const
| inline override

Definition at line 27 of file dl_dispatcher.h.

27 { return true; }

## ◆ restore()

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

Definition at line 638 of file dl_dispatcher.cc.

638 {
639 canvas_.Restore();
640 }

References impeller::Canvas::Restore().

Referenced by impeller::testing::TEST_P().

## ◆ rotate()

void impeller::DlDispatcher::rotate | ( | SkScalar | degrees | ) |
| override

Definition at line 653 of file dl_dispatcher.cc.

653 {
654 canvas_.Rotate(Degrees{degrees});
655 }

References impeller::Canvas::Rotate().

## ◆ save()

void impeller::DlDispatcher::save | ( |  | ) |
| override

Definition at line 621 of file dl_dispatcher.cc.

621 {
622 canvas_.Save();
623 }

References impeller::Canvas::Save().

Referenced by impeller::testing::TEST_P().

## ◆ saveLayer()

void impeller::DlDispatcher::saveLayer | ( | const SkRect & | bounds,
|  | const flutter::SaveLayerOptions | options,
|  | const flutter::DlImageFilter * | backdrop
| ) |  |
| override

Definition at line 626 of file dl_dispatcher.cc.

628 {
629 auto paint = options.renders_with_attributes() ? paint_ : Paint{};
630 auto promise = options.content_is_clipped()
631 ? ContentBoundsPromise::kMayClipContents
632 : ContentBoundsPromise::kContainsContents;
633 canvas_.SaveLayer(paint, skia_conversions::ToRect(bounds),
634 ToImageFilter(backdrop), promise);
635 }

References impeller::kContainsContents, impeller::kMayClipContents, impeller::Canvas::SaveLayer(), impeller::ToImageFilter(), and impeller::skia_conversions::ToRect().

## ◆ scale()

void impeller::DlDispatcher::scale | ( | SkScalar | sx,
|  | SkScalar | sy
| ) |  |
| override

Definition at line 648 of file dl_dispatcher.cc.

648 {
649 canvas_.Scale({sx, sy, 1.0});
650 }

References impeller::Canvas::Scale().

Referenced by impeller::testing::TEST_P().

## ◆ setAntiAlias()

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

Definition at line 178 of file dl_dispatcher.cc.

178 {
179 // Nothing to do because AA is implicit.
180 }

## ◆ setBlendMode()

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

Definition at line 482 of file dl_dispatcher.cc.

482 {
483 paint_.blend_mode = ToBlendMode(dl_mode);
484 }

References impeller::Paint::blend_mode, and impeller::ToBlendMode().

## ◆ setColor()

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

Definition at line 201 of file dl_dispatcher.cc.

201 {
202 paint_.color = {
203 color.getRedF(),
204 color.getGreenF(),
205 color.getBlueF(),
206 color.getAlphaF(),
207 };
208 }

References impeller::Paint::color.

Referenced by setColorSource().

## ◆ setColorFilter()

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

Definition at line 472 of file dl_dispatcher.cc.

472 {
473 paint_.color_filter = ToColorFilter(filter);
474 }

References impeller::Paint::color_filter, and impeller::ToColorFilter().

## ◆ setColorSource()

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

Definition at line 286 of file dl_dispatcher.cc.

286 {
287 if (!source) {
288 paint_.color_source = ColorSource::MakeColor();
289 return;
290 }
291
292 std::optional<ColorSource::Type> type = ToColorSourceType(source->type());
293
294 if (!type.has_value()) {
295 FML_LOG(ERROR) << "Requested ColorSourceType::kUnknown";
296 paint_.color_source = ColorSource::MakeColor();
297 return;
298 }
299
300 switch (type.value()) {
301 case ColorSource::Type::kColor: {
302 const flutter::DlColorColorSource* color = source->asColor();
303
304 paint_.color_source = ColorSource::MakeColor();
305 setColor(color->color());
306 FML_DCHECK(color);
307 return;
308 }
309 case ColorSource::Type::kLinearGradient: {
310 const flutter::DlLinearGradientColorSource* linear =
311 source->asLinearGradient();
312 FML_DCHECK(linear);
313 auto start_point = skia_conversions::ToPoint(linear->start_point());
314 auto end_point = skia_conversions::ToPoint(linear->end_point());
315 std::vector<Color> colors;
316 std::vector<float> stops;
317 skia_conversions::ConvertStops(linear, colors, stops);
318
319 auto tile_mode = ToTileMode(linear->tile_mode());
320 auto matrix = ToMatrix(linear->matrix());
321
322 paint_.color_source = ColorSource::MakeLinearGradient(
323 start_point, end_point, std::move(colors), std::move(stops),
324 tile_mode, matrix);
325 return;
326 }
327 case ColorSource::Type::kConicalGradient: {
328 const flutter::DlConicalGradientColorSource* conical_gradient =
329 source->asConicalGradient();
330 FML_DCHECK(conical_gradient);
331 Point center = skia_conversions::ToPoint(conical_gradient->end_center());
332 SkScalar radius = conical_gradient->end_radius();
333 Point focus_center =
334 skia_conversions::ToPoint(conical_gradient->start_center());
335 SkScalar focus_radius = conical_gradient->start_radius();
336 std::vector<Color> colors;
337 std::vector<float> stops;
338 skia_conversions::ConvertStops(conical_gradient, colors, stops);
339
340 auto tile_mode = ToTileMode(conical_gradient->tile_mode());
341 auto matrix = ToMatrix(conical_gradient->matrix());
342
343 paint_.color_source = ColorSource::MakeConicalGradient(
344 center, radius, std::move(colors), std::move(stops), focus_center,
345 focus_radius, tile_mode, matrix);
346 return;
347 }
348 case ColorSource::Type::kRadialGradient: {
349 const flutter::DlRadialGradientColorSource* radialGradient =
350 source->asRadialGradient();
351 FML_DCHECK(radialGradient);
352 auto center = skia_conversions::ToPoint(radialGradient->center());
353 auto radius = radialGradient->radius();
354 std::vector<Color> colors;
355 std::vector<float> stops;
356 skia_conversions::ConvertStops(radialGradient, colors, stops);
357
358 auto tile_mode = ToTileMode(radialGradient->tile_mode());
359 auto matrix = ToMatrix(radialGradient->matrix());
360 paint_.color_source =
361 ColorSource::MakeRadialGradient(center, radius, std::move(colors),
362 std::move(stops), tile_mode, matrix);
363 return;
364 }
365 case ColorSource::Type::kSweepGradient: {
366 const flutter::DlSweepGradientColorSource* sweepGradient =
367 source->asSweepGradient();
368 FML_DCHECK(sweepGradient);
369
370 auto center = skia_conversions::ToPoint(sweepGradient->center());
371 auto start_angle = Degrees(sweepGradient->start());
372 auto end_angle = Degrees(sweepGradient->end());
373 std::vector<Color> colors;
374 std::vector<float> stops;
375 skia_conversions::ConvertStops(sweepGradient, colors, stops);
376
377 auto tile_mode = ToTileMode(sweepGradient->tile_mode());
378 auto matrix = ToMatrix(sweepGradient->matrix());
379 paint_.color_source = ColorSource::MakeSweepGradient(
380 center, start_angle, end_angle, std::move(colors), std::move(stops),
381 tile_mode, matrix);
382 return;
383 }
384 case ColorSource::Type::kImage: {
385 const flutter::DlImageColorSource* image_color_source = source->asImage();
386 FML_DCHECK(image_color_source &&
387 image_color_source->image()->impeller_texture());
388 auto texture = image_color_source->image()->impeller_texture();
389 auto x_tile_mode = ToTileMode(image_color_source->horizontal_tile_mode());
390 auto y_tile_mode = ToTileMode(image_color_source->vertical_tile_mode());
391 auto desc = ToSamplerDescriptor(image_color_source->sampling());
392 auto matrix = ToMatrix(image_color_source->matrix());
393 paint_.color_source = ColorSource::MakeImage(texture, x_tile_mode,
394 y_tile_mode, desc, matrix);
395 return;
396 }
397 case ColorSource::Type::kRuntimeEffect: {
398 const flutter::DlRuntimeEffectColorSource* runtime_effect_color_source =
399 source->asRuntimeEffect();
400 auto runtime_stage =
401 runtime_effect_color_source->runtime_effect()->runtime_stage();
402 auto uniform_data = runtime_effect_color_source->uniform_data();
403 auto samplers = runtime_effect_color_source->samplers();
404
405 std::vector<RuntimeEffectContents::TextureInput> texture_inputs;
406
407 for (auto& sampler : samplers) {
408 if (sampler == nullptr) {
409 return;
410 }
411 auto* image = sampler->asImage();
412 if (!sampler->asImage()) {
413 UNIMPLEMENTED;
414 return;
415 }
416 FML_DCHECK(image->image()->impeller_texture());
417 texture_inputs.push_back({
418 .sampler_descriptor = ToSamplerDescriptor(image->sampling()),
419 .texture = image->image()->impeller_texture(),
420 });
421 }
422
423 paint_.color_source = ColorSource::MakeRuntimeEffect(
424 runtime_stage, uniform_data, texture_inputs);
425 return;
426 }
427 case ColorSource::Type::kScene: {
428 #ifdef IMPELLER_ENABLE_3D
429 const flutter::DlSceneColorSource* scene_color_source = source->asScene();
430 std::shared_ptr<scene::Node> scene_node =
431 scene_color_source->scene_node();
432 Matrix camera_transform = scene_color_source->camera_matrix();
433
434 paint_.color_source =
435 ColorSource::MakeScene(scene_node, camera_transform);
436 #else // IMPELLER_ENABLE_3D
437 FML_LOG(ERROR) << "ColorSourceType::kScene can only be used if Impeller "
438 "Scene is enabled.";
439 #endif // IMPELLER_ENABLE_3D
440 return;
441 }
442 }
443 }

References impeller::Paint::color_source, impeller::skia_conversions::ConvertStops(), impeller::ColorSource::kColor, impeller::ColorSource::kConicalGradient, impeller::ColorSource::kImage, impeller::ColorSource::kLinearGradient, impeller::ColorSource::kRadialGradient, impeller::ColorSource::kRuntimeEffect, impeller::ColorSource::kScene, impeller::ColorSource::kSweepGradient, impeller::ColorSource::MakeColor(), impeller::ColorSource::MakeConicalGradient(), impeller::ColorSource::MakeImage(), impeller::ColorSource::MakeLinearGradient(), impeller::ColorSource::MakeRadialGradient(), impeller::ColorSource::MakeRuntimeEffect(), impeller::ColorSource::MakeSweepGradient(), setColor(), impeller::ToColorSourceType(), impeller::ToMatrix(), impeller::skia_conversions::ToPoint(), impeller::ToSamplerDescriptor(), impeller::ToTileMode(), and UNIMPLEMENTED.

## ◆ setDrawStyle()

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

Definition at line 196 of file dl_dispatcher.cc.

196 {
197 paint_.style = ToStyle(style);
198 }

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

## ◆ setImageFilter()

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

Definition at line 616 of file dl_dispatcher.cc.

616 {
617 paint_.image_filter = ToImageFilter(filter);
618 }

References impeller::Paint::image_filter, and impeller::ToImageFilter().

## ◆ setInvertColors()

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

Definition at line 477 of file dl_dispatcher.cc.

477 {
478 paint_.invert_colors = invert;
479 }

References impeller::Paint::invert_colors.

## ◆ setMaskFilter()

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

Definition at line 506 of file dl_dispatcher.cc.

506 {
507 // Needs https://github.com/flutter/flutter/issues/95434
508 if (filter == nullptr) {
509 paint_.mask_blur_descriptor = std::nullopt;
510 return;
511 }
512 switch (filter->type()) {
513 case flutter::DlMaskFilterType::kBlur: {
514 auto blur = filter->asBlur();
515
516 paint_.mask_blur_descriptor = {
517 .style = ToBlurStyle(blur->style()),
518 .sigma = Sigma(blur->sigma()),
519 };
520 break;
521 }
522 }
523 }

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

## ◆ setPathEffect()

void impeller::DlDispatcher::setPathEffect | ( | const flutter::DlPathEffect * | effect | ) |
| override

Definition at line 487 of file dl_dispatcher.cc.

487 {
488 // Needs https://github.com/flutter/flutter/issues/95434
489 UNIMPLEMENTED;
490 }

References UNIMPLEMENTED.

## ◆ setStrokeCap()

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

Definition at line 221 of file dl_dispatcher.cc.

221 {
222 switch (cap) {
223 case flutter::DlStrokeCap::kButt:
224 paint_.stroke_cap = Cap::kButt;
225 break;
226 case flutter::DlStrokeCap::kRound:
227 paint_.stroke_cap = Cap::kRound;
228 break;
229 case flutter::DlStrokeCap::kSquare:
230 paint_.stroke_cap = Cap::kSquare;
231 break;
232 }
233 }

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

## ◆ setStrokeJoin()

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

Definition at line 236 of file dl_dispatcher.cc.

236 {
237 switch (join) {
238 case flutter::DlStrokeJoin::kMiter:
239 paint_.stroke_join = Join::kMiter;
240 break;
241 case flutter::DlStrokeJoin::kRound:
242 paint_.stroke_join = Join::kRound;
243 break;
244 case flutter::DlStrokeJoin::kBevel:
245 paint_.stroke_join = Join::kBevel;
246 break;
247 }
248 }

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

## ◆ setStrokeMiter()

void impeller::DlDispatcher::setStrokeMiter | ( | SkScalar | limit | ) |
| override

Definition at line 216 of file dl_dispatcher.cc.

216 {
217 paint_.stroke_miter = limit;
218 }

References impeller::Paint::stroke_miter.

## ◆ setStrokeWidth()

void impeller::DlDispatcher::setStrokeWidth | ( | SkScalar | width | ) |
| override

Definition at line 211 of file dl_dispatcher.cc.

211 {
212 paint_.stroke_width = width;
213 }

References impeller::Paint::stroke_width.

## ◆ skew()

void impeller::DlDispatcher::skew | ( | SkScalar | sx,
|  | SkScalar | sy
| ) |  |
| override

Definition at line 658 of file dl_dispatcher.cc.

658 {
659 canvas_.Skew(sx, sy);
660 }

References impeller::Canvas::Skew().

## ◆ transform2DAffine()

void impeller::DlDispatcher::transform2DAffine | ( | SkScalar | mxx,
|  | SkScalar | mxy,
|  | SkScalar | mxt,
|  | SkScalar | myx,
|  | SkScalar | myy,
|  | SkScalar | myt
| ) |  |
| override

Definition at line 663 of file dl_dispatcher.cc.

668 {
669 // clang-format off
670 transformFullPerspective(
671 mxx, mxy, 0, mxt,
672 myx, myy, 0, myt,
673 0 , 0, 1, 0,
674 0 , 0, 0, 1
675 );
676 // clang-format on
677 }

References transformFullPerspective().

## ◆ transformFullPerspective()

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

Definition at line 680 of file dl_dispatcher.cc.

695 {
696 // The order of arguments is row-major but Impeller matrices are
697 // column-major.
698 // clang-format off
699 auto transform = Matrix{
700 mxx, myx, mzx, mwx,
701 mxy, myy, mzy, mwy,
702 mxz, myz, mzz, mwz,
703 mxt, myt, mzt, mwt
704 };
705 // clang-format on
706 canvas_.Transform(transform);
707 }

References impeller::Canvas::Transform().

Referenced by impeller::testing::TEST_P(), and transform2DAffine().

## ◆ transformReset()

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

Definition at line 710 of file dl_dispatcher.cc.

710 {
711 canvas_.ResetTransform();
712 canvas_.Transform(initial_matrix_);
713 }

References impeller::Canvas::ResetTransform(), and impeller::Canvas::Transform().

## ◆ translate()

void impeller::DlDispatcher::translate | ( | SkScalar | tx,
|  | SkScalar | ty
| ) |  |
| override

Definition at line 643 of file dl_dispatcher.cc.

643 {
644 canvas_.Translate({tx, ty, 0.0});
645 }

References impeller::Canvas::Translate().

Referenced by impeller::testing::TEST_P().

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

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

impeller::Paint::stroke_cap
Cap stroke_cap
Definition: paint.h:60
impeller::Matrix::HasPerspective
constexpr bool HasPerspective() const
Definition: matrix.h:321
impeller::Canvas::DrawPoints
void DrawPoints(std::vector< Point > points, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:683
impeller::Canvas::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: canvas.cc:756
impeller::Canvas::ClipOval
void ClipOval(const Rect &bounds, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:570
impeller::ColorSource::Type::kScene
@ kScene
impeller::ColorSource::Type::kLinearGradient
@ kLinearGradient
impeller::ToClipOperation
static Entity::ClipOperation ToClipOperation(flutter::DlCanvas::ClipOp clip_op)
Definition: dl_dispatcher.cc:715
impeller::Cap::kRound
@ kRound
impeller::Cap::kSquare
@ kSquare
impeller::Canvas::DrawRRect
void DrawRRect(const Rect &rect, const Size &corner_radii, const Paint &paint)
Definition: canvas.cc:488
impeller::DlDispatcher::drawImageRect
void drawImageRect(const sk_sp< flutter::DlImage > image, const SkRect &src, const SkRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
Definition: dl_dispatcher.cc:956
impeller::skia_conversions::ToPoints
std::vector< Point > ToPoints(const SkPoint points[], int count)
Definition: skia_conversions.cc:31
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Canvas::RestoreToCount
void RestoreToCount(size_t count)
Definition: canvas.cc:284
impeller::Canvas::DrawImageRect
void DrawImageRect(const std::shared_ptr< Image > &image, Rect source, Rect dest, const Paint &paint, SamplerDescriptor sampler={}, SourceRectConstraint src_rect_constraint=SourceRectConstraint::kFast)
Definition: canvas.cc:717
impeller::ContentBoundsPromise::kMayClipContents
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
impeller::ColorSource::Type::kRadialGradient
@ kRadialGradient
impeller::Paint::Style::kStroke
@ kStroke
impeller::skia_conversions::ConvertStops
void ConvertStops(const flutter::DlGradientColorSourceBase *gradient, std::vector< Color > &colors, std::vector< float > &stops)
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the st...
Definition: skia_conversions.cc:198
impeller::ColorSource::MakeLinearGradient
static ColorSource MakeLinearGradient(Point start_point, Point end_point, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:45
impeller::FillType::kOdd
@ kOdd
impeller::skia_conversions::ToSize
Size ToSize(const SkPoint &point)
Definition: skia_conversions.cc:144
impeller::Canvas::Skew
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:272
impeller::ToImageFilter
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
Definition: dl_dispatcher.cc:525
impeller::Paint::color
Color color
Definition: paint.h:55
impeller::Canvas::DrawTextFrame
void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:821
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::Vector2
Point Vector2
Definition: point.h:320
impeller::Canvas::ResetTransform
void ResetTransform()
Definition: canvas.cc:239
impeller::Canvas::DrawVertices
void DrawVertices(const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint)
Definition: canvas.cc:865
impeller::DlDispatcher::transformFullPerspective
void transformFullPerspective(SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
Definition: dl_dispatcher.cc:680
impeller::skia_conversions::ToRects
std::vector< Rect > ToRects(const SkRect tex[], int count)
Definition: skia_conversions.cc:23
impeller::MakeVertices
std::shared_ptr< impeller::VerticesGeometry > MakeVertices(const flutter::DlVertices *vertices)
Definition: dl_vertices_geometry.cc:31
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:148
impeller::ColorSource::MakeSweepGradient
static ColorSource MakeSweepGradient(Point center, Degrees start_angle, Degrees end_angle, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:138
impeller::ColorSource::MakeColor
static ColorSource MakeColor()
Definition: color_source.cc:41
impeller::ColorSource::MakeImage
static ColorSource MakeImage(std::shared_ptr< Texture > texture, Entity::TileMode x_tile_mode, Entity::TileMode y_tile_mode, SamplerDescriptor sampler_descriptor, Matrix effect_transform)
Definition: color_source.cc:163
impeller::FilterContents::BlurStyle::kNormal
@ kNormal
Blurred inside and outside.
impeller::Cap::kButt
@ kButt
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
impeller::Canvas::DrawLine
void DrawLine(const Point &p0, const Point &p1, const Paint &paint)
Definition: canvas.cc:430
impeller::Paint::color_source
ColorSource color_source
Definition: paint.h:56
impeller::Canvas::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: canvas.cc:441
impeller::Canvas::GetCurrentTransform
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:247
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:36
impeller::ToTileMode
static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode)
Definition: dl_dispatcher.cc:111
impeller::Join::kMiter
@ kMiter
impeller::Canvas::SaveLayer
void SaveLayer(const Paint &paint, std::optional< Rect > bounds=std::nullopt, const std::shared_ptr< ImageFilter > &backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown)
Definition: canvas.cc:786
impeller::Paint::stroke_miter
Scalar stroke_miter
Definition: paint.h:62
impeller::ToMatrix
static Matrix ToMatrix(const SkMatrix &m)
Definition: dl_dispatcher.cc:166
impeller::ToColors
static std::vector< Color > ToColors(const flutter::DlColor colors[], int count)
Definition: dl_dispatcher.cc:250
impeller::skia_conversions::ToRect
Rect ToRect(const SkRect &rect)
Definition: skia_conversions.cc:12
impeller::Paint::color_filter
std::shared_ptr< ColorFilter > color_filter
Definition: paint.h:68
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::Point
TPoint< Scalar > Point
Definition: point.h:316
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:264
impeller::Matrix::GetScale
constexpr Vector3 GetScale() const
Definition: matrix.h:306
impeller::ColorSource::MakeConicalGradient
static ColorSource MakeConicalGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Point focus_center, Scalar focus_radius, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:74
impeller::Canvas::Save
void Save()
Definition: canvas.cc:136
impeller::ColorSource::Type::kRuntimeEffect
@ kRuntimeEffect
impeller::Paint::style
Style style
Definition: paint.h:63
impeller::Paint::Style::kFill
@ kFill
impeller::ToColorSourceType
static std::optional< ColorSource::Type > ToColorSourceType(flutter::DlColorSourceType type)
Definition: dl_dispatcher.cc:261
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:515
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:182
impeller::Canvas::Restore
bool Restore()
Definition: canvas.cc:208
impeller::Canvas::DrawAtlas
void DrawAtlas(const std::shared_ptr< Image > &atlas, std::vector< Matrix > transforms, std::vector< Rect > texture_coordinates, std::vector< Color > colors, BlendMode blend_mode, SamplerDescriptor sampler, std::optional< Rect > cull_rect, const Paint &paint)
Definition: canvas.cc:925
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:292
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:302
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:661
impeller::ToBlurStyle
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
Definition: dl_dispatcher.cc:492
impeller::Join::kRound
@ kRound
impeller::Canvas::GetSaveCount
size_t GetSaveCount() const
Definition: canvas.cc:280
impeller::Vector3::y
Scalar y
Definition: vector.h:24
impeller::skia_conversions::ToPoint
Point ToPoint(const SkPoint &point)
Definition: skia_conversions.cc:140
impeller::ColorSource::MakeRadialGradient
static ColorSource MakeRadialGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:108
impeller::Canvas::ClipRRect
void ClipRRect(const Rect &rect, const Size &corner_radii, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:590
impeller::Canvas::PreConcat
void PreConcat(const Matrix &transform)
Definition: canvas.cc:235
impeller::Join::kBevel
@ kBevel
impeller::ColorSource::Type::kImage
@ kImage
impeller::ColorSource::MakeRuntimeEffect
static ColorSource MakeRuntimeEffect(std::shared_ptr< RuntimeStage > runtime_stage, std::shared_ptr< std::vector< uint8_t >> uniform_data, std::vector< RuntimeEffectContents::TextureInput > texture_inputs)
Definition: color_source.cc:193
impeller::Canvas::DrawOval
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:461
impeller::Canvas::Rotate
void Rotate(Radians radians)
Definition: canvas.cc:276
impeller::ColorSource::Type::kConicalGradient
@ kConicalGradient
impeller::TPoint< Scalar >
impeller::Canvas::Transform
void Transform(const Matrix &transform)
Definition: canvas.cc:243
impeller::skia_conversions::ToRSXForms
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
Definition: skia_conversions.cc:157
impeller::Paint::invert_colors
bool invert_colors
Definition: paint.h:65
impeller::DlDispatcher::setColor
void setColor(flutter::DlColor color) override
Definition: dl_dispatcher.cc:201
impeller::Canvas::GetCurrentLocalCullingBounds
const std::optional< Rect > GetCurrentLocalCullingBounds() const
Definition: canvas.cc:251
impeller::ToBlendMode
static BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: dl_dispatcher.cc:47
impeller::Canvas::ClipRect
void ClipRect(const Rect &rect, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:549
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Definition: dl_dispatcher.cc:124
impeller::TRect< Scalar >::MakeLTRB
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:129
impeller::ToColorFilter
static std::shared_ptr< ColorFilter > ToColorFilter(const flutter::DlColorFilter *filter)
Definition: dl_dispatcher.cc:445
impeller::ColorSource::Type::kSweepGradient
@ kSweepGradient
impeller::ContentBoundsPromise::kContainsContents
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
impeller::Paint::mask_blur_descriptor
std::optional< MaskBlurDescriptor > mask_blur_descriptor
Definition: paint.h:69
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:59
impeller::skia_conversions::ToPath
Path ToPath(const SkPath &path, Point shift)
Definition: skia_conversions.cc:49
impeller::ColorSource::Type::kColor
@ kColor
impeller::Paint::blend_mode
BlendMode blend_mode
Definition: paint.h:64
impeller::Paint::image_filter
std::shared_ptr< ImageFilter > image_filter
Definition: paint.h:67
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:61
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:260
impeller::Canvas::ClipPath
void ClipPath(const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:539