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

#include <dl_dispatcher.h>

Inheritance diagram for impeller::DlDispatcherBase:
flutter::DlOpReceiver impeller::DlDispatcher impeller::ExperimentalDlDispatcher

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 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 CanvasGetCanvas ()=0
 
- Public Member Functions inherited from flutter::DlOpReceiver
virtual bool PrefersImpellerPaths () const
 
virtual void clipPath (const CacheablePath &cache, ClipOp clip_op, bool is_aa)
 
virtual void drawPath (const CacheablePath &cache)
 
virtual void drawShadow (const CacheablePath &cache, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr)
 
virtual void setAntiAlias (bool aa)=0
 
virtual void setDrawStyle (DlDrawStyle style)=0
 
virtual void setColor (DlColor color)=0
 
virtual void setStrokeWidth (float width)=0
 
virtual void setStrokeMiter (float limit)=0
 
virtual void setStrokeCap (DlStrokeCap cap)=0
 
virtual void setStrokeJoin (DlStrokeJoin join)=0
 
virtual void setColorSource (const DlColorSource *source)=0
 
virtual void setColorFilter (const DlColorFilter *filter)=0
 
virtual void setInvertColors (bool invert)=0
 
virtual void setBlendMode (DlBlendMode mode)=0
 
virtual void setMaskFilter (const DlMaskFilter *filter)=0
 
virtual void setImageFilter (const DlImageFilter *filter)=0
 
virtual void save ()=0
 
virtual void save (uint32_t total_content_depth)
 
virtual void saveLayer (const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop=nullptr)=0
 
virtual void saveLayer (const SkRect &bounds, const SaveLayerOptions &options, uint32_t total_content_depth, DlBlendMode max_content_blend_mode, const DlImageFilter *backdrop=nullptr)
 
virtual void restore ()=0
 
virtual void saveLayer (const SkRect *bounds, const SaveLayerOptions options, const DlImageFilter *backdrop=nullptr) final
 
virtual void translate (SkScalar tx, SkScalar ty)=0
 
virtual void scale (SkScalar sx, SkScalar sy)=0
 
virtual void rotate (SkScalar degrees)=0
 
virtual void skew (SkScalar sx, SkScalar sy)=0
 
virtual void transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt)=0
 
virtual 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)=0
 
virtual void transformReset ()=0
 
virtual void clipRect (const SkRect &rect, ClipOp clip_op, bool is_aa)=0
 
virtual void clipRRect (const SkRRect &rrect, ClipOp clip_op, bool is_aa)=0
 
virtual void clipPath (const SkPath &path, ClipOp clip_op, bool is_aa)=0
 
virtual void drawColor (DlColor color, DlBlendMode mode)=0
 
virtual void drawPaint ()=0
 
virtual void drawLine (const SkPoint &p0, const SkPoint &p1)=0
 
virtual void drawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length)=0
 
virtual void drawRect (const SkRect &rect)=0
 
virtual void drawOval (const SkRect &bounds)=0
 
virtual void drawCircle (const SkPoint &center, SkScalar radius)=0
 
virtual void drawRRect (const SkRRect &rrect)=0
 
virtual void drawDRRect (const SkRRect &outer, const SkRRect &inner)=0
 
virtual void drawPath (const SkPath &path)=0
 
virtual void drawArc (const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center)=0
 
virtual void drawPoints (PointMode mode, uint32_t count, const SkPoint points[])=0
 
virtual void drawVertices (const DlVertices *vertices, DlBlendMode mode)=0
 
virtual void drawImage (const sk_sp< DlImage > image, const SkPoint point, DlImageSampling sampling, bool render_with_attributes)=0
 
virtual void drawImageRect (const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint=SrcRectConstraint::kFast)=0
 
virtual void drawImageNine (const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes)=0
 
virtual void drawAtlas (const sk_sp< DlImage > atlas, const SkRSXform xform[], const SkRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const SkRect *cull_rect, bool render_with_attributes)=0
 
virtual void drawDisplayList (const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1)=0
 
virtual void drawTextBlob (const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y)=0
 
virtual void drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y)=0
 
virtual void drawShadow (const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr)=0
 

Additional Inherited Members

- Static Public Attributes inherited from flutter::DlOpReceiver
static constexpr int kMaxDrawPointsCount = ((1 << 29) - 1)
 
- Protected Types inherited from flutter::DlOpReceiver
using ClipOp = DlCanvas::ClipOp
 
