| Flutter Impeller |

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:

## 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

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

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

## Member Function Documentation

## ◆ drawDisplayList()

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

Definition at line 1335 of file dl_dispatcher.cc.

1337 {
1338 [[maybe_unused]] size_t stack_depth = stack_.size();
1339 save();
1340 display_list->Dispatch(*this);
1341 restore();
1342 FML_DCHECK(stack_depth == stack_.size());
1343 }

References restore(), and save().

## ◆ drawTextFrame()

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

Definition at line 1311 of file dl_dispatcher.cc.

1314 {
1315 GlyphProperties properties;
1316 if (paint_.style == Paint::Style::kStroke) {
1317 properties.stroke = true;
1318 properties.stroke_cap = paint_.stroke_cap;
1319 properties.stroke_join = paint_.stroke_join;
1320 properties.stroke_miter = paint_.stroke_miter;
1321 properties.stroke_width = paint_.stroke_width;
1322 }
1323 if (text_frame->HasColor()) {
1324 properties.color = paint_.color;
1325 }
1326 auto scale =
1327 (matrix_ * Matrix::MakeTranslation(Point(x, y))).GetMaxBasisLengthXY();
1328 renderer_.GetLazyGlyphAtlas()->AddTextFrame(*text_frame, //
1329 scale, //
1330 Point(x, y), //
1331 properties //
1332 );
1333 }

References impeller::GlyphProperties::color, impeller::Paint::color, impeller::ContentContext::GetLazyGlyphAtlas(), impeller::Paint::kStroke, impeller::Matrix::MakeTranslation(), scale(), impeller::GlyphProperties::stroke, impeller::GlyphProperties::stroke_cap, impeller::Paint::stroke_cap, impeller::GlyphProperties::stroke_join, impeller::Paint::stroke_join, impeller::GlyphProperties::stroke_miter, impeller::Paint::stroke_miter, impeller::GlyphProperties::stroke_width, impeller::Paint::stroke_width, and impeller::Paint::style.

## ◆ restore()

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

Definition at line 1259 of file dl_dispatcher.cc.

1259 {
1260 matrix_ = stack_.back();
1261 stack_.pop_back();
1262 }

Referenced by drawDisplayList().

## ◆ rotate()

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

Definition at line 1272 of file dl_dispatcher.cc.

1272 {
1273 matrix_ = matrix_ * Matrix::MakeRotationZ(Degrees(degrees));
1274 }

References impeller::Matrix::MakeRotationZ().

## ◆ save()

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

Definition at line 1249 of file dl_dispatcher.cc.

1249 {
1250 stack_.emplace_back(matrix_);
1251 }

Referenced by drawDisplayList(), and saveLayer().

## ◆ saveLayer()

void impeller::TextFrameDispatcher::saveLayer | ( | const SkRect & | bounds,
|  | const flutter::SaveLayerOptions | options,
|  | const flutter::DlImageFilter * | backdrop
| ) |  |
| override

Definition at line 1253 of file dl_dispatcher.cc.

1255 {
1256 save();
1257 }

References save().

## ◆ scale()

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

Definition at line 1268 of file dl_dispatcher.cc.

1268 {
1269 matrix_ = matrix_.Scale({sx, sy, 1.0f});
1270 }

References impeller::Matrix::Scale().

Referenced by drawTextFrame().

## ◆ setColor()

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

Definition at line 1351 of file dl_dispatcher.cc.

1351 {
1352 paint_.color = {
1353 color.getRedF(),
1354 color.getGreenF(),
1355 color.getBlueF(),
1356 color.getAlphaF(),
1357 };
1358 }

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

## ◆ setDrawStyle()

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

Definition at line 1346 of file dl_dispatcher.cc.

1346 {
1347 paint_.style = ToStyle(style);
1348 }

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

## ◆ setStrokeCap()

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

Definition at line 1371 of file dl_dispatcher.cc.

1371 {
1372 switch (cap) {
1373 case flutter::DlStrokeCap::kButt:
1374 paint_.stroke_cap = Cap::kButt;
1375 break;
1376 case flutter::DlStrokeCap::kRound:
1377 paint_.stroke_cap = Cap::kRound;
1378 break;
1379 case flutter::DlStrokeCap::kSquare:
1380 paint_.stroke_cap = Cap::kSquare;
1381 break;
1382 }
1383 }

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

## ◆ setStrokeJoin()

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

