Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Attributes | Friends | List of all members
flutter::DisplayListBuilder Class Referencefinal

#include <dl_builder.h>

Inheritance diagram for flutter::DisplayListBuilder:
flutter::DlCanvas SkRefCnt flutter::DlOpReceiver flutter::DisplayListOpFlags SkRefCntBase

Public Member Functions

 DisplayListBuilder (bool prepare_rtree)
 
 DisplayListBuilder (const SkRect &cull_rect=kMaxCullRect, bool prepare_rtree=false)
 
 ~DisplayListBuilder ()
 
SkISize GetBaseLayerSize () const override
 
SkImageInfo GetImageInfo () const override
 
void Save () override
 
void SaveLayer (const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr) override
 
void Restore () override
 
int GetSaveCount () const override
 
void RestoreToCount (int restore_count) 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 Transform (const SkMatrix *matrix) override
 
void Transform (const SkM44 *matrix44) override
 
void SetTransform (const SkMatrix *matrix) override
 
void SetTransform (const SkM44 *matrix44) override
 
SkM44 GetTransformFullPerspective () const override
 
SkMatrix GetTransform () const override
 
void ClipRect (const SkRect &rect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false) override
 
void ClipRRect (const SkRRect &rrect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false) override
 
void ClipPath (const SkPath &path, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false) override
 
SkRect GetDestinationClipBounds () const override
 
SkRect GetLocalClipBounds () const override
 
bool QuickReject (const SkRect &bounds) const override
 
void DrawPaint (const DlPaint &paint) override
 
void DrawColor (DlColor color, DlBlendMode mode) override
 
void DrawLine (const SkPoint &p0, const SkPoint &p1, const DlPaint &paint) override
 
void DrawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length, const DlPaint &paint) override
 
void DrawRect (const SkRect &rect, const DlPaint &paint) override
 
void DrawOval (const SkRect &bounds, const DlPaint &paint) override
 
void DrawCircle (const SkPoint &center, SkScalar radius, const DlPaint &paint) override
 
void DrawRRect (const SkRRect &rrect, const DlPaint &paint) override
 
void DrawDRRect (const SkRRect &outer, const SkRRect &inner, const DlPaint &paint) override
 
void DrawPath (const SkPath &path, const DlPaint &paint) override
 
void DrawArc (const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter, const DlPaint &paint) override
 
void DrawPoints (PointMode mode, uint32_t count, const SkPoint pts[], const DlPaint &paint) override
 
void DrawVertices (const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint) override
 
void DrawImage (const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr) override
 
void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast) override
 
void DrawImageNine (const sk_sp< DlImage > &image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, const DlPaint *paint=nullptr) override
 
void DrawAtlas (const sk_sp< DlImage > &atlas, const SkRSXform xform[], const SkRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const SkRect *cullRect, const DlPaint *paint=nullptr) override
 
void DrawDisplayList (const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1) override
 
void DrawTextBlob (const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, const DlPaint &paint) override
 
void drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
 
void DrawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y, const DlPaint &paint) override
 
void DrawShadow (const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
 
void Flush () override
 
sk_sp< DisplayListBuild ()
 
virtual void Transform (const SkMatrix *matrix)=0
 
virtual void Transform (const SkM44 *matrix44)=0
 
void Transform (const SkMatrix &matrix)
 
void Transform (const SkM44 &matrix44)
 
virtual void DrawVertices (const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint)=0
 
void DrawVertices (const std::shared_ptr< const DlVertices > &vertices, DlBlendMode mode, const DlPaint &paint)
 
virtual void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)=0
 
virtual void DrawImageRect (const sk_sp< DlImage > &image, const SkIRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)
 
void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)
 
- Public Member Functions inherited from flutter::DlCanvas
virtual ~DlCanvas ()=default
 
virtual SkISize GetBaseLayerSize () const =0
 
virtual SkImageInfo GetImageInfo () const =0
 
virtual void Save ()=0
 
virtual void SaveLayer (const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr)=0
 
virtual void Restore ()=0
 
virtual int GetSaveCount () const =0
 
virtual void RestoreToCount (int restore_count)=0
 
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 Transform (const SkMatrix *matrix)=0
 
virtual void Transform (const SkM44 *matrix44)=0
 
void Transform (const SkMatrix &matrix)
 
void Transform (const SkM44 &matrix44)
 
virtual void SetTransform (const SkMatrix *matrix)=0
 
virtual void SetTransform (const SkM44 *matrix44)=0
 
virtual void SetTransform (const SkMatrix &matrix)
 
virtual void SetTransform (const SkM44 &matrix44)
 
virtual SkM44 GetTransformFullPerspective () const =0
 
virtual SkMatrix GetTransform () const =0
 
virtual void ClipRect (const SkRect &rect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
 
virtual void ClipRRect (const SkRRect &rrect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
 
virtual void ClipPath (const SkPath &path, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
 
virtual SkRect GetDestinationClipBounds () const =0
 
virtual SkRect GetLocalClipBounds () const =0
 
virtual bool QuickReject (const SkRect &bounds) const =0
 
virtual void DrawPaint (const DlPaint &paint)=0
 
virtual void DrawColor (DlColor color, DlBlendMode mode=DlBlendMode::kSrcOver)=0
 
void Clear (DlColor color)
 
virtual void DrawLine (const SkPoint &p0, const SkPoint &p1, const DlPaint &paint)=0
 
virtual void DrawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length, const DlPaint &paint)=0
 
virtual void DrawRect (const SkRect &rect, const DlPaint &paint)=0
 
virtual void DrawOval (const SkRect &bounds, const DlPaint &paint)=0
 
virtual void DrawCircle (const SkPoint &center, SkScalar radius, const DlPaint &paint)=0
 
virtual void DrawRRect (const SkRRect &rrect, const DlPaint &paint)=0
 
virtual void DrawDRRect (const SkRRect &outer, const SkRRect &inner, const DlPaint &paint)=0
 
virtual void DrawPath (const SkPath &path, const DlPaint &paint)=0
 
virtual void DrawArc (const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter, const DlPaint &paint)=0
 
virtual void DrawPoints (PointMode mode, uint32_t count, const SkPoint pts[], const DlPaint &paint)=0
 
virtual void DrawVertices (const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint)=0
 
void DrawVertices (const std::shared_ptr< const DlVertices > &vertices, DlBlendMode mode, const DlPaint &paint)
 
virtual void DrawImage (const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr)=0
 
virtual void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)=0
 
virtual void DrawImageRect (const sk_sp< DlImage > &image, const SkIRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)
 
void DrawImageRect (const sk_sp< DlImage > &image, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)
 
virtual void DrawImageNine (const sk_sp< DlImage > &image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, const DlPaint *paint=nullptr)=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 *cullRect, const DlPaint *paint=nullptr)=0
 