using PointMode = DlCanvas::PointMode
 
using SrcRectConstraint = DlCanvas::SrcRectConstraint
 

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 
)
overridevirtual

Reimplemented from flutter::DlOpReceiver.

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)) {
765 } else if (cache.sk_path.isOval(&rect)) {
767 } else {
769 if (cache.sk_path.isRRect(&rrect) && rrect.isSimple()) {
772 clip_op);
773 } else {
774 GetCanvas().ClipPath(GetOrCachePath(cache), clip_op);
775 }
776 }
777}
SkVector getSimpleRadii() const
Definition: SkRRect.h:111
const SkRect & rect() const
Definition: SkRRect.h:264
bool isSimple() const
Definition: SkRRect.h:86
void ClipPath(const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:589
void ClipRRect(const Rect &rect, const Size &corner_radii, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:640
void ClipRect(const Rect &rect, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:599
void ClipOval(const Rect &bounds, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:620
virtual Canvas & GetCanvas()=0
SkRRect rrect
Definition: SkRecords.h:232
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition: switches.h:191
Size ToSize(const SkPoint &point)
Rect ToRect(const SkRect &rect)
static Entity::ClipOperation ToClipOperation(flutter::DlCanvas::ClipOp clip_op)

◆ clipPath() [2/2]

void impeller::DlDispatcherBase::clipPath ( const SkPath path,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 745 of file dl_dispatcher.cc.

745 {
747}
#define UNIMPLEMENTED

◆ clipRect()

void impeller::DlDispatcherBase::clipRect ( const SkRect rect,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 719 of file dl_dispatcher.cc.

721 {
723 ToClipOperation(clip_op));
724}

◆ clipRRect()

void impeller::DlDispatcherBase::clipRRect ( const SkRRect rrect,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 727 of file dl_dispatcher.cc.

729 {
730 auto clip_op = ToClipOperation(sk_op);
731 if (rrect.isRect()) {
733 } else if (rrect.isOval()) {
735 } else if (rrect.isSimple()) {
738 clip_op);
739 } else {
741 }
742}
bool isOval() const
Definition: SkRRect.h:85
bool isRect() const
Definition: SkRRect.h:84
Path ToPath(const SkPath &path, Point shift)

◆ drawArc()

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

Implements flutter::DlOpReceiver.

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}
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:343

◆ 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 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 1026 of file dl_dispatcher.cc.

1034 {
1035 GetCanvas().DrawAtlas(std::make_shared<Image>(atlas->impeller_texture()),
1040 skia_conversions::ToRect(cull_rect), paint_);
1041}
int count
Definition: FontMgrTest.cpp:50
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
sk_sp< const SkImage > atlas
Definition: SkRecords.h:331
PODArray< SkColor > colors
Definition: SkRecords.h:276
SkSamplingOptions sampling
Definition: SkRecords.h:337
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
std::vector< Rect > ToRects(const SkRect tex[], int count)
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
static BlendMode ToBlendMode(flutter::DlBlendMode mode)
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
static std::vector< Color > ToColors(const flutter::DlColor colors[], int count)

◆ drawCircle()

void impeller::DlDispatcherBase::drawCircle ( const SkPoint center,
SkScalar  radius 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 849 of file dl_dispatcher.cc.

849 {
850 GetCanvas().DrawCircle(skia_conversions::ToPoint(center), radius, paint_);
851}
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:566
Point ToPoint(const SkPoint &point)

◆ drawColor()

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

Implements flutter::DlOpReceiver.

Definition at line 780 of file dl_dispatcher.cc.

781 {
782 Paint paint;
784 paint.blend_mode = ToBlendMode(dl_mode);
786}
void DrawPaint(const Paint &paint)
Definition: canvas.cc:352
const Paint & paint
Definition: color_source.cc:38
DlColor color
Color ToColor(const flutter::DlColor &color)

◆ drawDashedLine()

void impeller::DlDispatcherBase::drawDashedLine ( const DlPoint p0,
const DlPoint p1,
DlScalar  on_length,
DlScalar  off_length 
)
overridevirtual

Implements flutter::DlOpReceiver.

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 {
835 }
836}
void drawLine(const SkPoint &p0, const SkPoint &p1) override
size_t length
const SkPoint & ToSkPoint(const DlPoint &point)
float Scalar
Definition: scalar.h:18
TPoint< Scalar > Point
Definition: point.h:322

◆ drawDisplayList()

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

Implements flutter::DlOpReceiver.

Definition at line 1044 of file dl_dispatcher.cc.

1046 {
1047 // Save all values that must remain untouched after the operation.
1048 Paint saved_paint = paint_;
1049 Matrix saved_initial_matrix = initial_matrix_;
1050
1051 // Establish a new baseline for interpreting the new DL.
1052 // Matrix and clip are left untouched, the current
1053 // transform is saved as the new base matrix, and paint
1054 // values are reset to defaults.
1055 initial_matrix_ = GetCanvas().GetCurrentTransform();
1056 paint_ = Paint();
1057
1058 // Handle passed opacity in the most brute-force way by using
1059 // a SaveLayer. If the display_list is able to inherit the
1060 // opacity, this could also be handled by modulating all of its
1061 // attribute settings (for example, color), by the indicated
1062 // opacity.
1063 int restore_count = GetCanvas().GetSaveCount();
1064 if (opacity < SK_Scalar1) {
1065 Paint save_paint;
1066 save_paint.color = Color(0, 0, 0, opacity);
1068 save_paint, skia_conversions::ToRect(display_list->bounds()), nullptr,
1070 display_list->can_apply_group_opacity());
1071 } else {
1072 // The display list may alter the clip, which must be restored to the
1073 // current clip at the end of playback.
1074 GetCanvas().Save(display_list->total_depth());
1075 }
1076
1077 // TODO(131445): Remove this restriction if we can correctly cull with
1078 // perspective transforms.
1079 if (display_list->has_rtree() && !initial_matrix_.HasPerspective()) {
1080 // The canvas remembers the screen-space culling bounds clipped by
1081 // the surface and the history of clip calls. DisplayList can cull
1082 // the ops based on a rectangle expressed in its "destination bounds"
1083 // so we need the canvas to transform those into the current local
1084 // coordinate space into which the DisplayList will be rendered.
1085 auto cull_bounds = GetCanvas().GetCurrentLocalCullingBounds();
1086 if (cull_bounds.has_value()) {
1087 Rect cull_rect = cull_bounds.value();
1088 display_list->Dispatch(
1089 *this, SkRect::MakeLTRB(cull_rect.GetLeft(), cull_rect.GetTop(),
1090 cull_rect.GetRight(), cull_rect.GetBottom()));
1091 } else {
1092 display_list->Dispatch(*this);
1093 }
1094 } else {
1095 display_list->Dispatch(*this);
1096 }
1097
1098 // Restore all saved state back to what it was before we interpreted
1099 // the display_list
1100 GetCanvas().RestoreToCount(restore_count);
1101 initial_matrix_ = saved_initial_matrix;
1102 paint_ = saved_paint;
1103}
#define SK_Scalar1
Definition: SkScalar.h:18
const SkRect & bounds() const
Definition: display_list.h:294
bool can_apply_group_opacity() const
Definition: display_list.h:305
uint32_t total_depth() const
Definition: display_list.h:290
bool has_rtree() const
Definition: display_list.h:296
void Dispatch(DlOpReceiver &ctx) const
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:298
void RestoreToCount(size_t count)
Definition: canvas.cc:335
size_t GetSaveCount() const
Definition: canvas.cc:331
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
const std::optional< Rect > GetCurrentLocalCullingBounds() const
Definition: canvas.cc:302
virtual void Save(uint32_t total_content_depth=kMaxDepth)
Definition: canvas.cc:184
SK_API sk_sp< SkShader > Color(SkColor)
TRect< Scalar > Rect
Definition: rect.h:769
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
SK_API sk_sp< PrecompileColorFilter > Matrix()
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646
constexpr bool HasPerspective() const
Definition: matrix.h:330

◆ drawDRRect()

void impeller::DlDispatcherBase::drawDRRect ( const SkRRect outer,
const SkRRect inner 
)
overridevirtual

Implements flutter::DlOpReceiver.

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}

◆ drawImage()

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

Implements flutter::DlOpReceiver.

Definition at line 967 of file dl_dispatcher.cc.

970 {
971 if (!image) {
972 return;
973 }
974
975 auto texture = image->impeller_texture();
976 if (!texture) {
977 return;
978 }
979
980 const auto size = texture->GetSize();
981 const auto src = SkRect::MakeWH(size.width, size.height);
982 const auto dest =
983 SkRect::MakeXYWH(point.fX, point.fY, size.width, size.height);
984
985 drawImageRect(image, // image
986 src, // source rect
987 dest, // destination rect
988 sampling, // sampling options
989 render_with_attributes, // render with attributes
990 SrcRectConstraint::kStrict // constraint
991 );
992}
void drawImageRect(const sk_sp< flutter::DlImage > image, const SkRect &src, const SkRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
FlTexture * texture
sk_sp< const SkImage > image
Definition: SkRecords.h:269
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
dest
Definition: zip.py:79
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ drawImageNine()

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

Implements flutter::DlOpReceiver.

Definition at line 1012 of file dl_dispatcher.cc.

1016 {
1017 NinePatchConverter converter = {};
1018 converter.DrawNinePatch(
1019 std::make_shared<Image>(image->impeller_texture()),
1020 Rect::MakeLTRB(center.fLeft, center.fTop, center.fRight, center.fBottom),
1022 &paint_);
1023}
string converter
Definition: cacheimages.py:19
dst
Definition: cp.py:12
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:129

◆ 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 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 995 of file dl_dispatcher.cc.

1001 {
1003 std::make_shared<Image>(image->impeller_texture()), // image
1004 skia_conversions::ToRect(src), // source rect
1005 skia_conversions::ToRect(dst), // destination rect
1006 render_with_attributes ? paint_ : Paint(), // paint
1007 ToSamplerDescriptor(sampling) // sampling
1008 );
1009}
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

◆ drawLine()

void impeller::DlDispatcherBase::drawLine ( const SkPoint p0,
const SkPoint p1 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 794 of file dl_dispatcher.cc.

794 {
796 skia_conversions::ToPoint(p1), paint_);
797}
void DrawLine(const Point &p0, const Point &p1, const Paint &paint)
Definition: canvas.cc:485

◆ drawOval()

void impeller::DlDispatcherBase::drawOval ( const SkRect bounds)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 844 of file dl_dispatcher.cc.

844 {
846}
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:514
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ drawPaint()

void impeller::DlDispatcherBase::drawPaint ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 789 of file dl_dispatcher.cc.

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

◆ drawPath() [1/2]

void impeller::DlDispatcherBase::drawPath ( const CacheablePath cache)
overridevirtual

Reimplemented from flutter::DlOpReceiver.

Definition at line 878 of file dl_dispatcher.cc.

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

◆ drawPath() [2/2]

void impeller::DlDispatcherBase::drawPath ( const SkPath path)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 873 of file dl_dispatcher.cc.

873 {
875}

◆ drawPoints()

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

Implements flutter::DlOpReceiver.

Definition at line 922 of file dl_dispatcher.cc.

924 {
925 Paint paint = paint_;
927 switch (mode) {
929 // Cap::kButt is also treated as a square.
930 auto point_style = paint.stroke_cap == Cap::kRound ? PointStyle::kRound
932 auto radius = paint.stroke_width;
933 if (radius > 0) {
934 radius /= 2.0;
935 }
937 paint, point_style);
938 } break;
940 for (uint32_t i = 1; i < count; i += 2) {
943 GetCanvas().DrawLine(p0, p1, paint);
944 }
945 break;
947 if (count > 1) {
949 for (uint32_t i = 1; i < count; i++) {
951 GetCanvas().DrawLine(p0, p1, paint);
952 p0 = p1;
953 }
954 }
955 break;
956 }
957}
static const int points[]
@ kLines
draw each separate pair of points as a line segment
@ kPolygon
draw each pair of overlapping points as a line segment
@ kPoints
draw each point separately
void DrawPoints(std::vector< Point > points, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:733
std::vector< Point > ToPoints(const SkPoint points[], int count)
@ kRound
Points are drawn as squares.
@ kSquare
Points are drawn as circles.

◆ drawRect()

void impeller::DlDispatcherBase::drawRect ( const SkRect rect)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 839 of file dl_dispatcher.cc.

839 {
841}
void DrawRect(const Rect &rect, const Paint &paint)
Definition: canvas.cc:495

◆ drawRRect()

void impeller::DlDispatcherBase::drawRRect ( const SkRRect rrect)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 854 of file dl_dispatcher.cc.

854 {
858 paint_);
859 } else {
861 }
862}
void DrawRRect(const Rect &rect, const Size &corner_radii, const Paint &paint)
Definition: canvas.cc:540
bool IsNearlySimpleRRect(const SkRRect &rr)
Like SkRRect.isSimple, but allows the corners to differ by kEhCloseEnough.

