| 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 ()
void | setAntiAlias (bool aa) override
void | setDither (bool dither) 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 | 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 | 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

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

49 : canvas_(cull_rect) {}

## ◆ DlDispatcher() [3/3]

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

Definition at line 51 of file dl_dispatcher.cc.

51 : canvas_(cull_rect) {}

## ◆ ~DlDispatcher()

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

## Member Function Documentation

## ◆ clipPath()

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

Definition at line 752 of file dl_dispatcher.cc.

752 {
753 canvas_.ClipPath(skia_conversions::ToPath(path), ToClipOperation(clip_op));
754 }

References impeller::Canvas::ClipPath(), impeller::ToClipOperation(), and impeller::skia_conversions::ToPath().

## ◆ clipRect()

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

Definition at line 737 of file dl_dispatcher.cc.

737 {
738 canvas_.ClipRect(skia_conversions::ToRect(rect), ToClipOperation(clip_op));
739 }

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

742 {
743 if (rrect.isSimple()) {
744 canvas_.ClipRRect(skia_conversions::ToRect(rrect.rect()),
745 rrect.getSimpleRadii().fX, ToClipOperation(clip_op));
746 } else {
747 canvas_.ClipPath(skia_conversions::ToPath(rrect), ToClipOperation(clip_op));
748 }
749 }

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

## ◆ drawArc()

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

Definition at line 853 of file dl_dispatcher.cc.

856 {
857 PathBuilder builder;
858 builder.AddArc(skia_conversions::ToRect(oval_bounds), Degrees(start_degrees),
859 Degrees(sweep_degrees), use_center);
860 canvas_.DrawPath(builder.TakePath(), paint_);
861 }

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

977 {
978 canvas_.DrawAtlas(std::make_shared<Image>(atlas->impeller_texture()),
979 skia_conversions::ToRSXForms(xform, count),
980 skia_conversions::ToRects(tex, count),
981 ToColors(colors, count), ToBlendMode(mode),
982 ToSamplerDescriptor(sampling),
983 skia_conversions::ToRect(cull_rect), paint_);
984 }

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

802 {
803 canvas_.DrawCircle(skia_conversions::ToPoint(center), radius, paint_);
804 }

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

## ◆ drawColor()

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

Definition at line 757 of file dl_dispatcher.cc.

758 {
759 Paint paint;
760 paint.color = skia_conversions::ToColor(color);
761 paint.blend_mode = ToBlendMode(dl_mode);
762 canvas_.DrawPaint(paint);
763 }

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

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

References impeller::Paint::color, impeller::TRect< T >::GetBottom(), impeller::Canvas::GetCurrentLocalCullingBounds(), impeller::Canvas::GetCurrentTransformation(), 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 817 of file dl_dispatcher.cc.

817 {
818 PathBuilder builder;
819 builder.AddPath(skia_conversions::ToPath(outer));
820 builder.AddPath(skia_conversions::ToPath(inner));
821 canvas_.DrawPath(builder.TakePath(FillType::kOdd), paint_);
822 }

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

913 {
914 if (!image) {
915 return;
916 }
917
918 auto texture = image->impeller_texture();
919 if (!texture) {
920 return;
921 }
922
923 const auto size = texture->GetSize();
924 const auto src = SkRect::MakeWH(size.width, size.height);
925 const auto dest =
926 SkRect::MakeXYWH(point.fX, point.fY, size.width, size.height);
927
928 drawImageRect(image, // image
929 src, // source rect
930 dest, // destination rect
931 sampling, // sampling options
932 render_with_attributes, // render with attributes
933 SrcRectConstraint::kStrict // constraint
934 );
935 }

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

959 {
960 NinePatchConverter converter = {};
961 converter.DrawNinePatch(
962 std::make_shared<Image>(image->impeller_texture()),
963 Rect::MakeLTRB(center.fLeft, center.fTop, center.fRight, center.fBottom),
964 skia_conversions::ToRect(dst), ToSamplerDescriptor(filter), &canvas_,
965 &paint_);
966 }

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

944 {
945 canvas_.DrawImageRect(
946 std::make_shared<Image>(image->impeller_texture()), // image
947 skia_conversions::ToRect(src), // source rect
948 skia_conversions::ToRect(dst), // destination rect
949 render_with_attributes ? paint_ : Paint(), // paint
950 ToSamplerDescriptor(sampling) // sampling
951 );
952 }

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

