| Flutter Impeller |

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

`#include <dl_dispatcher.h>`

Inheritance diagram for impeller::DlDispatcherBase:

## Public Member Functions
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 | setMaskFilter (const flutter::DlMaskFilter *filter) override
void | setImageFilter (const flutter::DlImageFilter *filter) override
void | save (uint32_t total_content_depth) override
void | saveLayer (const SkRect &bounds, const flutter::SaveLayerOptions &options, uint32_t total_content_depth, flutter::DlBlendMode max_content_mode, 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 | drawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length) 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 std::shared_ptr< 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
virtual Canvas & | GetCanvas ()=0

## Detailed Description

Definition at line 23 of file dl_dispatcher.h.

## Member Function Documentation

## ◆ clipPath() [1/2]

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

Definition at line 757 of file dl_dispatcher.cc.

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

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

## ◆ clipPath() [2/2]

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

Definition at line 745 of file dl_dispatcher.cc.

745 {
746 UNIMPLEMENTED;
747 }

References UNIMPLEMENTED.

## ◆ clipRect()

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

Definition at line 719 of file dl_dispatcher.cc.

721 {
722 GetCanvas().ClipRect(skia_conversions::ToRect(rect),
723 ToClipOperation(clip_op));
724 }

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

## ◆ clipRRect()

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

Definition at line 727 of file dl_dispatcher.cc.

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

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

## ◆ drawArc()

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

Definition at line 911 of file dl_dispatcher.cc.

914 {
915 PathBuilder builder;
916 builder.AddArc(skia_conversions::ToRect(oval_bounds), Degrees(start_degrees),
917 Degrees(sweep_degrees), use_center);
918 GetCanvas().DrawPath(builder.TakePath(), paint_);
919 }

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

## ◆ drawAtlas()

void impeller::DlDispatcherBase::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 1027 of file dl_dispatcher.cc.

1035 {
1036 GetCanvas().DrawAtlas(std::make_shared<Image>(atlas->impeller_texture()),
1037 skia_conversions::ToRSXForms(xform, count),
1038 skia_conversions::ToRects(tex, count),
1039 ToColors(colors, count), ToBlendMode(mode),
1040 ToSamplerDescriptor(sampling),
1041 skia_conversions::ToRect(cull_rect), paint_);
1042 }

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

## ◆ drawCircle()

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

Definition at line 849 of file dl_dispatcher.cc.

849 {
850 GetCanvas().DrawCircle(skia_conversions::ToPoint(center), radius, paint_);
851 }

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

## ◆ drawColor()

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

Definition at line 780 of file dl_dispatcher.cc.

781 {
782 Paint paint;
783 paint.color = skia_conversions::ToColor(color);
784 paint.blend_mode = ToBlendMode(dl_mode);
785 GetCanvas().DrawPaint(paint);
786 }

References color, impeller::Canvas::DrawPaint(), GetCanvas(), paint, impeller::ToBlendMode(), and impeller::skia_conversions::ToColor().

## ◆ drawDashedLine()

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

Definition at line 799 of file dl_dispatcher.cc.

802 {
803 Scalar length = p0.GetDistance(p1);
804 // Reasons to defer to regular DrawLine:
805 // length is non-positive - drawLine will draw appropriate "dot"
806 // off_length is non-positive - no gaps, drawLine will draw it solid
807 // on_length is negative - invalid dashing
808 // Note that a 0 length "on" dash will draw "dot"s every "off" distance apart
809 if (length > 0.0f && on_length >= 0.0f && off_length > 0.0f) {
810 Point delta = (p1 - p0) / length; // length > 0 already tested
811 PathBuilder builder;
812
813 Scalar consumed = 0.0f;
814 while (consumed < length) {
815 builder.MoveTo(p0 + delta * consumed);
816
817 Scalar dash_end = consumed + on_length;
818 if (dash_end < length) {
819 builder.LineTo(p0 + delta * dash_end);
820 } else {
821 builder.LineTo(p1);
822 // Should happen anyway due to the math, but let's make it explicit
823 // in case of bit errors. We're done with this line.
824 break;
825 }
826
827 consumed = dash_end + off_length;
828 }
829
830 Paint stroke_paint = paint_;
831 stroke_paint.style = Paint::Style::kStroke;
832 GetCanvas().DrawPath(builder.TakePath(), stroke_paint);
833 } else {
834 drawLine(flutter::ToSkPoint(p0), flutter::ToSkPoint(p1));
835 }
836 }

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