◆ drawShadow() [1/2]

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

Reimplemented from flutter::DlOpReceiver.

Definition at line 1134 of file dl_dispatcher.cc.

1138 {
1140 spot_color.alpha *= 0.25;
1141
1142 // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
1143 {
1144 Scalar max =
1145 std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
1146 Scalar min =
1147 std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
1148 Scalar luminance = (min + max) * 0.5;
1149
1150 Scalar alpha_adjust =
1151 (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
1152 spot_color.alpha;
1153 Scalar color_alpha =
1154 (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
1155 luminance;
1156 color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
1157
1158 Scalar greyscale_alpha =
1159 std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
1160
1161 Scalar color_scale = color_alpha * (1 - greyscale_alpha);
1162 Scalar tonal_alpha = color_scale + greyscale_alpha;
1163 Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
1164 spot_color = Color(unpremul_scale * spot_color.red,
1165 unpremul_scale * spot_color.green,
1166 unpremul_scale * spot_color.blue, tonal_alpha);
1167 }
1168
1169 Vector3 light_position(0, -1, 1);
1170 Scalar occluder_z = dpr * elevation;
1171
1172 constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
1173
1174 Paint paint;
1175 paint.style = Paint::Style::kFill;
1176 paint.color = spot_color;
1177 paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
1179 .sigma = Radius{kLightRadius * occluder_z /
1181 };
1182
1183 GetCanvas().Save(1u);
1185 Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
1186
1187 SimplifyOrDrawPath(GetCanvas(), cache, paint);
1188
1189 GetCanvas().Restore();
1190}
static unsigned clamp(SkFixed fx, int max)
virtual bool Restore()
Definition: canvas.cc:257
void PreConcat(const Matrix &transform)
Definition: canvas.cc:286
@ kNormal
Blurred inside and outside.
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48
Point Vector2
Definition: point.h:326
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
constexpr Vector3 GetScale() const
Definition: matrix.h:311

◆ drawShadow() [2/2]

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

Implements flutter::DlOpReceiver.

Definition at line 1125 of file dl_dispatcher.cc.

1129 {
1131}

◆ drawTextBlob()

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

Implements flutter::DlOpReceiver.

Definition at line 1106 of file dl_dispatcher.cc.

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

◆ drawTextFrame()

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

Definition at line 1114 of file dl_dispatcher.cc.

1117 {
1118 GetCanvas().DrawTextFrame(text_frame, //
1119 impeller::Point{x, y}, //
1120 paint_ //
1121 );
1122}
virtual void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:884
double y
double x

◆ drawVertices()

void impeller::DlDispatcherBase::drawVertices ( const flutter::DlVertices vertices,
flutter::DlBlendMode  dl_mode 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 960 of file dl_dispatcher.cc.

961 {
962 GetCanvas().DrawVertices(MakeVertices(vertices), ToBlendMode(dl_mode),
963 paint_);
964}
void DrawVertices(const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint)
Definition: canvas.cc:933
std::shared_ptr< impeller::VerticesGeometry > MakeVertices(const flutter::DlVertices *vertices)

◆ EndRecordingAsPicture()

Picture impeller::DlDispatcherBase::EndRecordingAsPicture ( )

Definition at line 1192 of file dl_dispatcher.cc.

1192 {
1193 TRACE_EVENT0("impeller", "DisplayListDispatcher::EndRecordingAsPicture");
1195}
Picture EndRecordingAsPicture()
Definition: canvas.cc:804
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131

◆ GetCanvas()

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

◆ PrefersImpellerPaths()

bool impeller::DlDispatcherBase::PrefersImpellerPaths ( ) const
inlineoverridevirtual

Reimplemented from flutter::DlOpReceiver.

Definition at line 28 of file dl_dispatcher.h.

28{ return true; }

◆ restore()

void impeller::DlDispatcherBase::restore ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 631 of file dl_dispatcher.cc.

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

◆ rotate()

void impeller::DlDispatcherBase::rotate ( SkScalar  degrees)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 646 of file dl_dispatcher.cc.

646 {
647 GetCanvas().Rotate(Degrees{degrees});
648}
void Rotate(Radians radians)
Definition: canvas.cc:327

◆ save()

void impeller::DlDispatcherBase::save ( uint32_t  total_content_depth)
overridevirtual

Reimplemented from flutter::DlOpReceiver.

Reimplemented in impeller::DlDispatcher, and impeller::ExperimentalDlDispatcher.

Definition at line 611 of file dl_dispatcher.cc.

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

◆ 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 
)
overridevirtual

Reimplemented from flutter::DlOpReceiver.

Reimplemented in impeller::DlDispatcher, and impeller::ExperimentalDlDispatcher.

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()
626 ToImageFilter(backdrop), promise, total_content_depth,
627 options.can_distribute_opacity());
628}
const char * options
sk_sp< const SkImageFilter > backdrop
Definition: SkRecords.h:191
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...