virtual void DrawDisplayList (const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1)=0
 
virtual void DrawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y, const DlPaint &paint)=0
 
virtual void DrawTextBlob (const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, const DlPaint &paint)=0
 
virtual void DrawShadow (const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr)=0
 
virtual void Flush ()=0
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Attributes

static constexpr SkRect kMaxCullRect
 
- Static Public Attributes inherited from flutter::DlCanvas
static constexpr SkScalar kShadowLightHeight = 600
 
static constexpr SkScalar kShadowLightRadius = 800
 

Friends

DlOpReceiverDisplayListBuilderBenchmarkAccessor (DisplayListBuilder &builder)
 
DlOpReceiverDisplayListBuilderTestingAccessor (DisplayListBuilder &builder)
 
DlPaint DisplayListBuilderTestingAttributes (DisplayListBuilder &builder)
 
int DisplayListBuilderTestingLastOpIndex (DisplayListBuilder &builder)
 

Additional Inherited Members

- Public Types inherited from flutter::DlCanvas
enum class  ClipOp { kDifference , kIntersect }
 
enum class  PointMode { kPoints , kLines , kPolygon }
 
enum class  SrcRectConstraint { kStrict , kFast }
 
- Static Public Member Functions inherited from flutter::DlCanvas
static SkRect ComputeShadowBounds (const SkPath &path, float elevation, SkScalar dpr, const SkMatrix &ctm)
 

Detailed Description

Definition at line 27 of file dl_builder.h.

Constructor & Destructor Documentation

◆ DisplayListBuilder() [1/2]

flutter::DisplayListBuilder::DisplayListBuilder ( bool  prepare_rtree)
inlineexplicit

Definition at line 35 of file dl_builder.h.

36 : DisplayListBuilder(kMaxCullRect, prepare_rtree) {}
static constexpr SkRect kMaxCullRect
Definition: dl_builder.h:32
DisplayListBuilder(bool prepare_rtree)
Definition: dl_builder.h:35

◆ DisplayListBuilder() [2/2]

flutter::DisplayListBuilder::DisplayListBuilder ( const SkRect cull_rect = kMaxCullRect,
bool  prepare_rtree = false 
)
explicit

Definition at line 124 of file dl_builder.cc.

126 : original_cull_rect_(ProtectEmpty(cull_rect)) {
127 Init(prepare_rtree);
128}
static const DlRect & ProtectEmpty(const SkRect &rect)
Definition: dl_builder.cc:119

◆ ~DisplayListBuilder()

flutter::DisplayListBuilder::~DisplayListBuilder ( )

Definition at line 141 of file dl_builder.cc.

141 {
142 uint8_t* ptr = storage_.get();
143 if (ptr) {
144 DisplayList::DisposeOps(ptr, ptr + used_);
145 }
146}

Member Function Documentation

◆ Build()

sk_sp< DisplayList > flutter::DisplayListBuilder::Build ( )

Definition at line 67 of file dl_builder.cc.

67 {
68 while (save_stack_.size() > 1) {
69 restore();
70 }
71
72 size_t bytes = used_;
73 int count = render_op_count_;
74 size_t nested_bytes = nested_bytes_;
75 int nested_count = nested_op_count_;
76 uint32_t total_depth = depth_;
77 bool opacity_compatible = current_layer().is_group_opacity_compatible();
78 bool is_safe = is_ui_thread_safe_;
79 bool affects_transparency = current_layer().affects_transparent_layer;
80 bool root_has_backdrop_filter = current_layer().contains_backdrop_filter;
81 DlBlendMode max_root_blend_mode = current_layer().max_blend_mode;
82
83 sk_sp<DlRTree> rtree;
85 if (rtree_data_.has_value()) {
86 auto& rects = rtree_data_->rects;
87 auto& indices = rtree_data_->indices;
88 rtree = sk_make_sp<DlRTree>(rects.data(), rects.size(), indices.data(),
89 [](int id) { return id >= 0; });
90 // RTree bounds may be tighter due to applying filter bounds
91 // adjustments to each op as we restore layers rather than to
92 // the entire layer bounds.
93 bounds = rtree->bounds();
94 rtree_data_.reset();
95 } else {
96 bounds = current_layer().global_space_accumulator.bounds();
97 }
98
99 used_ = allocated_ = render_op_count_ = op_index_ = 0;
100 nested_bytes_ = nested_op_count_ = 0;
101 depth_ = 0;
102 is_ui_thread_safe_ = true;
103 current_opacity_compatibility_ = true;
104 render_op_depth_cost_ = 1u;
105 current_ = DlPaint();
106
107 save_stack_.pop_back();
108 Init(rtree != nullptr);
109
110 storage_.realloc(bytes);
112 std::move(storage_), bytes, count, nested_bytes, nested_count,
113 total_depth, bounds, opacity_compatible, is_safe, affects_transparency,
114 max_root_blend_mode, root_has_backdrop_filter, std::move(rtree)));
115}
int count
Definition: FontMgrTest.cpp:50
void realloc(size_t count)
Definition: display_list.h:251
Optional< SkRect > bounds
Definition: SkRecords.h:189
flutter::DisplayList DisplayList
flutter::DlPaint DlPaint

◆ ClipPath()