Definition at line 1386 of file dl_dispatcher.cc.

1386 {
1387 switch (join) {
1388 case flutter::DlStrokeJoin::kMiter:
1389 paint_.stroke_join = Join::kMiter;
1390 break;
1391 case flutter::DlStrokeJoin::kRound:
1392 paint_.stroke_join = Join::kRound;
1393 break;
1394 case flutter::DlStrokeJoin::kBevel:
1395 paint_.stroke_join = Join::kBevel;
1396 break;
1397 }
1398 }

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

## ◆ setStrokeMiter()

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

Definition at line 1366 of file dl_dispatcher.cc.

1366 {
1367 paint_.stroke_miter = limit;
1368 }

References impeller::Paint::stroke_miter.

## ◆ setStrokeWidth()

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

Definition at line 1361 of file dl_dispatcher.cc.

1361 {
1362 paint_.stroke_width = width;
1363 }

References impeller::Paint::stroke_width.

## ◆ skew()

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

Definition at line 1276 of file dl_dispatcher.cc.

1276 {
1277 matrix_ = matrix_ * Matrix::MakeSkew(sx, sy);
1278 }

References impeller::Matrix::MakeSkew().

## ◆ transform2DAffine()

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

Definition at line 1282 of file dl_dispatcher.cc.

1283 {
1284 matrix_ = matrix_ * Matrix::MakeColumn(
1285 mxx, myx, 0.0f, 0.0f,
1286 mxy, myy, 0.0f, 0.0f,
1287 0.0f, 0.0f, 1.0f, 0.0f,
1288 mxt, myt, 0.0f, 1.0f
1289 );
1290 }

References impeller::Matrix::MakeColumn().

## ◆ 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
| ) |  |
| override

Definition at line 1293 of file dl_dispatcher.cc.

1297 {
1298 matrix_ = matrix_ * Matrix::MakeColumn(
1299 mxx, myx, mzx, mwx,
1300 mxy, myy, mzy, mwy,
1301 mxz, myz, mzz, mwz,
1302 mxt, myt, mzt, mwt
1303 );
1304 }

References impeller::Matrix::MakeColumn().

## ◆ transformReset()

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

Definition at line 1307 of file dl_dispatcher.cc.

1307 {
1308 matrix_ = Matrix();
1309 }

## ◆ translate()

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

Definition at line 1264 of file dl_dispatcher.cc.

1264 {
1265 matrix_ = matrix_.Translate({tx, ty});
1266 }

References impeller::Matrix::Translate().

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

- impeller/display_list/dl_dispatcher.h
- impeller/display_list/dl_dispatcher.cc

impeller::Matrix::MakeSkew
static constexpr Matrix MakeSkew(Scalar sx, Scalar sy)
Definition: matrix.h:117
impeller::Paint::stroke_cap
Cap stroke_cap
Definition: paint.h:72
impeller::Cap::kRound
@ kRound
impeller::Cap::kSquare
@ kSquare
impeller::ContentContext::GetLazyGlyphAtlas
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas() const
Definition: content_context.h:720
impeller::Paint::Style::kStroke
@ kStroke
impeller::TextFrameDispatcher::restore
void restore() override
Definition: dl_dispatcher.cc:1259
impeller::Paint::color
Color color
Definition: paint.h:68
impeller::TextFrameDispatcher::save
void save() override
Definition: dl_dispatcher.cc:1249
impeller::Cap::kButt
@ kButt
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
impeller::Join::kMiter
@ kMiter
impeller::Paint::stroke_miter
Scalar stroke_miter
Definition: paint.h:74
impeller::Point
TPoint< Scalar > Point
Definition: point.h:322
impeller::Paint::style
Style style
Definition: paint.h:75
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:177
impeller::Matrix::Translate
constexpr Matrix Translate(const Vector3 &t) const
Definition: matrix.h:240
impeller::Matrix::MakeColumn
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
impeller::Join::kRound
@ kRound
impeller::Join::kBevel
@ kBevel
impeller::Matrix::MakeRotationZ
static Matrix MakeRotationZ(Radians r)
Definition: matrix.h:213
color
DlColor color
Definition: dl_golden_blur_unittests.cc:23
impeller::TextFrameDispatcher::scale
void scale(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:1268
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:71
impeller::Matrix::Scale
constexpr Matrix Scale(const Vector3 &s) const
Definition: matrix.h:252
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:73