## ◆ drawDisplayList()

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

Definition at line 1045 of file dl_dispatcher.cc.

1047 {
1048 // Save all values that must remain untouched after the operation.
1049 Paint saved_paint = paint_;
1050 Matrix saved_initial_matrix = initial_matrix_;
1051
1052 // Establish a new baseline for interpreting the new DL.
1053 // Matrix and clip are left untouched, the current
1054 // transform is saved as the new base matrix, and paint
1055 // values are reset to defaults.
1056 initial_matrix_ = GetCanvas().GetCurrentTransform();
1057 paint_ = Paint();
1058
1059 // Handle passed opacity in the most brute-force way by using
1060 // a SaveLayer. If the display_list is able to inherit the
1061 // opacity, this could also be handled by modulating all of its
1062 // attribute settings (for example, color), by the indicated
1063 // opacity.
1064 int restore_count = GetCanvas().GetSaveCount();
1065 if (opacity < SK_Scalar1) {
1066 Paint save_paint;
1067 save_paint.color = Color(0, 0, 0, opacity);
1068 GetCanvas().SaveLayer(
1069 save_paint, skia_conversions::ToRect(display_list->bounds()), nullptr,
1070 ContentBoundsPromise::kContainsContents, display_list->total_depth(),
1071 display_list->can_apply_group_opacity());
1072 } else {
1073 // The display list may alter the clip, which must be restored to the
1074 // current clip at the end of playback.
1075 GetCanvas().Save(display_list->total_depth());
1076 }
1077
1078 // TODO(131445): Remove this restriction if we can correctly cull with
1079 // perspective transforms.
1080 if (display_list->has_rtree() && !initial_matrix_.HasPerspective()) {
1081 // The canvas remembers the screen-space culling bounds clipped by
1082 // the surface and the history of clip calls. DisplayList can cull
1083 // the ops based on a rectangle expressed in its "destination bounds"
1084 // so we need the canvas to transform those into the current local
1085 // coordinate space into which the DisplayList will be rendered.
1086 auto cull_bounds = GetCanvas().GetCurrentLocalCullingBounds();
1087 if (cull_bounds.has_value()) {
1088 Rect cull_rect = cull_bounds.value();
1089 display_list->Dispatch(
1090 *this, SkRect::MakeLTRB(cull_rect.GetLeft(), cull_rect.GetTop(),
1091 cull_rect.GetRight(), cull_rect.GetBottom()));
1092 } else {
1093 display_list->Dispatch(*this);
1094 }
1095 } else {
1096 display_list->Dispatch(*this);
1097 }
1098
1099 // Restore all saved state back to what it was before we interpreted
1100 // the display_list
1101 GetCanvas().RestoreToCount(restore_count);
1102 initial_matrix_ = saved_initial_matrix;
1103 paint_ = saved_paint;
1104 }

References impeller::Paint::color, impeller::TRect< T >::GetBottom(), GetCanvas(), 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::kContainsContents, impeller::Canvas::RestoreToCount(), impeller::Canvas::Save(), impeller::Canvas::SaveLayer(), and impeller::skia_conversions::ToRect().

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

## ◆ drawDRRect()

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

Definition at line 865 of file dl_dispatcher.cc.