◆ scale()

void impeller::DlDispatcherBase::scale ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 641 of file dl_dispatcher.cc.

641 {
642 GetCanvas().Scale({sx, sy, 1.0});
643}
void Scale(const Vector2 &scale)
Definition: canvas.cc:315

◆ setAntiAlias()

void impeller::DlDispatcherBase::setAntiAlias ( bool  aa)
overridevirtual

Implements flutter::DlOpReceiver.

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)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 477 of file dl_dispatcher.cc.

477 {
478 paint_.blend_mode = ToBlendMode(dl_mode);
479}
BlendMode blend_mode
Definition: paint.h:76

◆ setColor()

void impeller::DlDispatcherBase::setColor ( flutter::DlColor  color)
overridevirtual

Implements flutter::DlOpReceiver.

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}
Color color
Definition: paint.h:68

◆ setColorFilter()

void impeller::DlDispatcherBase::setColorFilter ( const flutter::DlColorFilter filter)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 467 of file dl_dispatcher.cc.

467 {
468 paint_.color_filter = ToColorFilter(filter);
469}
static std::shared_ptr< ColorFilter > ToColorFilter(const flutter::DlColorFilter *filter)
std::shared_ptr< ColorFilter > color_filter
Definition: paint.h:80

◆ setColorSource()

