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

1237 : 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 1325 of file dl_dispatcher.cc.

1327 {
1328 [[maybe_unused]] size_t stack_depth = stack_.size();
1329 save();
1330 display_list->Dispatch(*this);
1331 restore();
1332 FML_DCHECK(stack_depth == stack_.size());
1333 }

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

1304 {
1305 GlyphProperties properties;
1306 if (paint_.style == Paint::Style::kStroke) {
1307 properties.stroke = true;
1308 properties.stroke_cap = paint_.stroke_cap;
1309 properties.stroke_join = paint_.stroke_join;
1310 properties.stroke_miter = paint_.stroke_miter;
1311 properties.stroke_width = paint_.stroke_width;
1312 }
1313 if (text_frame->HasColor()) {
1314 properties.color = paint_.color;
1315 }
1316 auto scale =
1317 (matrix_ * Matrix::MakeTranslation(Point(x, y))).GetMaxBasisLengthXY();
1318 renderer_.GetLazyGlyphAtlas()->AddTextFrame(*text_frame, //
1319 scale, //
1320 Point(x, y), //
1321 properties //
1322 );
1323 }

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

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

Referenced by drawDisplayList().

## ◆ rotate()

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

Definition at line 1262 of file dl_dispatcher.cc.

1262 {
1263 matrix_ = matrix_ * Matrix::MakeRotationZ(Degrees(degrees));
1264 }

References impeller::Matrix::MakeRotationZ().

## ◆ save()

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

Definition at line 1239 of file dl_dispatcher.cc.

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

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

1245 {
1246 save();
1247 }

References save().

## ◆ scale()

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

Definition at line 1258 of file dl_dispatcher.cc.

1258 {
1259 matrix_ = matrix_.Scale({sx, sy, 1.0f});
1260 }

References impeller::Matrix::Scale().

Referenced by drawTextFrame().

## ◆ setColor()

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

Definition at line 1341 of file dl_dispatcher.cc.

1341 {
1342 paint_.color = {
1343 color.getRedF(),
1344 color.getGreenF(),
1345 color.getBlueF(),
1346 color.getAlphaF(),
1347 };
1348 }

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

## ◆ setDrawStyle()

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

Definition at line 1336 of file dl_dispatcher.cc.

1336 {
1337 paint_.style = ToStyle(style);
1338 }

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

## ◆ setStrokeCap()

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

Definition at line 1361 of file dl_dispatcher.cc.

1361 {
1362 switch (cap) {
1363 case flutter::DlStrokeCap::kButt:
1364 paint_.stroke_cap = Cap::kButt;
1365 break;
1366 case flutter::DlStrokeCap::kRound:
1367 paint_.stroke_cap = Cap::kRound;
1368 break;
1369 case flutter::DlStrokeCap::kSquare:
1370 paint_.stroke_cap = Cap::kSquare;
1371 break;
1372 }
1373 }

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

## ◆ setStrokeJoin()

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

Definition at line 1376 of file dl_dispatcher.cc.

1376 {
1377 switch (join) {
1378 case flutter::DlStrokeJoin::kMiter:
1379 paint_.stroke_join = Join::kMiter;
1380 break;
1381 case flutter::DlStrokeJoin::kRound:
1382 paint_.stroke_join = Join::kRound;
1383 break;
1384 case flutter::DlStrokeJoin::kBevel:
1385 paint_.stroke_join = Join::kBevel;
1386 break;
1387 }
1388 }

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

## ◆ setStrokeMiter()

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

Definition at line 1356 of file dl_dispatcher.cc.

1356 {
1357 paint_.stroke_miter = limit;
1358 }

References impeller::Paint::stroke_miter.

## ◆ setStrokeWidth()

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

Definition at line 1351 of file dl_dispatcher.cc.

1351 {
1352 paint_.stroke_width = width;
1353 }

References impeller::Paint::stroke_width.

## ◆ skew()

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

Definition at line 1266 of file dl_dispatcher.cc.

1266 {
1267 matrix_ = matrix_ * Matrix::MakeSkew(sx, sy);
1268 }

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

1273 {
1274 matrix_ = matrix_ * Matrix::MakeColumn(
1275 mxx, myx, 0.0f, 0.0f,
1276 mxy, myy, 0.0f, 0.0f,
1277 0.0f, 0.0f, 1.0f, 0.0f,
1278 mxt, myt, 0.0f, 1.0f
1279 );
1280 }

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

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

References impeller::Matrix::MakeColumn().

## ◆ transformReset()

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

Definition at line 1297 of file dl_dispatcher.cc.

1297 {
1298 matrix_ = Matrix();
1299 }

## ◆ translate()

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

Definition at line 1254 of file dl_dispatcher.cc.

1254 {
1255 matrix_ = matrix_.Translate({tx, ty});
1256 }

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:1249
impeller::Paint::color
Color color
Definition: paint.h:68
impeller::TextFrameDispatcher::save
void save() override
Definition: dl_dispatcher.cc:1239
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:1258
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