865 {
866 PathBuilder builder;
867 builder.AddPath(skia_conversions::ToPath(outer));
868 builder.AddPath(skia_conversions::ToPath(inner));
869 GetCanvas().DrawPath(builder.TakePath(FillType::kOdd), paint_);
870 }

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

## ◆ drawImage()

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

Definition at line 968 of file dl_dispatcher.cc.

971 {
972 if (!image) {
973 return;
974 }
975
976 auto texture = image->impeller_texture();
977 if (!texture) {
978 return;
979 }
980
981 const auto size = texture->GetSize();
982 const auto src = SkRect::MakeWH(size.width, size.height);
983 const auto dest =
984 SkRect::MakeXYWH(point.fX, point.fY, size.width, size.height);
985
986 drawImageRect(image, // image
987 src, // source rect
988 dest, // destination rect
989 sampling, // sampling options
990 render_with_attributes, // render with attributes
991 SrcRectConstraint::kStrict // constraint
992 );
993 }

References drawImageRect().

## ◆ drawImageNine()

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

Definition at line 1013 of file dl_dispatcher.cc.

1017 {
1018 NinePatchConverter converter = {};
1019 converter.DrawNinePatch(
1020 std::make_shared<Image>(image->impeller_texture()),
1021 Rect::MakeLTRB(center.fLeft, center.fTop, center.fRight, center.fBottom),
1022 skia_conversions::ToRect(dst), ToSamplerDescriptor(filter), &GetCanvas(),
1023 &paint_);
1024 }

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

## ◆ drawImageRect()

void impeller::DlDispatcherBase::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 996 of file dl_dispatcher.cc.

1002 {
1003 GetCanvas().DrawImageRect(
1004 std::make_shared<Image>(image->impeller_texture()), // image
1005 skia_conversions::ToRect(src), // source rect
1006 skia_conversions::ToRect(dst), // destination rect
1007 render_with_attributes ? paint_ : Paint(), // paint
1008 ToSamplerDescriptor(sampling) // sampling
1009 );
1010 }

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

Referenced by drawImage().

## ◆ drawLine()

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

Definition at line 794 of file dl_dispatcher.cc.

794 {
795 GetCanvas().DrawLine(skia_conversions::ToPoint(p0),
796 skia_conversions::ToPoint(p1), paint_);
797 }

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

Referenced by drawDashedLine().

## ◆ drawOval()

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

Definition at line 844 of file dl_dispatcher.cc.

844 {
845 GetCanvas().DrawOval(skia_conversions::ToRect(bounds), paint_);
846 }

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

## ◆ drawPaint()

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

Definition at line 789 of file dl_dispatcher.cc.

789 {
790 GetCanvas().DrawPaint(paint_);
791 }

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

## ◆ drawPath() [1/2]

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

Definition at line 878 of file dl_dispatcher.cc.

878 {
879 SimplifyOrDrawPath(GetCanvas(), cache, paint_);
880 }

References GetCanvas().

## ◆ drawPath() [2/2]

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

Definition at line 873 of file dl_dispatcher.cc.

873 {
874 UNIMPLEMENTED;
875 }

References UNIMPLEMENTED.

## ◆ drawPoints()

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

Definition at line 922 of file dl_dispatcher.cc.

924 {
925 Paint paint = paint_;
926 paint.style = Paint::Style::kStroke;
927 switch (mode) {
928 case flutter::DlCanvas::PointMode::kPoints: {
929 // Cap::kButt is also treated as a square.
930 auto point_style = paint.stroke_cap == Cap::kRound ? PointStyle::kRound
931 : PointStyle::kSquare;
932 auto radius = paint.stroke_width;
933 if (radius > 0) {
934 radius /= 2.0;
935 }
936 GetCanvas().DrawPoints(skia_conversions::ToPoints(points, count), radius,
937 paint, point_style);
938 } break;
939 case flutter::DlCanvas::PointMode::kLines:
940 for (uint32_t i = 1; i < count; i += 2) {
941 Point p0 = skia_conversions::ToPoint(points[i - 1]);
942 Point p1 = skia_conversions::ToPoint(points[i]);
943 GetCanvas().DrawLine(p0, p1, paint);
944 }
945 break;
946 case flutter::DlCanvas::PointMode::kPolygon:
947 if (count > 1) {
948 Point p0 = skia_conversions::ToPoint(points[0]);
949 for (uint32_t i = 1; i < count; i++) {
950 Point p1 = skia_conversions::ToPoint(points[i]);
951 GetCanvas().DrawLine(p0, p1, paint);
952 p0 = p1;
953 }
954 }
955 break;
956 }
957 }