void impeller::DlDispatcherBase::setColorSource ( const flutter::DlColorSource source)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 281 of file dl_dispatcher.cc.

281 {
282 if (!source) {
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";
292 return;
293 }
294
295 switch (type.value()) {
297 const flutter::DlColorColorSource* color = source->asColor();
298
300 setColor(color->color());
302 return;
303 }
306 source->asLinearGradient();
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;
313
314 auto tile_mode = ToTileMode(linear->tile_mode());
315 auto matrix = ToMatrix(linear->matrix());
316
318 start_point, end_point, std::move(colors), std::move(stops),
319 tile_mode, matrix);
320 return;
321 }
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
339 center, radius, std::move(colors), std::move(stops), focus_center,
340 focus_radius, tile_mode, matrix);
341 return;
342 }
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 }
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());
375 center, start_angle, end_angle, std::move(colors), std::move(stops),
376 tile_mode, matrix);
377 return;
378 }
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 }
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()) {
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
419 runtime_stage, uniform_data, texture_inputs);
420 return;
421 }
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}
GLenum type
sk_sp< SkImage > asImage() const
Definition: SkBitmap.cpp:645
DlImageSampling sampling() const
DlTileMode vertical_tile_mode() const
DlTileMode horizontal_tile_mode() const
sk_sp< const DlImage > image() const
const SkMatrix & matrix() const
const std::shared_ptr< std::vector< uint8_t > > uniform_data() const
const sk_sp< DlRuntimeEffect > runtime_effect() const
const std::vector< std::shared_ptr< DlColorSource > > samplers() const
static ColorSource MakeLinearGradient(Point start_point, Point end_point, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
static ColorSource MakeColor()
static ColorSource MakeRadialGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
static ColorSource MakeImage(std::shared_ptr< Texture > texture, Entity::TileMode x_tile_mode, Entity::TileMode y_tile_mode, SamplerDescriptor sampler_descriptor, Matrix effect_transform)
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)
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)
static ColorSource MakeRuntimeEffect(std::shared_ptr< RuntimeStage > runtime_stage, std::shared_ptr< std::vector< uint8_t > > uniform_data, std::vector< RuntimeEffectContents::TextureInput > texture_inputs)
void setColor(flutter::DlColor color) override
SkBitmap source
Definition: examples.cpp:28
float SkScalar
Definition: extension.cpp:12
#define FML_LOG(severity)
Definition: logging.h:82
#define FML_DCHECK(condition)
Definition: logging.h:103
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
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...
static std::optional< ColorSource::Type > ToColorSourceType(flutter::DlColorSourceType type)
static Matrix ToMatrix(const SkMatrix &m)
static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode)
ColorSource color_source
Definition: paint.h:69
#define ERROR(message)
Definition: elf_loader.cc:260
static sk_sp< SkShader > linear(sk_sp< SkShader > shader)