771 {
772 auto path =
773 PathBuilder{}
774 .AddLine(skia_conversions::ToPoint(p0), skia_conversions::ToPoint(p1))
775 .SetConvexity(Convexity::kConvex)
776 .TakePath();
777 Paint paint = paint_;
778 paint.style = Paint::Style::kStroke;
779 canvas_.DrawPath(path, paint);
780 }

References impeller::PathBuilder::AddLine(), impeller::Canvas::DrawPath(), impeller::kConvex, impeller::Paint::kStroke, impeller::PathBuilder::SetConvexity(), impeller::Paint::style, impeller::PathBuilder::TakePath(), and impeller::skia_conversions::ToPoint().

## ◆ drawOval()

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

Definition at line 788 of file dl_dispatcher.cc.

788 {
789 if (bounds.width() == bounds.height()) {
790 canvas_.DrawCircle(skia_conversions::ToPoint(bounds.center()),
791 bounds.width() * 0.5, paint_);
792 } else {
793 auto path = PathBuilder{}
794 .AddOval(skia_conversions::ToRect(bounds))
795 .SetConvexity(Convexity::kConvex)
796 .TakePath();
797 canvas_.DrawPath(path, paint_);
798 }
799 }

References impeller::PathBuilder::AddOval(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawPath(), impeller::kConvex, impeller::PathBuilder::SetConvexity(), impeller::PathBuilder::TakePath(), impeller::skia_conversions::ToPoint(), and impeller::skia_conversions::ToRect().

## ◆ drawPaint()

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

Definition at line 766 of file dl_dispatcher.cc.

766 {
767 canvas_.DrawPaint(paint_);
768 }

References impeller::Canvas::DrawPaint().

## ◆ drawPath()

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

Definition at line 825 of file dl_dispatcher.cc.

825 {
826 SkRect rect;
827
828 // We can't "optimize" a path into a rectangle if it's open.
829 bool closed;
830 if (path.isRect(&rect, &closed) && closed) {
831 canvas_.DrawRect(skia_conversions::ToRect(rect), paint_);
832 return;
833 }
834
835 SkRRect rrect;
836 if (path.isRRect(&rrect) && rrect.isSimple()) {
837 canvas_.DrawRRect(skia_conversions::ToRect(rrect.rect()),
838 rrect.getSimpleRadii().fX, paint_);
839 return;
840 }
841
842 SkRect oval;
843 if (path.isOval(&oval) && oval.width() == oval.height()) {
844 canvas_.DrawCircle(skia_conversions::ToPoint(oval.center()),
845 oval.width() * 0.5, paint_);
846 return;
847 }
848
849 canvas_.DrawPath(skia_conversions::ToPath(path), paint_);
850 }

References impeller::Canvas::DrawCircle(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::skia_conversions::ToPath(), impeller::skia_conversions::ToPoint(), and impeller::skia_conversions::ToRect().

## ◆ drawPoints()

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

Definition at line 864 of file dl_dispatcher.cc.

866 {
867 Paint paint = paint_;
868 paint.style = Paint::Style::kStroke;
869 switch (mode) {
870 case flutter::DlCanvas::PointMode::kPoints: {
871 // Cap::kButt is also treated as a square.
872 auto point_style = paint.stroke_cap == Cap::kRound ? PointStyle::kRound
873 : PointStyle::kSquare;
874 auto radius = paint.stroke_width;
875 if (radius > 0) {
876 radius /= 2.0;
877 }
878 canvas_.DrawPoints(skia_conversions::ToPoints(points, count), radius,
879 paint, point_style);
880 } break;
881 case flutter::DlCanvas::PointMode::kLines:
882 for (uint32_t i = 1; i < count; i += 2) {
883 Point p0 = skia_conversions::ToPoint(points[i - 1]);
884 Point p1 = skia_conversions::ToPoint(points[i]);
885 auto path = PathBuilder{}.AddLine(p0, p1).TakePath();
886 canvas_.DrawPath(path, paint);
887 }
888 break;
889 case flutter::DlCanvas::PointMode::kPolygon:
890 if (count > 1) {
891 Point p0 = skia_conversions::ToPoint(points[0]);
892 for (uint32_t i = 1; i < count; i++) {
893 Point p1 = skia_conversions::ToPoint(points[i]);
894 auto path = PathBuilder{}.AddLine(p0, p1).TakePath();
895 canvas_.DrawPath(path, paint);
896 p0 = p1;
897 }
898 }
899 break;
900 }
901 }

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

## ◆ drawRect()

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

Definition at line 783 of file dl_dispatcher.cc.

783 {
784 canvas_.DrawRect(skia_conversions::ToRect(rect), paint_);
785 }

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

## ◆ drawRRect()

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

Definition at line 807 of file dl_dispatcher.cc.

807 {
808 if (rrect.isSimple()) {
809 canvas_.DrawRRect(skia_conversions::ToRect(rrect.rect()),
810 rrect.getSimpleRadii().fX, paint_);
811 } else {
812 canvas_.DrawPath(skia_conversions::ToPath(rrect), paint_);
813 }
814 }

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

## ◆ drawShadow()

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

Definition at line 1064 of file dl_dispatcher.cc.

1068 {
1069 Color spot_color = skia_conversions::ToColor(color);
1070 spot_color.alpha *= 0.25;
1071
1072 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
1073 {
1074 Scalar max =
1075 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
1076 Scalar min =
1077 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
1078 Scalar luminance = (min + max) * 0.5;
1079
1080 Scalar alpha_adjust =
1081 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
1082 spot_color.alpha;
1083 Scalar color_alpha =
1084 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
1085 luminance;
1086 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
1087
1088 Scalar greyscale_alpha =
1089 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
1090
1091 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
1092 Scalar tonal_alpha = color_scale + greyscale_alpha;
1093 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
1094 spot_color = Color(unpremul_scale * spot_color.red,
1095 unpremul_scale * spot_color.green,
1096 unpremul_scale * spot_color.blue, tonal_alpha);
1097 }
1098
1099 Vector3 light_position(0, -1, 1);
1100 Scalar occluder_z = dpr * elevation;
1101
1102 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
1103
1104 Paint paint;
1105 paint.style = Paint::Style::kFill;
1106 paint.color = spot_color;
1107 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
1108 .style = FilterContents::BlurStyle::kNormal,
1109 .sigma = Radius{kLightRadius * occluder_z /
1110 canvas_.GetCurrentTransformation().GetScale().y},
1111 };
1112
1113 canvas_.Save();
1114 canvas_.PreConcat(
1115 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
1116
1117 SkRect rect;
1118 SkRRect rrect;
1119 SkRect oval;
1120 if (path.isRect(&rect)) {
1121 canvas_.DrawRect(skia_conversions::ToRect(rect), paint);
1122 } else if (path.isRRect(&rrect) && rrect.isSimple()) {
1123 canvas_.DrawRRect(skia_conversions::ToRect(rrect.rect()),
1124 rrect.getSimpleRadii().fX, paint);
1125 } else if (path.isOval(&oval) && oval.width() == oval.height()) {
1126 canvas_.DrawCircle(skia_conversions::ToPoint(oval.center()),
1127 oval.width() * 0.5, paint);
1128 } else {
1129 canvas_.DrawPath(skia_conversions::ToPath(path), paint);
1130 }
1131
1132 canvas_.Restore();
1133 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Paint::color, impeller::Canvas::DrawCircle(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::Canvas::GetCurrentTransformation(), 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(), impeller::skia_conversions::ToPath(), impeller::skia_conversions::ToPoint(), impeller::skia_conversions::ToRect(), and impeller::Vector3::y.

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

## ◆ drawTextBlob()

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

Definition at line 1046 of file dl_dispatcher.cc.

1048 {
1049 // When running with Impeller enabled Skia text blobs are converted to
1050 // Impeller text frames in paragraph_skia.cc
1051 UNIMPLEMENTED;
1052 }

References UNIMPLEMENTED.

## ◆ drawTextFrame()

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

Definition at line 1054 of file dl_dispatcher.cc.

1056 {
1057 canvas_.DrawTextFrame(text_frame, //
1058 impeller::Point{x, y}, //
1059 paint_ //
1060 );
1061 }

References impeller::Canvas::DrawTextFrame().

## ◆ drawVertices()

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

Definition at line 904 of file dl_dispatcher.cc.

905 {
906 canvas_.DrawVertices(MakeVertices(vertices), ToBlendMode(dl_mode), paint_);
907 }

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

## ◆ EndRecordingAsPicture()

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

Definition at line 1135 of file dl_dispatcher.cc.

1135 {
1136 TRACE_EVENT0("impeller", "DisplayListDispatcher::EndRecordingAsPicture");
1137 return canvas_.EndRecordingAsPicture();
1138 }

References impeller::Canvas::EndRecordingAsPicture().

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

## ◆ restore()

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

Definition at line 649 of file dl_dispatcher.cc.

649 {
650 canvas_.Restore();
651 }

References impeller::Canvas::Restore().

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

## ◆ rotate()

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

Definition at line 664 of file dl_dispatcher.cc.

664 {
665 canvas_.Rotate(Degrees{degrees});
666 }

References impeller::Canvas::Rotate().

## ◆ save()

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

Definition at line 635 of file dl_dispatcher.cc.

635 {
636 canvas_.Save();
637 }

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

642 {
643 auto paint = options.renders_with_attributes() ? paint_ : Paint{};
644 canvas_.SaveLayer(paint, skia_conversions::ToRect(bounds),
645 ToImageFilter(backdrop));
646 }

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

## ◆ scale()

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

Definition at line 659 of file dl_dispatcher.cc.

659 {
660 canvas_.Scale({sx, sy, 1.0});
661 }

References impeller::Canvas::Scale().

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

## ◆ setAntiAlias()

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

Definition at line 186 of file dl_dispatcher.cc.

186 {
187 // Nothing to do because AA is implicit.
188 }

## ◆ setBlendMode()

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

Definition at line 496 of file dl_dispatcher.cc.

496 {
497 paint_.blend_mode = ToBlendMode(dl_mode);
498 }

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

## ◆ setColor()

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

Definition at line 214 of file dl_dispatcher.cc.

214 {
215 paint_.color = {
216 color.getRedF(),
217 color.getGreenF(),
218 color.getBlueF(),
219 color.getAlphaF(),
220 };
221 }

References impeller::Paint::color.

Referenced by setColorSource().

## ◆ setColorFilter()

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

Definition at line 485 of file dl_dispatcher.cc.

485 {
486 // Needs https://github.com/flutter/flutter/issues/95434
487 paint_.color_filter = ToColorFilter(filter);
488 }

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

## ◆ setColorSource()

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

Definition at line 299 of file dl_dispatcher.cc.

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

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.

## ◆ setDither()

void impeller::DlDispatcher::setDither | ( | bool | dither | ) |
| override

Definition at line 191 of file dl_dispatcher.cc.

191 {
192 paint_.dither = dither;
193 }

References impeller::Paint::dither.

## ◆ setDrawStyle()

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

Definition at line 209 of file dl_dispatcher.cc.

209 {
210 paint_.style = ToStyle(style);
211 }

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

## ◆ setImageFilter()

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

Definition at line 630 of file dl_dispatcher.cc.

630 {
631 paint_.image_filter = ToImageFilter(filter);
632 }

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

## ◆ setInvertColors()

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

Definition at line 491 of file dl_dispatcher.cc.

491 {
492 paint_.invert_colors = invert;
493 }

References impeller::Paint::invert_colors.

## ◆ setMaskFilter()

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

Definition at line 520 of file dl_dispatcher.cc.

520 {
521 // Needs https://github.com/flutter/flutter/issues/95434
522 if (filter == nullptr) {
523 paint_.mask_blur_descriptor = std::nullopt;
524 return;
525 }
526 switch (filter->type()) {
527 case flutter::DlMaskFilterType::kBlur: {
528 auto blur = filter->asBlur();
529
530 paint_.mask_blur_descriptor = {
531 .style = ToBlurStyle(blur->style()),
532 .sigma = Sigma(blur->sigma()),
533 };
534 break;
535 }
536 }
537 }

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

## ◆ setPathEffect()

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

Definition at line 501 of file dl_dispatcher.cc.

501 {
502 // Needs https://github.com/flutter/flutter/issues/95434
503 UNIMPLEMENTED;
504 }

References UNIMPLEMENTED.

## ◆ setStrokeCap()

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

Definition at line 234 of file dl_dispatcher.cc.

234 {
235 switch (cap) {
236 case flutter::DlStrokeCap::kButt:
237 paint_.stroke_cap = Cap::kButt;
238 break;
239 case flutter::DlStrokeCap::kRound:
240 paint_.stroke_cap = Cap::kRound;
241 break;
242 case flutter::DlStrokeCap::kSquare:
243 paint_.stroke_cap = Cap::kSquare;
244 break;
245 }
246 }

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

## ◆ setStrokeJoin()

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

Definition at line 249 of file dl_dispatcher.cc.

249 {
250 switch (join) {
251 case flutter::DlStrokeJoin::kMiter:
252 paint_.stroke_join = Join::kMiter;
253 break;
254 case flutter::DlStrokeJoin::kRound:
255 paint_.stroke_join = Join::kRound;
256 break;
257 case flutter::DlStrokeJoin::kBevel:
258 paint_.stroke_join = Join::kBevel;
259 break;
260 }
261 }

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

## ◆ setStrokeMiter()

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

Definition at line 229 of file dl_dispatcher.cc.

229 {
230 paint_.stroke_miter = limit;
231 }

References impeller::Paint::stroke_miter.

## ◆ setStrokeWidth()

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

Definition at line 224 of file dl_dispatcher.cc.

224 {
225 paint_.stroke_width = width;
226 }

References impeller::Paint::stroke_width.

## ◆ skew()

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

Definition at line 669 of file dl_dispatcher.cc.

669 {
670 canvas_.Skew(sx, sy);
671 }

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

679 {
680 // clang-format off
681 transformFullPerspective(
682 mxx, mxy, 0, mxt,
683 myx, myy, 0, myt,
684 0 , 0, 1, 0,
685 0 , 0, 0, 1
686 );
687 // clang-format on
688 }

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

706 {
707 // The order of arguments is row-major but Impeller matrices are
708 // column-major.
709 // clang-format off
710 auto xformation = Matrix{
711 mxx, myx, mzx, mwx,
712 mxy, myy, mzy, mwy,
713 mxz, myz, mzz, mwz,
714 mxt, myt, mzt, mwt
715 };
716 // clang-format on
717 canvas_.Transform(xformation);
718 }

References impeller::Canvas::Transform().

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

## ◆ transformReset()

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

Definition at line 721 of file dl_dispatcher.cc.

721 {
722 canvas_.ResetTransform();
723 canvas_.Transform(initial_matrix_);
724 }

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

## ◆ translate()

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

Definition at line 654 of file dl_dispatcher.cc.

654 {
655 canvas_.Translate({tx, ty, 0.0});
656 }

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:59
impeller::Matrix::HasPerspective
constexpr bool HasPerspective() const
Definition: matrix.h:316
impeller::Canvas::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: canvas.cc:513
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:726
impeller::Cap::kRound
@ kRound
impeller::Cap::kSquare
@ kSquare
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:938
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:15
impeller::Canvas::RestoreToCount
void RestoreToCount(size_t count)
Definition: canvas.cc:165
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:192
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::Canvas::Skew
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:153
impeller::ToImageFilter
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
Definition: dl_dispatcher.cc:539
impeller::Paint::color
Color color
Definition: paint.h:54
impeller::Canvas::DrawTextFrame
void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:549
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::Vector2
Point Vector2
Definition: point.h:310
impeller::Canvas::ResetTransform
void ResetTransform()
Definition: canvas.cc:120
impeller::Canvas::DrawVertices
void DrawVertices(const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint)
Definition: canvas.cc:592
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:691
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:142
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:141
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:167
impeller::FilterContents::BlurStyle::kNormal
@ kNormal
Blurred inside and outside.
impeller::Canvas::SaveLayer
void SaveLayer(const Paint &paint, std::optional< Rect > bounds=std::nullopt, const std::shared_ptr< ImageFilter > &backdrop_filter=nullptr)
Definition: canvas.cc:532
impeller::Cap::kButt
@ kButt
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:94
impeller::Paint::color_source
ColorSource color_source
Definition: paint.h:55
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:44
impeller::ToTileMode
static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode)
Definition: dl_dispatcher.cc:119
impeller::Join::kMiter
@ kMiter
impeller::Paint::stroke_miter
Scalar stroke_miter
Definition: paint.h:61
impeller::ToMatrix
static Matrix ToMatrix(const SkMatrix &m)
Definition: dl_dispatcher.cc:174
impeller::ToColors
static std::vector< Color > ToColors(const flutter::DlColor colors[], int count)
Definition: dl_dispatcher.cc:263
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:67
impeller::Canvas::DrawImageRect
void DrawImageRect(const std::shared_ptr< Image > &image, Rect source, Rect dest, const Paint &paint, SamplerDescriptor sampler={})
Definition: canvas.cc:482
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::Point
TPoint< Scalar > Point
Definition: point.h:306
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:145
impeller::Matrix::GetScale
constexpr Vector3 GetScale() const
Definition: matrix.h:301
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:75
impeller::Canvas::Save
void Save()
Definition: canvas.cc:55
impeller::ColorSource::Type::kRuntimeEffect
@ kRuntimeEffect
impeller::Paint::style
Style style
Definition: paint.h:62
impeller::Canvas::DrawCircle
void DrawCircle(Point center, Scalar radius, const Paint &paint)
Definition: canvas.cc:271
impeller::Paint::Style::kFill
@ kFill
impeller::ToColorSourceType
static std::optional< ColorSource::Type > ToColorSourceType(flutter::DlColorSourceType type)
Definition: dl_dispatcher.cc:274
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:195
impeller::Canvas::DrawRRect
void DrawRRect(Rect rect, Scalar corner_radius, const Paint &paint)
Definition: canvas.cc:249
impeller::Canvas::Restore
bool Restore()
Definition: canvas.cc:91
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:653
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:173
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:183
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:306
impeller::ToBlurStyle
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
Definition: dl_dispatcher.cc:506
impeller::Join::kRound
@ kRound
impeller::Canvas::GetSaveCount
size_t GetSaveCount() const
Definition: canvas.cc:161
impeller::Canvas::PreConcat
void PreConcat(const Matrix &xformation)
Definition: canvas.cc:116
impeller::Vector3::y
Scalar y
Definition: vector.h:21
impeller::skia_conversions::ToPoint
Point ToPoint(const SkPoint &point)
Definition: skia_conversions.cc:138
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:110
impeller::Canvas::Transform
void Transform(const Matrix &xformation)
Definition: canvas.cc:124
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:197
impeller::Canvas::ClipRRect
void ClipRRect(const Rect &rect, Scalar corner_radius, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:315
impeller::Canvas::Rotate
void Rotate(Radians radians)
Definition: canvas.cc:157
impeller::ColorSource::Type::kConicalGradient
@ kConicalGradient
impeller::Canvas::GetCurrentTransformation
const Matrix & GetCurrentTransformation() const
Definition: canvas.cc:128
impeller::TPoint< Scalar >
impeller::skia_conversions::ToRSXForms
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
Definition: skia_conversions.cc:151
impeller::Paint::invert_colors
bool invert_colors
Definition: paint.h:64
impeller::DlDispatcher::setColor
void setColor(flutter::DlColor color) override
Definition: dl_dispatcher.cc:214
impeller::Canvas::GetCurrentLocalCullingBounds
const std::optional< Rect > GetCurrentLocalCullingBounds() const
Definition: canvas.cc:132
impeller::Canvas::DrawRect
void DrawRect(Rect rect, const Paint &paint)
Definition: canvas.cc:229
impeller::ToBlendMode
static BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: dl_dispatcher.cc:55
impeller::Canvas::DrawPoints
void DrawPoints(std::vector< Point >, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:418
impeller::Canvas::ClipRect
void ClipRect(const Rect &rect, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:294
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Definition: dl_dispatcher.cc:132
impeller::TRect< Scalar >::MakeLTRB
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:40
impeller::ToColorFilter
static std::shared_ptr< ColorFilter > ToColorFilter(const flutter::DlColorFilter *filter)
Definition: dl_dispatcher.cc:458
impeller::Convexity::kConvex
@ kConvex
impeller::ColorSource::Type::kSweepGradient
@ kSweepGradient
impeller::Paint::dither
bool dither
Definition: paint.h:56
impeller::Paint::mask_blur_descriptor
std::optional< MaskBlurDescriptor > mask_blur_descriptor
Definition: paint.h:68
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:58
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:63
impeller::Paint::image_filter
std::shared_ptr< ImageFilter > image_filter
Definition: paint.h:66
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:60
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:141
impeller::Canvas::ClipPath
void ClipPath(const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:284