References impeller::Canvas::DrawLine(), impeller::Canvas::DrawPoints(), GetCanvas(), impeller::kRound, impeller::kSquare, impeller::Paint::kStroke, paint, impeller::skia_conversions::ToPoint(), and impeller::skia_conversions::ToPoints().

## ◆ drawRect()

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

Definition at line 839 of file dl_dispatcher.cc.

839 {
840 GetCanvas().DrawRect(skia_conversions::ToRect(rect), paint_);
841 }

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

## ◆ drawRRect()

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

Definition at line 854 of file dl_dispatcher.cc.

854 {
855 if (skia_conversions::IsNearlySimpleRRect(rrect)) {
856 GetCanvas().DrawRRect(skia_conversions::ToRect(rrect.rect()),
857 skia_conversions::ToSize(rrect.getSimpleRadii()),
858 paint_);
859 } else {
860 GetCanvas().DrawPath(skia_conversions::ToPath(rrect), paint_);
861 }
862 }

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

## ◆ drawShadow() [1/2]

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

Definition at line 1135 of file dl_dispatcher.cc.

1139 {
1140 Color spot_color = skia_conversions::ToColor(color);
1141 spot_color.alpha *= 0.25;
1142
1143 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
1144 {
1145 Scalar max =
1146 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
1147 Scalar min =
1148 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
1149 Scalar luminance = (min + max) * 0.5;
1150
1151 Scalar alpha_adjust =
1152 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
1153 spot_color.alpha;
1154 Scalar color_alpha =
1155 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
1156 luminance;
1157 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
1158
1159 Scalar greyscale_alpha =
1160 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
1161
1162 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
1163 Scalar tonal_alpha = color_scale + greyscale_alpha;
1164 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
1165 spot_color = Color(unpremul_scale * spot_color.red,
1166 unpremul_scale * spot_color.green,
1167 unpremul_scale * spot_color.blue, tonal_alpha);
1168 }
1169
1170 Vector3 light_position(0, -1, 1);
1171 Scalar occluder_z = dpr * elevation;
1172
1173 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
1174
1175 Paint paint;
1176 paint.style = Paint::Style::kFill;
1177 paint.color = spot_color;
1178 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
1179 .style = FilterContents::BlurStyle::kNormal,
1180 .sigma = Radius{kLightRadius * occluder_z /
1181 GetCanvas().GetCurrentTransform().GetScale().y},
1182 };
1183
1184 GetCanvas().Save(1u);
1185 GetCanvas().PreConcat(
1186 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
1187
1188 SimplifyOrDrawPath(GetCanvas(), cache, paint);
1189
1190 GetCanvas().Restore();
1191 }

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

## ◆ drawShadow() [2/2]

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

Definition at line 1126 of file dl_dispatcher.cc.

1130 {
1131 UNIMPLEMENTED;
1132 }

References UNIMPLEMENTED.

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

## ◆ drawTextBlob()

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

Definition at line 1107 of file dl_dispatcher.cc.

1109 {
1110 // When running with Impeller enabled Skia text blobs are converted to
1111 // Impeller text frames in paragraph_skia.cc
1112 UNIMPLEMENTED;
1113 }

References UNIMPLEMENTED.

## ◆ drawTextFrame()

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

Definition at line 1115 of file dl_dispatcher.cc.