void flutter::DisplayListBuilder::ClipPath ( const SkPath path,
ClipOp  clip_op = ClipOp::kIntersect,
bool  is_aa = false 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 999 of file dl_builder.cc.

1001 {
1002 if (current_info().is_nop) {
1003 return;
1004 }
1005 if (!path.isInverseFillType()) {
1006 SkRect rect;
1007 if (path.isRect(&rect)) {
1008 this->clipRect(rect, clip_op, is_aa);
1009 return;
1010 }
1011 SkRRect rrect;
1012 if (path.isOval(&rect)) {
1014 this->clipRRect(rrect, clip_op, is_aa);
1015 return;
1016 }
1017 if (path.isRRect(&rrect)) {
1018 this->clipRRect(rrect, clip_op, is_aa);
1019 return;
1020 }
1021 }
1022 global_state().clipPath(path, clip_op, is_aa);
1023 layer_local_state().clipPath(path, clip_op, is_aa);
1024 if (global_state().is_cull_rect_empty() ||
1025 layer_local_state().is_cull_rect_empty()) {
1026 current_info().is_nop = true;
1027 return;
1028 }
1029 current_info().has_valid_clip = true;
1030 checkForDeferredSave();
1031 switch (clip_op) {
1032 case ClipOp::kIntersect:
1033 Push<ClipIntersectPathOp>(0, path, is_aa);
1034 break;
1036 Push<ClipDifferencePathOp>(0, path, is_aa);
1037 break;
1038 }
1039}
void setOval(const SkRect &oval)
Definition: SkRRect.cpp:30
void clipPath(const SkPath &path, ClipOp op, bool is_aa)
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
Definition: switches.h:57

◆ ClipRect()

void flutter::DisplayListBuilder::ClipRect ( const SkRect rect,
ClipOp  clip_op = ClipOp::kIntersect,
bool  is_aa = false 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 934 of file dl_builder.cc.

936 {
937 if (!rect.isFinite()) {
938 return;
939 }
940 if (current_info().is_nop) {
941 return;
942 }
943 if (current_info().has_valid_clip &&
944 clip_op == DlCanvas::ClipOp::kIntersect &&
945 layer_local_state().rect_covers_cull(rect)) {
946 return;
947 }
948 global_state().clipRect(rect, clip_op, is_aa);
949 layer_local_state().clipRect(rect, clip_op, is_aa);
950 if (global_state().is_cull_rect_empty() ||
951 layer_local_state().is_cull_rect_empty()) {
952 current_info().is_nop = true;
953 return;
954 }
955 current_info().has_valid_clip = true;
956 checkForDeferredSave();
957 switch (clip_op) {
959 Push<ClipIntersectRectOp>(0, rect, is_aa);
960 break;
962 Push<ClipDifferenceRectOp>(0, rect, is_aa);
963 break;
964 }
965}
void clipRect(const DlRect &rect, ClipOp op, bool is_aa)

◆ ClipRRect()

void flutter::DisplayListBuilder::ClipRRect ( const SkRRect rrect,
ClipOp  clip_op = ClipOp::kIntersect,
bool  is_aa = false 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 966 of file dl_builder.cc.

968 {
969 if (rrect.isRect()) {
970 clipRect(rrect.rect(), clip_op, is_aa);
971 return;
972 }
973 if (current_info().is_nop) {
974 return;
975 }
976 if (current_info().has_valid_clip &&
977 clip_op == DlCanvas::ClipOp::kIntersect &&
978 layer_local_state().rrect_covers_cull(rrect)) {
979 return;
980 }
981 global_state().clipRRect(rrect, clip_op, is_aa);
982 layer_local_state().clipRRect(rrect, clip_op, is_aa);
983 if (global_state().is_cull_rect_empty() ||
984 layer_local_state().is_cull_rect_empty()) {
985 current_info().is_nop = true;
986 return;
987 }
988 current_info().has_valid_clip = true;
989 checkForDeferredSave();
990 switch (clip_op) {
992 Push<ClipIntersectRRectOp>(0, rrect, is_aa);
993 break;
995 Push<ClipDifferenceRRectOp>(0, rrect, is_aa);
996 break;
997 }
998}
const SkRect & rect() const
Definition: SkRRect.h:264
bool isRect() const
Definition: SkRRect.h:84
void clipRRect(const SkRRect &rrect, ClipOp op, bool is_aa)

◆ DrawArc()

void flutter::DisplayListBuilder::DrawArc ( const SkRect bounds,
SkScalar  start,
SkScalar  sweep,
bool  useCenter,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1231 of file dl_builder.cc.

1235 {
1236 SetAttributesFromPaint(
1238 drawArc(bounds, start, sweep, useCenter);
1239}
static constexpr DisplayListAttributeFlags kDrawArcWithCenterFlags
Definition: dl_op_flags.h:340
static constexpr DisplayListAttributeFlags kDrawArcNoCenterFlags
Definition: dl_op_flags.h:334
const Paint & paint
Definition: color_source.cc:38

◆ DrawAtlas()

void flutter::DisplayListBuilder::DrawAtlas ( const sk_sp< DlImage > &  atlas,
const SkRSXform  xform[],
const SkRect  tex[],
const DlColor  colors[],
int  count,
DlBlendMode  mode,
DlImageSampling  sampling,
const SkRect cullRect,
const DlPaint paint = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1515 of file dl_builder.cc.

1523 {
1524 if (paint != nullptr) {
1525 SetAttributesFromPaint(*paint,
1527 drawAtlas(atlas, xform, tex, colors, count, mode, sampling, cull_rect,
1528 true);
1529 } else {
1530 drawAtlas(atlas, xform, tex, colors, count, mode, sampling, cull_rect,
1531 false);
1532 }
1533}
static constexpr DisplayListAttributeFlags kDrawAtlasWithPaintFlags
Definition: dl_op_flags.h:398
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

◆ DrawCircle()

void flutter::DisplayListBuilder::DrawCircle ( const SkPoint center,
SkScalar  radius,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1147 of file dl_builder.cc.

1149 {
1150 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawCircleFlags);
1151 drawCircle(center, radius);
1152}
static constexpr DisplayListAttributeFlags kDrawCircleFlags
Definition: dl_op_flags.h:314

◆ DrawColor()

void flutter::DisplayListBuilder::DrawColor ( DlColor  color,
DlBlendMode  mode 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1057 of file dl_builder.cc.

1057 {
1058 OpResult result = PaintResult(DlPaint(color).setBlendMode(mode));
1059 if (result != OpResult::kNoEffect && AccumulateUnbounded()) {
1060 Push<DrawColorOp>(0, color, mode);
1061 CheckLayerOpacityCompatibility(mode);
1062 UpdateLayerResult(result, mode);
1063 }
1064}
DlColor color
GAsyncResult * result

◆ DrawDashedLine()

void flutter::DisplayListBuilder::DrawDashedLine ( const DlPoint p0,
const DlPoint p1,
DlScalar  on_length,
DlScalar  off_length,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1098 of file dl_builder.cc.

1102 {
1103 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawLineFlags);
1104 drawDashedLine(p0, p1, on_length, off_length);
1105}
static constexpr DisplayListAttributeFlags kDrawLineFlags
Definition: dl_op_flags.h:301

◆ DrawDisplayList()

void flutter::DisplayListBuilder::DrawDisplayList ( const sk_sp< DisplayList display_list,
SkScalar  opacity = SK_Scalar1 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1535 of file dl_builder.cc.

1536 {
1537 if (!std::isfinite(opacity) || opacity <= SK_ScalarNearlyZero ||
1538 display_list->op_count() == 0 || display_list->bounds().isEmpty() ||
1539 current_info().is_nop) {
1540 return;
1541 }
1542 const SkRect bounds = display_list->bounds();
1543 bool accumulated;
1545 if (!rtree_data_.has_value() || !(rtree = display_list->rtree())) {
1546 accumulated = AccumulateOpBounds(bounds, kDrawDisplayListFlags);
1547 } else {
1548 std::list<SkRect> rects =
1549 rtree->searchAndConsolidateRects(GetLocalClipBounds(), false);
1550 accumulated = false;
1551 for (const SkRect& rect : rects) {
1552 // TODO (https://github.com/flutter/flutter/issues/114919): Attributes
1553 // are not necessarily `kDrawDisplayListFlags`.
1554 if (AccumulateOpBounds(rect, kDrawDisplayListFlags)) {
1555 accumulated = true;
1556 }
1557 }
1558 }
1559 if (!accumulated) {
1560 return;
1561 }
1562
1563 DlPaint current_paint = current_;
1564 Push<DrawDisplayListOp>(0, display_list,
1565 opacity < SK_Scalar1 ? opacity : SK_Scalar1);
1566
1567 // This depth increment accounts for every draw call in the child
1568 // DisplayList and is in addition to the implicit depth increment
1569 // that was performed when we pushed the DrawDisplayListOp. The
1570 // eventual dispatcher can use or ignore the implicit depth increment
1571 // as it sees fit depending on whether it needs to do rendering
1572 // before or after the drawDisplayList op, but it must be accounted
1573 // for if the depth value accounting is to remain consistent between
1574 // the recording and dispatching process.
1575 depth_ += display_list->total_depth();
1576
1577 is_ui_thread_safe_ = is_ui_thread_safe_ && display_list->isUIThreadSafe();
1578 // Not really necessary if the developer is interacting with us via
1579 // our attribute-state-less DlCanvas methods, but this avoids surprises
1580 // for those who may have been using the stateful Dispatcher methods.
1581 SetAttributesFromPaint(current_paint,
1583
1584 // The non-nested op count accumulated in the |Push| method will include
1585 // this call to |drawDisplayList| for non-nested op count metrics.
1586 // But, for nested op count metrics we want the |drawDisplayList| call itself
1587 // to be transparent. So we subtract 1 from our accumulated nested count to
1588 // balance out against the 1 that was accumulated into the regular count.
1589 // This behavior is identical to the way SkPicture computed nested op counts.
1590 nested_op_count_ += display_list->op_count(true) - 1;
1591 nested_bytes_ += display_list->bytes(true);
1592 UpdateLayerOpacityCompatibility(display_list->can_apply_group_opacity());
1593 // Nop DisplayLists are eliminated above so we either affect transparent
1594 // pixels or we do not. We should not have [kNoEffect].
1595 UpdateLayerResult(display_list->modifies_transparent_black()
1596 ? OpResult::kAffectsAll
1597 : OpResult::kPreservesTransparency,
1598 display_list->max_root_blend_mode());
1599 if (display_list->root_has_backdrop_filter()) {
1600 current_layer().contains_backdrop_filter = true;
1601 }
1602}
#define SK_Scalar1
Definition: SkScalar.h:18
#define SK_ScalarNearlyZero
Definition: SkScalar.h:99
SkRect GetLocalClipBounds() const override
Definition: dl_builder.h:139
static constexpr DisplayListAttributeFlags kDrawDisplayListFlags
Definition: dl_op_flags.h:401
static constexpr DisplayListAttributeFlags kSaveLayerWithPaintFlags
Definition: dl_op_flags.h:280
SINT bool isfinite(const Vec< N, T > &v)
Definition: SkVx.h:1003

◆ DrawDRRect()

void flutter::DisplayListBuilder::DrawDRRect ( const SkRRect outer,
const SkRRect inner,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1184 of file dl_builder.cc.

1186 {
1187 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawDRRectFlags);
1188 drawDRRect(outer, inner);
1189}
static constexpr DisplayListAttributeFlags kDrawDRRectFlags
Definition: dl_op_flags.h:322

◆ DrawImage()

void flutter::DisplayListBuilder::DrawImage ( const sk_sp< DlImage > &  image,
const SkPoint  point,
DlImageSampling  sampling,
const DlPaint paint = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1366 of file dl_builder.cc.

1369 {
1370 if (paint != nullptr) {
1371 SetAttributesFromPaint(*paint,
1373 drawImage(image, point, sampling, true);
1374 } else {
1375 drawImage(image, point, sampling, false);
1376 }
1377}
static constexpr DisplayListAttributeFlags kDrawImageWithPaintFlags
Definition: dl_op_flags.h:376
sk_sp< const SkImage > image
Definition: SkRecords.h:269

◆ DrawImageNine()

void flutter::DisplayListBuilder::DrawImageNine ( const sk_sp< DlImage > &  image,
const SkIRect center,
const SkRect dst,
DlFilterMode  filter,
const DlPaint paint = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1428 of file dl_builder.cc.

1432 {
1433 if (paint != nullptr) {
1434 SetAttributesFromPaint(*paint,
1436 drawImageNine(image, center, dst, filter, true);
1437 } else {
1438 drawImageNine(image, center, dst, filter, false);
1439 }
1440}
static constexpr DisplayListAttributeFlags kDrawImageNineWithPaintFlags
Definition: dl_op_flags.h:392
dst
Definition: cp.py:12

◆ DrawImageRect() [1/4]

virtual void flutter::DlCanvas::DrawImageRect ( const sk_sp< DlImage > &  image,
const SkIRect src,
const SkRect dst,
DlImageSampling  sampling,
const DlPaint paint = nullptr,
SrcRectConstraint  constraint = SrcRectConstraint::kFast 
)
inlinevirtual

Reimplemented from flutter::DlCanvas.

Definition at line 179 of file dl_canvas.h.

185 {
187 }
void DrawImageRect(const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast) override
Definition: dl_builder.cc:1396
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669

◆ DrawImageRect() [2/4]

void flutter::DlCanvas::DrawImageRect ( const sk_sp< DlImage > &  image,
const SkRect dst,
DlImageSampling  sampling,
const DlPaint paint = nullptr,
SrcRectConstraint  constraint = SrcRectConstraint::kFast 
)
inline

Definition at line 188 of file dl_canvas.h.

192 {
193 DrawImageRect(image, image->bounds(), dst, sampling, paint, constraint);
194 }
SkIRect bounds() const
Definition: SkImage.h:303

◆ DrawImageRect() [3/4]

void flutter::DisplayListBuilder::DrawImageRect ( const sk_sp< DlImage > &  image,
const SkRect src,
const SkRect dst,
DlImageSampling  sampling,
const DlPaint paint = nullptr,
SrcRectConstraint  constraint = SrcRectConstraint::kFast 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1396 of file dl_builder.cc.

1401 {
1402 if (paint != nullptr) {
1403 SetAttributesFromPaint(*paint,
1405 drawImageRect(image, src, dst, sampling, true, constraint);
1406 } else {
1407 drawImageRect(image, src, dst, sampling, false, constraint);
1408 }
1409}
static constexpr DisplayListAttributeFlags kDrawImageRectWithPaintFlags
Definition: dl_op_flags.h:384

◆ DrawImageRect() [4/4]

virtual void flutter::DlCanvas::DrawImageRect ( const sk_sp< DlImage > &  image,
const SkRect src,
const SkRect dst,
DlImageSampling  sampling,
const DlPaint paint = nullptr,
SrcRectConstraint  constraint = SrcRectConstraint::kFast 
)
virtual

Implements flutter::DlCanvas.

◆ DrawLine()

void flutter::DisplayListBuilder::DrawLine ( const SkPoint p0,
const SkPoint p1,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1077 of file dl_builder.cc.

1079 {
1080 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawLineFlags);
1081 drawLine(p0, p1);
1082}

◆ DrawOval()

void flutter::DisplayListBuilder::DrawOval ( const SkRect bounds,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1130 of file dl_builder.cc.

1130 {
1131 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawOvalFlags);
1132 drawOval(bounds);
1133}
static constexpr DisplayListAttributeFlags kDrawOvalFlags
Definition: dl_op_flags.h:310

◆ DrawPaint()

void flutter::DisplayListBuilder::DrawPaint ( const DlPaint paint)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1053 of file dl_builder.cc.

1053 {
1054 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawPaintFlags);
1055 drawPaint();
1056}
static constexpr DisplayListAttributeFlags kDrawPaintFlags
Definition: dl_op_flags.h:291

◆ DrawPath()

void flutter::DisplayListBuilder::DrawPath ( const SkPath path,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1204 of file dl_builder.cc.

1204 {
1205 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawPathFlags);
1206 drawPath(path);
1207}
static constexpr DisplayListAttributeFlags kDrawPathFlags
Definition: dl_op_flags.h:326

◆ DrawPoints()

void flutter::DisplayListBuilder::DrawPoints ( PointMode  mode,
uint32_t  count,
const SkPoint  pts[],
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1305 of file dl_builder.cc.

1308 {
1309 SetAttributesFromPaint(paint, FlagsForPointMode(mode));
1310 drawPoints(mode, count, pts);
1311}

◆ DrawRect()

void flutter::DisplayListBuilder::DrawRect ( const SkRect rect,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1116 of file dl_builder.cc.

1116 {
1117 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawRectFlags);
1118 drawRect(rect);
1119}
static constexpr DisplayListAttributeFlags kDrawRectFlags
Definition: dl_op_flags.h:305

◆ DrawRRect()

void flutter::DisplayListBuilder::DrawRRect ( const SkRRect rrect,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1169 of file dl_builder.cc.

1169 {
1170 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawRRectFlags);
1171 drawRRect(rrect);
1172}
static constexpr DisplayListAttributeFlags kDrawRRectFlags
Definition: dl_op_flags.h:318

◆ DrawShadow()

void flutter::DisplayListBuilder::DrawShadow ( const SkPath path,
const DlColor  color,
const SkScalar  elevation,
bool  transparent_occluder,
SkScalar  dpr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1679 of file dl_builder.cc.

1683 {
1684 OpResult result = PaintResult(DlPaint(color));
1685 if (result != OpResult::kNoEffect) {
1686 SkRect shadow_bounds =
1688 if (AccumulateOpBounds(shadow_bounds, kDrawShadowFlags)) {
1689 transparent_occluder //
1690 ? Push<DrawShadowTransparentOccluderOp>(0, path, color, elevation,
1691 dpr)
1692 : Push<DrawShadowOp>(0, path, color, elevation, dpr);
1693 UpdateLayerOpacityCompatibility(false);
1694 UpdateLayerResult(result, DlBlendMode::kSrcOver);
1695 }
1696 }
1697}
SkMatrix GetTransform() const override
Definition: dl_builder.h:113
static constexpr DisplayListAttributeFlags kDrawShadowFlags
Definition: dl_op_flags.h:410
static SkRect ComputeShadowBounds(const SkPath &path, float elevation, SkScalar dpr, const SkMatrix &ctm)
Definition: dl_canvas.cc:12
@ kSrcOver
r = s + (1-sa)*d

◆ DrawTextBlob()

void flutter::DisplayListBuilder::DrawTextBlob ( const sk_sp< SkTextBlob > &  blob,
SkScalar  x,
SkScalar  y,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1630 of file dl_builder.cc.

1633 {
1634 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawTextBlobFlags);
1635 drawTextBlob(blob, x, y);
1636}
static constexpr DisplayListAttributeFlags kDrawTextBlobFlags
Definition: dl_op_flags.h:404
double y
double x

◆ drawTextFrame()

void flutter::DisplayListBuilder::drawTextFrame ( const std::shared_ptr< impeller::TextFrame > &  text_frame,
SkScalar  x,
SkScalar  y 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 1638 of file dl_builder.cc.

1641 {
1642 DisplayListAttributeFlags flags = kDrawTextBlobFlags;
1643 OpResult result = PaintResult(current_, flags);
1644 if (result == OpResult::kNoEffect) {
1645 return;
1646 }
1647 impeller::Rect bounds = text_frame->GetBounds();
1648 SkRect sk_bounds = SkRect::MakeLTRB(bounds.GetLeft(), bounds.GetTop(),
1649 bounds.GetRight(), bounds.GetBottom());
1650 bool unclipped = AccumulateOpBounds(sk_bounds.makeOffset(x, y), flags);
1651 // TODO(https://github.com/flutter/flutter/issues/82202): Remove once the
1652 // unit tests can use Fuchsia's font manager instead of the empty default.
1653 // Until then we might encounter empty bounds for otherwise valid text and
1654 // thus we ignore the results from AccumulateOpBounds.
1655#if defined(OS_FUCHSIA)
1656 unclipped = true;
1657#endif // OS_FUCHSIA
1658 if (unclipped) {
1659 Push<DrawTextFrameOp>(0, text_frame, x, y);
1660 // There is no way to query if the glyphs of a text blob overlap and
1661 // there are no current guarantees from either Skia or Impeller that
1662 // they will protect overlapping glyphs from the effects of overdraw
1663 // so we must make the conservative assessment that this DL layer is
1664 // not compatible with group opacity inheritance.
1665 UpdateLayerOpacityCompatibility(false);
1666 UpdateLayerResult(result);
1667 }
1668}
FlutterSemanticsFlag flags
constexpr SkRect makeOffset(float dx, float dy) const
Definition: SkRect.h:965
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ DrawTextFrame()

void flutter::DisplayListBuilder::DrawTextFrame ( const std::shared_ptr< impeller::TextFrame > &  text_frame,
SkScalar  x,
SkScalar  y,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1670 of file dl_builder.cc.

1674 {
1675 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawTextBlobFlags);
1676 drawTextFrame(text_frame, x, y);
1677}
void drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
Definition: dl_builder.cc:1638

◆ DrawVertices() [1/3]

void flutter::DisplayListBuilder::DrawVertices ( const DlVertices vertices,
DlBlendMode  mode,
const DlPaint paint 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 1337 of file dl_builder.cc.

1339 {
1340 SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawVerticesFlags);
1341 drawVertices(vertices, mode);
1342}
static constexpr DisplayListAttributeFlags kDrawVerticesFlags
Definition: dl_op_flags.h:365

◆ DrawVertices() [2/3]

virtual void flutter::DlCanvas::DrawVertices ( const DlVertices vertices,
DlBlendMode  mode,
const DlPaint paint 
)
virtual

Implements flutter::DlCanvas.

◆ DrawVertices() [3/3]

void flutter::DlCanvas::DrawVertices ( const std::shared_ptr< const DlVertices > &  vertices,
DlBlendMode  mode,
const DlPaint paint 
)
inline

Definition at line 163 of file dl_canvas.h.

165 {
166 DrawVertices(vertices.get(), mode, paint);
167 }
void DrawVertices(const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint) override
Definition: dl_builder.cc:1337

◆ Flush()

void flutter::DisplayListBuilder::Flush ( )
inlineoverridevirtual

Implements flutter::DlCanvas.

Definition at line 251 of file dl_builder.h.

251{}

◆ GetBaseLayerSize()

SkISize flutter::DisplayListBuilder::GetBaseLayerSize ( ) const
overridevirtual

Implements flutter::DlCanvas.

Definition at line 148 of file dl_builder.cc.

148 {
149 return ToSkISize(DlIRect::RoundOut(original_cull_rect_).GetSize());
150}
const SkISize & ToSkISize(const DlISize &size)
RoundOut(const TRect< U > &r)
Definition: rect.h:666

◆ GetDestinationClipBounds()

SkRect flutter::DisplayListBuilder::GetDestinationClipBounds ( ) const
inlineoverridevirtual

Conservative estimate of the bounds of all outstanding clip operations measured in the coordinate space within which this DisplayList will be rendered.

Implements flutter::DlCanvas.

Definition at line 132 of file dl_builder.h.

132 {
133 return global_state().device_cull_rect();
134 }

◆ GetImageInfo()

SkImageInfo flutter::DisplayListBuilder::GetImageInfo ( ) const
overridevirtual

Implements flutter::DlCanvas.

Definition at line 152 of file dl_builder.cc.

152 {
154 return SkImageInfo::MakeUnknown(size.width(), size.height());
155}
SkISize GetBaseLayerSize() const override
Definition: dl_builder.cc:148
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
Definition: SkSize.h:16
static SkImageInfo MakeUnknown()
Definition: SkImageInfo.h:357

◆ GetLocalClipBounds()

SkRect flutter::DisplayListBuilder::GetLocalClipBounds ( ) const
inlineoverridevirtual

Conservative estimate of the bounds of all outstanding clip operations transformed into the local coordinate space in which currently recorded rendering operations are interpreted.

Implements flutter::DlCanvas.

Definition at line 139 of file dl_builder.h.

139 {
140 return global_state().local_cull_rect();
141 }

◆ GetSaveCount()

int flutter::DisplayListBuilder::GetSaveCount ( ) const
inlineoverridevirtual

Implements flutter::DlCanvas.

Definition at line 58 of file dl_builder.h.

58{ return save_stack_.size(); }

◆ GetTransform()

SkMatrix flutter::DisplayListBuilder::GetTransform ( ) const
inlineoverridevirtual

Returns the 3x3 partial perspective transform representing all transform operations executed so far in this DisplayList within the enclosing save stack.

Implements flutter::DlCanvas.

Definition at line 113 of file dl_builder.h.

113{ return global_state().matrix_3x3(); }

◆ GetTransformFullPerspective()

SkM44 flutter::DisplayListBuilder::GetTransformFullPerspective ( ) const
inlineoverridevirtual

Returns the 4x4 full perspective transform representing all transform operations executed so far in this DisplayList within the enclosing save stack.

Implements flutter::DlCanvas.

Definition at line 106 of file dl_builder.h.

106 {
107 return global_state().matrix_4x4();
108 }

◆ QuickReject()

bool flutter::DisplayListBuilder::QuickReject ( const SkRect bounds) const
overridevirtual

Return true iff the supplied bounds are easily shown to be outside of the current clip bounds. This method may conservatively return false if it cannot make the determination.

Implements flutter::DlCanvas.

Definition at line 1041 of file dl_builder.cc.

1041 {
1042 return global_state().content_culled(bounds);
1043}
bool content_culled(const DlRect &content_bounds) const

◆ Restore()

void flutter::DisplayListBuilder::Restore ( )
overridevirtual

Implements flutter::DlCanvas.

Definition at line 568 of file dl_builder.cc.

568 {
569 if (save_stack_.size() <= 1) {
570 return;
571 }
572
573 if (!current_info().has_deferred_save_op) {
574 SaveOpBase* op = reinterpret_cast<SaveOpBase*>(storage_.get() +
575 current_info().save_offset);
576 FML_CHECK(op->type == DisplayListOpType::kSave ||
577 op->type == DisplayListOpType::kSaveLayer ||
578 op->type == DisplayListOpType::kSaveLayerBackdrop);
579
580 op->restore_index = op_index_;
581 op->total_content_depth = depth_ - current_info().save_depth;
582
583 if (current_info().is_save_layer) {
584 RestoreLayer();
585 }
586
587 // Wait until all outgoing bounds information for the saveLayer is
588 // recorded before pushing the record to the buffer so that any rtree
589 // bounds will be attributed to the op_index of the restore op.
590 Push<RestoreOp>(0);
591 } else {
592 FML_DCHECK(!current_info().is_save_layer);
593 }
594
595 save_stack_.pop_back();
596}
#define FML_CHECK(condition)
Definition: logging.h:85
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ RestoreToCount()

void flutter::DisplayListBuilder::RestoreToCount ( int  restore_count)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 792 of file dl_builder.cc.

792 {
793 FML_DCHECK(restore_count <= GetSaveCount());
794 while (restore_count < GetSaveCount() && GetSaveCount() > 1) {
795 restore();
796 }
797}
int GetSaveCount() const override
Definition: dl_builder.h:58

◆ Rotate()

void flutter::DisplayListBuilder::Rotate ( SkScalar  degrees)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 815 of file dl_builder.cc.

815 {
816 if (SkScalarMod(degrees, 360.0) != 0.0) {
817 checkForDeferredSave();
818 Push<RotateOp>(0, degrees);
819 global_state().rotate(degrees);
820 layer_local_state().rotate(degrees);
821 }
822}
#define SkScalarMod(x, y)
Definition: SkScalar.h:41

◆ Save()

void flutter::DisplayListBuilder::Save ( )
overridevirtual

Implements flutter::DlCanvas.

Definition at line 407 of file dl_builder.cc.

407 {
408 bool was_nop = current_info().is_nop;
409 save_stack_.emplace_back(&current_info());
410 current_info().is_nop = was_nop;
411
412 FML_DCHECK(save_stack_.size() >= 2u);
413 FML_DCHECK(current_info().has_deferred_save_op);
414}

◆ SaveLayer()

void flutter::DisplayListBuilder::SaveLayer ( const SkRect bounds,
const DlPaint paint = nullptr,
const DlImageFilter backdrop = nullptr 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 549 of file dl_builder.cc.

551 {
553 SkRect temp_bounds;
554 if (bounds) {
555 options = options.with_bounds_from_caller();
556 temp_bounds = *bounds;
557 } else {
558 temp_bounds.setEmpty();
559 }
560 if (paint != nullptr) {
561 options = options.with_renders_with_attributes();
562 SetAttributesFromPaint(*paint,
564 }
565 saveLayer(temp_bounds, options, backdrop);
566}
const char * options
sk_sp< const SkImageFilter > backdrop
Definition: SkRecords.h:191
flutter::SaveLayerOptions SaveLayerOptions
void setEmpty()
Definition: SkRect.h:842

◆ Scale()

void flutter::DisplayListBuilder::Scale ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 807 of file dl_builder.cc.

807 {
808 if (std::isfinite(sx) && std::isfinite(sy) && (sx != 1.0 || sy != 1.0)) {
809 checkForDeferredSave();
810 Push<ScaleOp>(0, sx, sy);
811 global_state().scale(sx, sy);
812 layer_local_state().scale(sx, sy);
813 }
814}
void scale(SkScalar sx, SkScalar sy)

◆ SetTransform() [1/2]

void flutter::DisplayListBuilder::SetTransform ( const SkM44 matrix44)
inlineoverridevirtual

Implements flutter::DlCanvas.

Definition at line 96 of file dl_builder.h.

96 {
98 Transform(matrix44);
99 }
void Transform(const SkMatrix *matrix) override
Definition: dl_builder.cc:919
void TransformReset() override
Definition: dl_builder.cc:893

◆ SetTransform() [2/2]

void flutter::DisplayListBuilder::SetTransform ( const SkMatrix matrix)
inlineoverridevirtual

Implements flutter::DlCanvas.

Definition at line 91 of file dl_builder.h.

91 {
94 }
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ Skew()

void flutter::DisplayListBuilder::Skew ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 823 of file dl_builder.cc.

823 {
824 if (std::isfinite(sx) && std::isfinite(sy) && (sx != 0.0 || sy != 0.0)) {
825 checkForDeferredSave();
826 Push<SkewOp>(0, sx, sy);
827 global_state().skew(sx, sy);
828 layer_local_state().skew(sx, sy);
829 }
830}
void skew(SkScalar skx, SkScalar sky)

◆ Transform() [1/6]

void flutter::DlCanvas::Transform ( const SkM44 matrix44)
inline

Definition at line 90 of file dl_canvas.h.

90{ Transform(&matrix44); }

◆ Transform() [2/6]

void flutter::DisplayListBuilder::Transform ( const SkM44 matrix44)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 924 of file dl_builder.cc.

924 {
925 if (m44 != nullptr) {
926 transformFullPerspective(
927 m44->rc(0, 0), m44->rc(0, 1), m44->rc(0, 2), m44->rc(0, 3),
928 m44->rc(1, 0), m44->rc(1, 1), m44->rc(1, 2), m44->rc(1, 3),
929 m44->rc(2, 0), m44->rc(2, 1), m44->rc(2, 2), m44->rc(2, 3),
930 m44->rc(3, 0), m44->rc(3, 1), m44->rc(3, 2), m44->rc(3, 3));
931 }
932}

◆ Transform() [3/6]

virtual void flutter::DlCanvas::Transform ( const SkM44 matrix44)
virtual

Implements flutter::DlCanvas.

◆ Transform() [4/6]

void flutter::DlCanvas::Transform ( const SkMatrix matrix)
inline

Definition at line 89 of file dl_canvas.h.

89{ Transform(&matrix); }

◆ Transform() [5/6]

void flutter::DisplayListBuilder::Transform ( const SkMatrix matrix)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 919 of file dl_builder.cc.

919 {
920 if (matrix != nullptr) {
922 }
923}
Definition: SkM44.h:150

◆ Transform() [6/6]

virtual void flutter::DlCanvas::Transform ( const SkMatrix matrix)
virtual

Implements flutter::DlCanvas.

◆ Transform2DAffine()

void flutter::DisplayListBuilder::Transform2DAffine ( SkScalar  mxx,
SkScalar  mxy,
SkScalar  mxt,
SkScalar  myx,
SkScalar  myy,
SkScalar  myt 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 835 of file dl_builder.cc.

837 {
838 if (std::isfinite(mxx) && std::isfinite(myx) &&
839 std::isfinite(mxy) && std::isfinite(myy) &&
840 std::isfinite(mxt) && std::isfinite(myt)) {
841 if (mxx == 1 && mxy == 0 &&
842 myx == 0 && myy == 1) {
843 Translate(mxt, myt);
844 } else {
845 checkForDeferredSave();
846 Push<Transform2DAffineOp>(0,
847 mxx, mxy, mxt,
848 myx, myy, myt);
849 global_state().transform2DAffine(mxx, mxy, mxt,
850 myx, myy, myt);
851 layer_local_state().transform2DAffine(mxx, mxy, mxt,
852 myx, myy, myt);
853 }
854 }
855}
void Translate(SkScalar tx, SkScalar ty) override
Definition: dl_builder.cc:799
void transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt)

◆ TransformFullPerspective()

void flutter::DisplayListBuilder::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::DlCanvas.

Definition at line 857 of file dl_builder.cc.

861 {
862 if ( mxz == 0 &&
863 myz == 0 &&
864 mzx == 0 && mzy == 0 && mzz == 1 && mzt == 0 &&
865 mwx == 0 && mwy == 0 && mwz == 0 && mwt == 1) {
866 Transform2DAffine(mxx, mxy, mxt,
867 myx, myy, myt);
868 } else if (std::isfinite(mxx) && std::isfinite(mxy) &&
869 std::isfinite(mxz) && std::isfinite(mxt) &&
870 std::isfinite(myx) && std::isfinite(myy) &&
871 std::isfinite(myz) && std::isfinite(myt) &&
872 std::isfinite(mzx) && std::isfinite(mzy) &&
873 std::isfinite(mzz) && std::isfinite(mzt) &&
874 std::isfinite(mwx) && std::isfinite(mwy) &&
875 std::isfinite(mwz) && std::isfinite(mwt)) {
876 checkForDeferredSave();
877 Push<TransformFullPerspectiveOp>(0,
878 mxx, mxy, mxz, mxt,
879 myx, myy, myz, myt,
880 mzx, mzy, mzz, mzt,
881 mwx, mwy, mwz, mwt);
882 global_state().transformFullPerspective(mxx, mxy, mxz, mxt,
883 myx, myy, myz, myt,
884 mzx, mzy, mzz, mzt,
885 mwx, mwy, mwz, mwt);
886 layer_local_state().transformFullPerspective(mxx, mxy, mxz, mxt,
887 myx, myy, myz, myt,
888 mzx, mzy, mzz, mzt,
889 mwx, mwy, mwz, mwt);
890 }
891}
void Transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
Definition: dl_builder.cc:835
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)

◆ TransformReset()

void flutter::DisplayListBuilder::TransformReset ( )
overridevirtual

Implements flutter::DlCanvas.

Definition at line 893 of file dl_builder.cc.

893 {
894 checkForDeferredSave();
895 Push<TransformResetOp>(0);
896
897 // The matrices in layer_tracker_ and tracker_ are similar, but
898 // start at a different base transform. The tracker_ potentially
899 // has some number of transform operations on it that prefix the
900 // operations accumulated in layer_tracker_. So we can't set them both
901 // to identity in parallel as they would no longer maintain their
902 // relationship to each other.
903 // Instead we reinterpret this operation as transforming by the
904 // inverse of the current transform. Doing so to tracker_ sets it
905 // to identity so we can avoid the math there, but we must do the
906 // math the long way for layer_tracker_. This becomes:
907 // layer_tracker_.transform(tracker_.inverse());
908 if (!layer_local_state().inverseTransform(global_state())) {
909 // If the inverse operation failed then that means that either
910 // the matrix above the current layer was singular, or the matrix
911 // became singular while we were accumulating the current layer.
912 // In either case, we should no longer be accumulating any
913 // contents so we set the layer tracking transform to a singular one.
914 layer_local_state().setTransform(SkMatrix::Scale(0.0f, 0.0f));
915 }
916
917 global_state().setIdentity();
918}
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition: SkMatrix.h:75
void setTransform(const DlMatrix &matrix)

◆ Translate()

void flutter::DisplayListBuilder::Translate ( SkScalar  tx,
SkScalar  ty 
)
overridevirtual

Implements flutter::DlCanvas.

Definition at line 799 of file dl_builder.cc.

799 {
800 if (std::isfinite(tx) && std::isfinite(ty) && (tx != 0.0 || ty != 0.0)) {
801 checkForDeferredSave();
802 Push<TranslateOp>(0, tx, ty);
803 global_state().translate(tx, ty);
804 layer_local_state().translate(tx, ty);
805 }
806}
void translate(SkScalar tx, SkScalar ty)

Friends And Related Function Documentation

◆ DisplayListBuilderBenchmarkAccessor

DlOpReceiver & DisplayListBuilderBenchmarkAccessor ( DisplayListBuilder builder)
friend

Definition at line 10 of file dl_builder_benchmarks.cc.

10 {
11 return builder.asReceiver();
12}

◆ DisplayListBuilderTestingAccessor

DlOpReceiver & DisplayListBuilderTestingAccessor ( DisplayListBuilder builder)
friend

Definition at line 33 of file display_list_unittests.cc.

33 {
34 return builder.asReceiver();
35}

◆ DisplayListBuilderTestingAttributes

DlPaint DisplayListBuilderTestingAttributes ( DisplayListBuilder builder)
friend

Definition at line 37 of file display_list_unittests.cc.

37 {
38 return builder.CurrentAttributes();
39}

◆ DisplayListBuilderTestingLastOpIndex

int DisplayListBuilderTestingLastOpIndex ( DisplayListBuilder builder)
friend

Definition at line 41 of file display_list_unittests.cc.

41 {
42 return builder.LastOpIndex();
43}

Member Data Documentation

◆ kMaxCullRect

constexpr SkRect flutter::DisplayListBuilder::kMaxCullRect
staticconstexpr
Initial value:
=
SkRect::MakeLTRB(-1E9F, -1E9F, 1E9F, 1E9F)

Definition at line 32 of file dl_builder.h.


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