◆ setDrawStyle()

void impeller::DlDispatcherBase::setDrawStyle ( flutter::DlDrawStyle  style)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 191 of file dl_dispatcher.cc.

191 {
192 paint_.style = ToStyle(style);
193}
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Style style
Definition: paint.h:75

◆ setImageFilter()

void impeller::DlDispatcherBase::setImageFilter ( const flutter::DlImageFilter filter)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 606 of file dl_dispatcher.cc.

606 {
607 paint_.image_filter = ToImageFilter(filter);
608}
std::shared_ptr< ImageFilter > image_filter
Definition: paint.h:79

◆ setInvertColors()

void impeller::DlDispatcherBase::setInvertColors ( bool  invert)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 472 of file dl_dispatcher.cc.

472 {
473 paint_.invert_colors = invert;
474}
gboolean invert
bool invert_colors
Definition: paint.h:77

◆ setMaskFilter()

void impeller::DlDispatcherBase::setMaskFilter ( const flutter::DlMaskFilter filter)
overridevirtual

Implements flutter::DlOpReceiver.

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()) {
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}
virtual T type() const =0
virtual const DlBlurMaskFilter * asBlur() const
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
std::optional< MaskBlurDescriptor > mask_blur_descriptor
Definition: paint.h:81

◆ setStrokeCap()