1118 {
1119 GetCanvas().DrawTextFrame(text_frame, //
1120 impeller::Point{x, y}, //
1121 paint_ //
1122 );
1123 }

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

## ◆ drawVertices()

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

Definition at line 960 of file dl_dispatcher.cc.

962 {
963 GetCanvas().DrawVertices(MakeVertices(vertices), ToBlendMode(dl_mode),
964 paint_);
965 }

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

## ◆ EndRecordingAsPicture()

Picture impeller::DlDispatcherBase::EndRecordingAsPicture | ( |  | ) |

Definition at line 1193 of file dl_dispatcher.cc.

1193 {
1194 TRACE_EVENT0("impeller", "DisplayListDispatcher::EndRecordingAsPicture");
1195 return GetCanvas().EndRecordingAsPicture();
1196 }

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

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

## ◆ GetCanvas()

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

Referenced by clipPath(), clipRect(), clipRRect(), drawArc(), drawAtlas(), drawCircle(), drawColor(), drawDashedLine(), drawDisplayList(), drawDRRect(), drawImageNine(), drawImageRect(), drawLine(), drawOval(), drawPaint(), drawPath(), drawPoints(), drawRect(), drawRRect(), drawShadow(), drawTextFrame(), drawVertices(), EndRecordingAsPicture(), restore(), rotate(), save(), saveLayer(), scale(), skew(), transformFullPerspective(), transformReset(), and translate().

## ◆ PrefersImpellerPaths()

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

Definition at line 28 of file dl_dispatcher.h.

28 { return true; }

## ◆ restore()

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

Definition at line 631 of file dl_dispatcher.cc.

631 {
632 GetCanvas().Restore();
633 }

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

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

## ◆ rotate()

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

Definition at line 646 of file dl_dispatcher.cc.

646 {
647 GetCanvas().Rotate(Degrees{degrees});
648 }

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

## ◆ save()

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

Definition at line 611 of file dl_dispatcher.cc.

611 {
612 GetCanvas().Save(total_content_depth);
613 }

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

Referenced by impeller::DlDispatcher::save().

## ◆ saveLayer()

void impeller::DlDispatcherBase::saveLayer | ( | const SkRect & | bounds,
|  | const flutter::SaveLayerOptions & | options,
|  | uint32_t | total_content_depth,
|  | flutter::DlBlendMode | max_content_mode,
|  | const flutter::DlImageFilter * | backdrop
| ) |  |
| override

Definition at line 616 of file dl_dispatcher.cc.

620 {
621 auto paint = options.renders_with_attributes() ? paint_ : Paint{};
622 auto promise = options.content_is_clipped()
623 ? ContentBoundsPromise::kMayClipContents
624 : ContentBoundsPromise::kContainsContents;
625 GetCanvas().SaveLayer(paint, skia_conversions::ToRect(bounds),
626 ToImageFilter(backdrop), promise, total_content_depth,
627 options.can_distribute_opacity());
628 }

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

Referenced by impeller::DlDispatcher::saveLayer().

## ◆ scale()

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

Definition at line 641 of file dl_dispatcher.cc.

641 {
642 GetCanvas().Scale({sx, sy, 1.0});
643 }

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

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

## ◆ setAntiAlias()

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

Definition at line 173 of file dl_dispatcher.cc.

173 {
174 // Nothing to do because AA is implicit.
175 }

## ◆ setBlendMode()

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

Definition at line 477 of file dl_dispatcher.cc.

477 {
478 paint_.blend_mode = ToBlendMode(dl_mode);
479 }

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

## ◆ setColor()

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

Definition at line 196 of file dl_dispatcher.cc.

196 {
197 paint_.color = {
198 color.getRedF(),
199 color.getGreenF(),
200 color.getBlueF(),
201 color.getAlphaF(),
202 };
203 }

References color, and impeller::Paint::color.

Referenced by setColorSource().

## ◆ setColorFilter()

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

