Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
impeller::TextFrameDispatcher Class Reference

Performs a first pass over the display list to collect all text frames. More...

#include <dl_dispatcher.h>

Inheritance diagram for impeller::TextFrameDispatcher:
flutter::IgnoreAttributeDispatchHelper flutter::IgnoreClipDispatchHelper flutter::IgnoreDrawDispatchHelper flutter::DlOpReceiver flutter::DlOpReceiver flutter::DlOpReceiver

Public Member Functions

 TextFrameDispatcher (const ContentContext &renderer, const Matrix &initial_matrix)
 
void save () override
 
void saveLayer (const SkRect &bounds, const flutter::SaveLayerOptions options, const flutter::DlImageFilter *backdrop) override
 
void restore () override
 
void translate (SkScalar tx, SkScalar ty) override
 
void scale (SkScalar sx, SkScalar sy) override
 
void rotate (SkScalar degrees) override
 
void skew (SkScalar sx, SkScalar sy) override
 
void transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
 
void transformFullPerspective (SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
 
void transformReset () override
 
void drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
 
void drawDisplayList (const sk_sp< flutter::DisplayList > display_list, SkScalar opacity) 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
 
- Public Member Functions inherited from flutter::IgnoreAttributeDispatchHelper
void setAntiAlias (bool aa) override
 
void setInvertColors (bool invert) override
 
void setStrokeCap (DlStrokeCap cap) override
 
void setStrokeJoin (DlStrokeJoin join) override
 
void setDrawStyle (DlDrawStyle style) override
 
void setStrokeWidth (float width) override
 
void setStrokeMiter (float limit) override
 
void setColor (DlColor color) override
 
void setBlendMode (DlBlendMode mode) override
 
void setColorSource (const DlColorSource *source) override
 
void setImageFilter (const DlImageFilter *filter) override
 
void setColorFilter (const DlColorFilter *filter) override
 
void setMaskFilter (const DlMaskFilter *filter) override
 
- 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
 
- Public Member Functions inherited from flutter::IgnoreDrawDispatchHelper
void save () override
 
void saveLayer (const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop) override
 
void restore () override
 
void drawColor (DlColor color, 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 drawArc (const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
 
void drawPoints (DlCanvas::PointMode mode, uint32_t count, const SkPoint points[]) override
 
void drawVertices (const DlVertices *vertices, DlBlendMode mode) override
 
void drawImage (const sk_sp< DlImage > image, const SkPoint point, DlImageSampling sampling, bool render_with_attributes) override
 
void drawImageRect (const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
 
void drawImageNine (const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes) 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 *cull_rect, bool render_with_attributes) override
 
void drawDisplayList (const sk_sp< 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 DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
 

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

Performs a first pass over the display list to collect all text frames.

Definition at line 335 of file dl_dispatcher.h.

Constructor & Destructor Documentation

◆ TextFrameDispatcher()

impeller::TextFrameDispatcher::TextFrameDispatcher ( const ContentContext renderer,
const Matrix initial_matrix 
)

Definition at line 1234 of file dl_dispatcher.cc.

1236 : renderer_(renderer), matrix_(initial_matrix) {}

Member Function Documentation

◆ drawDisplayList()

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

Reimplemented from flutter::IgnoreDrawDispatchHelper.

Definition at line 1322 of file dl_dispatcher.cc.

1324 {
1325 [[maybe_unused]] size_t stack_depth = stack_.size();
1326 save();
1327 display_list->Dispatch(*this);
1328 restore();
1329 FML_DCHECK(stack_depth == stack_.size());
1330}
void Dispatch(DlOpReceiver &ctx) const
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ drawTextFrame()

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

Definition at line 1300 of file dl_dispatcher.cc.

1303 {
1304 GlyphProperties properties;
1305 if (paint_.style == Paint::Style::kStroke) {
1306 properties.stroke = true;
1307 properties.stroke_cap = paint_.stroke_cap;
1308 properties.stroke_join = paint_.stroke_join;
1309 properties.stroke_miter = paint_.stroke_miter;
1310 properties.stroke_width = paint_.stroke_width;
1311 }
1312 if (text_frame->HasColor()) {
1313 properties.color = paint_.color;
1314 }
1315 renderer_.GetLazyGlyphAtlas()->AddTextFrame(*text_frame, //
1316 matrix_.GetMaxBasisLengthXY(), //
1317 Point(x, y), //
1318 properties //
1319 );
1320}
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas() const
double y
double x
TPoint< Scalar > Point
Definition: point.h:322
constexpr Scalar GetMaxBasisLengthXY() const
Definition: matrix.h:300
Cap stroke_cap
Definition: paint.h:72
Join stroke_join
Definition: paint.h:73
Scalar stroke_miter
Definition: paint.h:74
Style style
Definition: paint.h:75
Color color
Definition: paint.h:68
Scalar stroke_width
Definition: paint.h:71

◆ restore()

void impeller::TextFrameDispatcher::restore ( )
overridevirtual

Reimplemented from flutter::IgnoreDrawDispatchHelper.

Definition at line 1248 of file dl_dispatcher.cc.

1248 {
1249 matrix_ = stack_.back();
1250 stack_.pop_back();
1251}

◆ rotate()

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

Implements flutter::DlOpReceiver.

Definition at line 1261 of file dl_dispatcher.cc.

1261 {
1262 matrix_ = matrix_ * Matrix::MakeRotationZ(Degrees(degrees));
1263}
static Matrix MakeRotationZ(Radians r)
Definition: matrix.h:213

◆ save()

void impeller::TextFrameDispatcher::save ( )
overridevirtual

Reimplemented from flutter::IgnoreDrawDispatchHelper.

Definition at line 1238 of file dl_dispatcher.cc.

1238 {
1239 stack_.emplace_back(matrix_);
1240}

◆ saveLayer()

void impeller::TextFrameDispatcher::saveLayer ( const SkRect bounds,
const flutter::SaveLayerOptions  options,
const flutter::DlImageFilter backdrop 
)
overridevirtual

Reimplemented from flutter::IgnoreDrawDispatchHelper.

Definition at line 1242 of file dl_dispatcher.cc.

1244 {
1245 save();
1246}

◆ scale()

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

Implements flutter::DlOpReceiver.

Definition at line 1257 of file dl_dispatcher.cc.

1257 {
1258 matrix_ = matrix_.Scale({sx, sy, 1.0f});
1259}
constexpr Matrix Scale(const Vector3 &s) const
Definition: matrix.h:252

◆ setColor()

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

Reimplemented from flutter::IgnoreAttributeDispatchHelper.

Definition at line 1338 of file dl_dispatcher.cc.

1338 {
1339 paint_.color = {
1340 color.getRedF(),
1341 color.getGreenF(),
1342 color.getBlueF(),
1343 color.getAlphaF(),
1344 };
1345}
DlColor color

◆ setDrawStyle()

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

Reimplemented from flutter::IgnoreAttributeDispatchHelper.

Definition at line 1333 of file dl_dispatcher.cc.

1333 {
1334 paint_.style = ToStyle(style);
1335}
static Paint::Style ToStyle(flutter::DlDrawStyle style)

◆ setStrokeCap()

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

Reimplemented from flutter::IgnoreAttributeDispatchHelper.

Definition at line 1358 of file dl_dispatcher.cc.

1358 {
1359 switch (cap) {
1361 paint_.stroke_cap = Cap::kButt;
1362 break;
1364 paint_.stroke_cap = Cap::kRound;
1365 break;
1367 paint_.stroke_cap = Cap::kSquare;
1368 break;
1369 }
1370}
@ kRound
adds circle
@ kButt
no stroke extension
@ kSquare
adds square

◆ setStrokeJoin()

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

Reimplemented from flutter::IgnoreAttributeDispatchHelper.

Definition at line 1373 of file dl_dispatcher.cc.

1373 {
1374 switch (join) {
1376 paint_.stroke_join = Join::kMiter;
1377 break;
1379 paint_.stroke_join = Join::kRound;
1380 break;
1382 paint_.stroke_join = Join::kBevel;
1383 break;
1384 }
1385}
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ setStrokeMiter()

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

Reimplemented from flutter::IgnoreAttributeDispatchHelper.

Definition at line 1353 of file dl_dispatcher.cc.

1353 {
1354 paint_.stroke_miter = limit;
1355}

◆ setStrokeWidth()

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

Reimplemented from flutter::IgnoreAttributeDispatchHelper.

Definition at line 1348 of file dl_dispatcher.cc.

1348 {
1349 paint_.stroke_width = width;
1350}
int32_t width

◆ skew()

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

Implements flutter::DlOpReceiver.

Definition at line 1265 of file dl_dispatcher.cc.

1265 {
1266 matrix_ = matrix_ * Matrix::MakeSkew(sx, sy);
1267}
static constexpr Matrix MakeSkew(Scalar sx, Scalar sy)
Definition: matrix.h:117

◆ transform2DAffine()

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

Implements flutter::DlOpReceiver.

Definition at line 1271 of file dl_dispatcher.cc.

1272 {
1273 matrix_ = matrix_ * Matrix::MakeColumn(
1274 mxx, myx, 0.0f, 0.0f,
1275 mxy, myy, 0.0f, 0.0f,
1276 0.0f, 0.0f, 1.0f, 0.0f,
1277 mxt, myt, 0.0f, 1.0f
1278 );
1279 }
static constexpr Matrix MakeColumn(Scalar m0, Scalar m1, Scalar m2, Scalar m3, Scalar m4, Scalar m5, Scalar m6, Scalar m7, Scalar m8, Scalar m9, Scalar m10, Scalar m11, Scalar m12, Scalar m13, Scalar m14, Scalar m15)
Definition: matrix.h:69

◆ transformFullPerspective()

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

1286 {
1287 matrix_ = matrix_ * Matrix::MakeColumn(
1288 mxx, myx, mzx, mwx,
1289 mxy, myy, mzy, mwy,
1290 mxz, myz, mzz, mwz,
1291 mxt, myt, mzt, mwt
1292 );
1293 }

◆ transformReset()

void impeller::TextFrameDispatcher::transformReset ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 1296 of file dl_dispatcher.cc.

1296 {
1297 matrix_ = Matrix();
1298}
SK_API sk_sp< PrecompileColorFilter > Matrix()

◆ translate()

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

Implements flutter::DlOpReceiver.

Definition at line 1253 of file dl_dispatcher.cc.

1253 {
1254 matrix_ = matrix_.Translate({tx, ty});
1255}
constexpr Matrix Translate(const Vector3 &t) const
Definition: matrix.h:240

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