void impeller::DlDispatcherBase::setStrokeCap ( flutter::DlStrokeCap  cap)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 216 of file dl_dispatcher.cc.

216 {
217 switch (cap) {
219 paint_.stroke_cap = Cap::kButt;
220 break;
222 paint_.stroke_cap = Cap::kRound;
223 break;
225 paint_.stroke_cap = Cap::kSquare;
226 break;
227 }
228}
@ kRound
adds circle
@ kButt
no stroke extension
@ kSquare
adds square
Cap stroke_cap
Definition: paint.h:72

◆ setStrokeJoin()

void impeller::DlDispatcherBase::setStrokeJoin ( flutter::DlStrokeJoin  join)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 231 of file dl_dispatcher.cc.

231 {
232 switch (join) {
234 paint_.stroke_join = Join::kMiter;
235 break;
237 paint_.stroke_join = Join::kRound;
238 break;
240 paint_.stroke_join = Join::kBevel;
241 break;
242 }
243}
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741
Join stroke_join
Definition: paint.h:73

◆ setStrokeMiter()

void impeller::DlDispatcherBase::setStrokeMiter ( SkScalar  limit)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 211 of file dl_dispatcher.cc.

211 {
212 paint_.stroke_miter = limit;
213}
Scalar stroke_miter
Definition: paint.h:74

◆ setStrokeWidth()

void impeller::DlDispatcherBase::setStrokeWidth ( SkScalar  width)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 206 of file dl_dispatcher.cc.

206 {
207 paint_.stroke_width = width;
208}
int32_t width
Scalar stroke_width
Definition: paint.h:71

◆ skew()

void impeller::DlDispatcherBase::skew ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 651 of file dl_dispatcher.cc.

651 {
652 GetCanvas().Skew(sx, sy);
653}
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:323

◆ transform2DAffine()

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

Implements flutter::DlOpReceiver.

Definition at line 656 of file dl_dispatcher.cc.

661 {
662 // clang-format off
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}
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

◆ 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 
)
overridevirtual

Implements flutter::DlOpReceiver.

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
700}
void Transform(const Matrix &transform)
Definition: canvas.cc:294
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47

◆ transformReset()

void impeller::DlDispatcherBase::transformReset ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 703 of file dl_dispatcher.cc.

703 {
705 GetCanvas().Transform(initial_matrix_);
706}
void ResetTransform()
Definition: canvas.cc:290

◆ translate()

void impeller::DlDispatcherBase::translate ( SkScalar  tx,
SkScalar  ty 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 636 of file dl_dispatcher.cc.

636 {
637 GetCanvas().Translate({tx, ty, 0.0});
638}
void Translate(const Vector3 &offset)
Definition: canvas.cc:311

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