Definition at line 467 of file dl_dispatcher.cc.

467 {
468 paint_.color_filter = ToColorFilter(filter);
469 }

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

## ◆ setColorSource()

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

Definition at line 281 of file dl_dispatcher.cc.

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

References color, 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(), type, and UNIMPLEMENTED.

## ◆ setDrawStyle()

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

Definition at line 191 of file dl_dispatcher.cc.

191 {
192 paint_.style = ToStyle(style);
193 }

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

## ◆ setImageFilter()

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

Definition at line 606 of file dl_dispatcher.cc.

606 {
607 paint_.image_filter = ToImageFilter(filter);
608 }

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

## ◆ setInvertColors()

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

Definition at line 472 of file dl_dispatcher.cc.

472 {
473 paint_.invert_colors = invert;
474 }

References impeller::Paint::invert_colors.

## ◆ setMaskFilter()

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

Definition at line 495 of file dl_dispatcher.cc.

495 {
496 // Needs https://github.com/flutter/flutter/issues/95434
497 if (filter == nullptr) {
498 paint_.mask_blur_descriptor = std::nullopt;
499 return;
500 }
501 switch (filter->type()) {
502 case flutter::DlMaskFilterType::kBlur: {
503 auto blur = filter->asBlur();
504
505 paint_.mask_blur_descriptor = {
506 .style = ToBlurStyle(blur->style()),
507 .sigma = Sigma(blur->sigma()),
508 .respect_ctm = blur->respectCTM(),
509 };
510 break;
511 }
512 }
513 }

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

## ◆ setStrokeCap()

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

Definition at line 216 of file dl_dispatcher.cc.

216 {
217 switch (cap) {
218 case flutter::DlStrokeCap::kButt:
219 paint_.stroke_cap = Cap::kButt;
220 break;
221 case flutter::DlStrokeCap::kRound:
222 paint_.stroke_cap = Cap::kRound;
223 break;
224 case flutter::DlStrokeCap::kSquare:
225 paint_.stroke_cap = Cap::kSquare;
226 break;
227 }
228 }

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

## ◆ setStrokeJoin()

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

Definition at line 231 of file dl_dispatcher.cc.

231 {
232 switch (join) {
233 case flutter::DlStrokeJoin::kMiter:
234 paint_.stroke_join = Join::kMiter;
235 break;
236 case flutter::DlStrokeJoin::kRound:
237 paint_.stroke_join = Join::kRound;
238 break;
239 case flutter::DlStrokeJoin::kBevel:
240 paint_.stroke_join = Join::kBevel;
241 break;
242 }
243 }

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

## ◆ setStrokeMiter()

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

Definition at line 211 of file dl_dispatcher.cc.

211 {
212 paint_.stroke_miter = limit;
213 }

References impeller::Paint::stroke_miter.

## ◆ setStrokeWidth()

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

Definition at line 206 of file dl_dispatcher.cc.

206 {
207 paint_.stroke_width = width;
208 }

References impeller::Paint::stroke_width.

## ◆ skew()

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

Definition at line 651 of file dl_dispatcher.cc.

651 {
652 GetCanvas().Skew(sx, sy);
653 }

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

## ◆ transform2DAffine()

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

Definition at line 656 of file dl_dispatcher.cc.

661 {
662 // clang-format off
663 transformFullPerspective(
664 mxx, mxy, 0, mxt,
665 myx, myy, 0, myt,
666 0 , 0, 1, 0,
667 0 , 0, 0, 1
668 );
669 // clang-format on
670 }

References transformFullPerspective().

## ◆ transformFullPerspective()

void impeller::DlDispatcherBase::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 673 of file dl_dispatcher.cc.

688 {
689 // The order of arguments is row-major but Impeller matrices are
690 // column-major.
691 // clang-format off
692 auto transform = Matrix{
693 mxx, myx, mzx, mwx,
694 mxy, myy, mzy, mwy,
695 mxz, myz, mzz, mwz,
696 mxt, myt, mzt, mwt
697 };
698 // clang-format on
699 GetCanvas().Transform(transform);
700 }

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

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

## ◆ transformReset()

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

Definition at line 703 of file dl_dispatcher.cc.

703 {
704 GetCanvas().ResetTransform();
705 GetCanvas().Transform(initial_matrix_);
706 }

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

## ◆ translate()

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

Definition at line 636 of file dl_dispatcher.cc.

636 {
637 GetCanvas().Translate({tx, ty, 0.0});
638 }

References GetCanvas(), and 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:72
impeller::Matrix::HasPerspective
constexpr bool HasPerspective() const
Definition: matrix.h:330
impeller::Canvas::DrawPoints
void DrawPoints(std::vector< Point > points, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:733
impeller::Canvas::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: canvas.cc:804
impeller::Canvas::ClipOval
void ClipOval(const Rect &bounds, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:620
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:708
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:540
impeller::skia_conversions::ToPoints
std::vector< Point > ToPoints(const SkPoint points[], int count)
Definition: skia_conversions.cc:45
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Canvas::RestoreToCount
void RestoreToCount(size_t count)
Definition: canvas.cc:335
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:766
impeller::ContentBoundsPromise::kMayClipContents
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
impeller::skia_conversions::IsNearlySimpleRRect
bool IsNearlySimpleRRect(const SkRRect &rr)
Like SkRRect.isSimple, but allows the corners to differ by kEhCloseEnough.
Definition: skia_conversions.cc:12
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:212
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:166
impeller::FillType::kOdd
@ kOdd
impeller::skia_conversions::ToSize
Size ToSize(const SkPoint &point)
Definition: skia_conversions.cc:158
impeller::Canvas::Skew
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:323
impeller::ToImageFilter
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
Definition: dl_dispatcher.cc:515
impeller::Paint::color
Color color
Definition: paint.h:68
impeller::Canvas::DrawTextFrame
virtual void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:884
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::Vector2
Point Vector2
Definition: point.h:326
impeller::Canvas::ResetTransform
void ResetTransform()
Definition: canvas.cc:290
impeller::Canvas::DrawVertices
void DrawVertices(const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint)
Definition: canvas.cc:933
impeller::skia_conversions::ToRects
std::vector< Rect > ToRects(const SkRect tex[], int count)
Definition: skia_conversions.cc:37
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:162
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:210
impeller::ColorSource::MakeColor
static ColorSource MakeColor()
Definition: color_source.cc:162
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:225
impeller::FilterContents::BlurStyle::kNormal
@ kNormal
Blurred inside and outside.
impeller::DlDispatcherBase::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:673
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:485
impeller::Paint::color_source
ColorSource color_source
Definition: paint.h:69
impeller::Canvas::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: canvas.cc:495
impeller::Canvas::GetCurrentTransform
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:298
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:39
impeller::ToTileMode
static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode)
Definition: dl_dispatcher.cc:106
impeller::DlDispatcherBase::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:996
impeller::Join::kMiter
@ kMiter
impeller::Paint::stroke_miter
Scalar stroke_miter
Definition: paint.h:74
impeller::ToMatrix
static Matrix ToMatrix(const SkMatrix &m)
Definition: dl_dispatcher.cc:161
impeller::ToColors
static std::vector< Color > ToColors(const flutter::DlColor colors[], int count)
Definition: dl_dispatcher.cc:245
impeller::skia_conversions::ToRect
Rect ToRect(const SkRect &rect)
Definition: skia_conversions.cc:26
impeller::Paint::color_filter
std::shared_ptr< ColorFilter > color_filter
Definition: paint.h:80
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::Point
TPoint< Scalar > Point
Definition: point.h:322
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:315
impeller::Matrix::GetScale
constexpr Vector3 GetScale() const
Definition: matrix.h:311
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:180
impeller::ColorSource::Type::kRuntimeEffect
@ kRuntimeEffect
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:231
impeller::Paint::style
Style style
Definition: paint.h:75
impeller::Paint::Style::kFill
@ kFill
impeller::ToColorSourceType
static std::optional< ColorSource::Type > ToColorSourceType(flutter::DlColorSourceType type)
Definition: dl_dispatcher.cc:256
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:566
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:177
type
GLenum type
Definition: blit_command_gles.cc:126
impeller::Canvas::Restore
virtual bool Restore()
Definition: canvas.cc:257
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:1020
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:343
impeller::DlDispatcherBase::drawLine
void drawLine(const SkPoint &p0, const SkPoint &p1) override
Definition: dl_dispatcher.cc:794
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:352
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:769
impeller::ToBlurStyle
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
Definition: dl_dispatcher.cc:481
impeller::Join::kRound
@ kRound
impeller::Canvas::GetSaveCount
size_t GetSaveCount() const
Definition: canvas.cc:331
impeller::Vector3::y
Scalar y
Definition: vector.h:24
impeller::DlDispatcherBase::GetCanvas
virtual Canvas & GetCanvas()=0
impeller::skia_conversions::ToPoint
Point ToPoint(const SkPoint &point)
Definition: skia_conversions.cc:154
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:196
impeller::Canvas::ClipRRect
void ClipRRect(const Rect &rect, const Size &corner_radii, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:640
impeller::Canvas::PreConcat
void PreConcat(const Matrix &transform)
Definition: canvas.cc:286
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:238
impeller::Canvas::DrawOval
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:514
impeller::Canvas::Rotate
void Rotate(Radians radians)
Definition: canvas.cc:327
impeller::ColorSource::Type::kConicalGradient
@ kConicalGradient
impeller::TPoint< Scalar >
impeller::Canvas::Transform
void Transform(const Matrix &transform)
Definition: canvas.cc:294
impeller::skia_conversions::ToRSXForms
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
Definition: skia_conversions.cc:171
impeller::Paint::invert_colors
bool invert_colors
Definition: paint.h:77
impeller::Canvas::Save
virtual void Save(uint32_t total_content_depth=kMaxDepth)
Definition: canvas.cc:184
impeller::Canvas::GetCurrentLocalCullingBounds
const std::optional< Rect > GetCurrentLocalCullingBounds() const
Definition: canvas.cc:302
impeller::DlDispatcherBase::setColor
void setColor(flutter::DlColor color) override
Definition: dl_dispatcher.cc:196
paint
const Paint & paint
Definition: color_source.cc:38
impeller::ToBlendMode
static BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: dl_dispatcher.cc:42
color
DlColor color
Definition: dl_golden_blur_unittests.cc:23
impeller::Canvas::ClipRect
void ClipRect(const Rect &rect, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:599
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Definition: dl_dispatcher.cc:119
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:440
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:81
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:71
impeller::skia_conversions::ToPath
Path ToPath(const SkPath &path, Point shift)
Definition: skia_conversions.cc:63
impeller::Canvas::SaveLayer
virtual void SaveLayer(const Paint &paint, std::optional< Rect > bounds=std::nullopt, const std::shared_ptr< ImageFilter > &backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown, uint32_t total_content_depth=kMaxDepth, bool can_distribute_opacity=false)
Definition: canvas.cc:842
impeller::ColorSource::Type::kColor
@ kColor
impeller::MakeVertices
std::shared_ptr< impeller::VerticesGeometry > MakeVertices(const std::shared_ptr< const flutter::DlVertices > &vertices)
Definition: dl_vertices_geometry.cc:31
impeller::Paint::blend_mode
BlendMode blend_mode
Definition: paint.h:76
impeller::Paint::image_filter
std::shared_ptr< ImageFilter > image_filter
Definition: paint.h:79
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:73
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:311
impeller::Canvas::ClipPath
void ClipPath(const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:589