Flutter Engine
 
Loading...
Searching...
No Matches
flutter::DisplayListMatrixClipState Class Reference

#include <dl_matrix_clip_tracker.h>

Public Member Functions

 DisplayListMatrixClipState (const DlRect &cull_rect, const DlMatrix &matrix=DlMatrix())
 
 DisplayListMatrixClipState (const DisplayListMatrixClipState &other)=default
 
void resetDeviceCullRect (const DlRect &cull_rect)
 
void resetLocalCullRect (const DlRect &cull_rect)
 
bool using_4x4_matrix () const
 
bool is_matrix_invertable () const
 
bool has_perspective () const
 
const DlMatrixmatrix () const
 
DlRect GetLocalCullCoverage () const
 
DlRect GetDeviceCullCoverage () const
 
bool rect_covers_cull (const DlRect &content) const
 
bool oval_covers_cull (const DlRect &content_bounds) const
 
bool rrect_covers_cull (const DlRoundRect &content) const
 
bool rsuperellipse_covers_cull (const DlRoundSuperellipse &content) const
 
bool content_culled (const DlRect &content_bounds) const
 
bool is_cull_rect_empty () const
 
void translate (DlScalar tx, DlScalar ty)
 
void scale (DlScalar sx, DlScalar sy)
 
void skew (DlScalar skx, DlScalar sky)
 
void rotate (DlRadians angle)
 
void transform (const DlMatrix &matrix)
 
void transform2DAffine (DlScalar mxx, DlScalar mxy, DlScalar mxt, DlScalar myx, DlScalar myy, DlScalar myt)
 
void transformFullPerspective (DlScalar mxx, DlScalar mxy, DlScalar mxz, DlScalar mxt, DlScalar myx, DlScalar myy, DlScalar myz, DlScalar myt, DlScalar mzx, DlScalar mzy, DlScalar mzz, DlScalar mzt, DlScalar mwx, DlScalar mwy, DlScalar mwz, DlScalar mwt)
 
void setTransform (const DlMatrix &matrix)
 
void setIdentity ()
 
bool inverseTransform (const DisplayListMatrixClipState &other_tracker)
 
bool mapRect (DlRect *rect) const
 
bool mapRect (const DlRect &src, DlRect *mapped) const
 
bool mapAndClipRect (DlRect *rect) const
 Maps the rect by the current matrix and then clips it against the current cull rect, returning true if the result is non-empty.
 
bool mapAndClipRect (const DlRect &src, DlRect *mapped) const
 
void clipRect (const DlRect &rect, DlClipOp op, bool is_aa)
 
void clipOval (const DlRect &bounds, DlClipOp op, bool is_aa)
 
void clipRRect (const DlRoundRect &rrect, DlClipOp op, bool is_aa)
 
void clipRSuperellipse (const DlRoundSuperellipse &rse, DlClipOp op, bool is_aa)
 
void clipPath (const DlPath &path, DlClipOp op, bool is_aa)
 

Static Public Member Functions

static bool TransformedRectCoversBounds (const DlRect &local_rect, const DlMatrix &matrix, const DlRect &cull_bounds)
 Checks if the local rect, when transformed by the matrix, completely covers the indicated culling bounds.
 
static bool TransformedOvalCoversBounds (const DlRect &local_oval_bounds, const DlMatrix &matrix, const DlRect &cull_bounds)
 Checks if an oval defined by the local bounds, when transformed by the matrix, completely covers the indicated culling bounds.
 
static bool TransformedRRectCoversBounds (const DlRoundRect &local_rrect, const DlMatrix &matrix, const DlRect &cull_bounds)
 Checks if the local round rect, when transformed by the matrix, completely covers the indicated culling bounds.
 
static bool TransformedRoundSuperellipseCoversBounds (const DlRoundSuperellipse &local_rse, const DlMatrix &matrix, const DlRect &cull_bounds)
 Checks if the local round superellipse, when transformed by the matrix, completely covers the indicated culling bounds.
 

Detailed Description

Definition at line 17 of file dl_matrix_clip_tracker.h.

Constructor & Destructor Documentation

◆ DisplayListMatrixClipState() [1/2]

flutter::DisplayListMatrixClipState::DisplayListMatrixClipState ( const DlRect cull_rect,
const DlMatrix matrix = DlMatrix() 
)
explicit

Definition at line 20 of file dl_matrix_clip_tracker.cc.

22 : cull_rect_(ProtectEmpty(cull_rect)), matrix_(matrix) {}
static const DlRect & ProtectEmpty(const DlRect &rect)

◆ DisplayListMatrixClipState() [2/2]

flutter::DisplayListMatrixClipState::DisplayListMatrixClipState ( const DisplayListMatrixClipState other)
default

Member Function Documentation

◆ clipOval()

void flutter::DisplayListMatrixClipState::clipOval ( const DlRect bounds,
DlClipOp  op,
bool  is_aa 
)

Definition at line 53 of file dl_matrix_clip_tracker.cc.

55 {
56 if (!bounds.IsFinite()) {
57 return;
58 }
59 switch (op) {
61 adjustCullRect(bounds, op, is_aa);
62 break;
64 if (oval_covers_cull(bounds)) {
65 cull_rect_ = DlRect();
66 }
67 break;
68 }
69}
bool oval_covers_cull(const DlRect &content_bounds) const
impeller::Rect DlRect

References impeller::TRect< T >::IsFinite(), flutter::kDifference, flutter::kIntersect, and oval_covers_cull().

Referenced by flutter::DisplayListBuilder::ClipOval(), clipRRect(), and clipRSuperellipse().

◆ clipPath()

void flutter::DisplayListMatrixClipState::clipPath ( const DlPath path,
DlClipOp  op,
bool  is_aa 
)

Definition at line 140 of file dl_matrix_clip_tracker.cc.

142 {
143 DlRect bounds = path.GetBounds();
144 if (path.IsRect(nullptr)) {
145 return clipRect(bounds, op, is_aa);
146 }
147 switch (op) {
149 adjustCullRect(bounds, op, is_aa);
150 break;
152 break;
153 }
154}
void clipRect(const DlRect &rect, DlClipOp op, bool is_aa)
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 switch_defs.h:52

References clipRect(), flutter::kDifference, flutter::kIntersect, and flutter::path.

Referenced by flutter::DisplayListBuilder::ClipPath(), flutter::PrerollDelegate::clipPath(), and flutter::testing::TEST().

◆ clipRect()

void flutter::DisplayListMatrixClipState::clipRect ( const DlRect rect,
DlClipOp  op,
bool  is_aa 
)

Definition at line 45 of file dl_matrix_clip_tracker.cc.

47 {
48 if (rect.IsFinite()) {
49 adjustCullRect(rect, op, is_aa);
50 }
51}

References impeller::TRect< T >::IsFinite().

Referenced by clipPath(), flutter::DisplayListBuilder::ClipRect(), flutter::PrerollDelegate::clipRect(), clipRRect(), clipRSuperellipse(), and flutter::testing::TEST().

◆ clipRRect()

void flutter::DisplayListMatrixClipState::clipRRect ( const DlRoundRect rrect,
DlClipOp  op,
bool  is_aa 
)

Definition at line 85 of file dl_matrix_clip_tracker.cc.

87 {
88 DlRect bounds = rrect.GetBounds();
89 if (rrect.IsRect()) {
90 return clipRect(bounds, op, is_aa);
91 }
92 if (rrect.IsOval()) {
93 return clipOval(bounds, op, is_aa);
94 }
95 switch (op) {
97 adjustCullRect(bounds, op, is_aa);
98 break;
100 if (rrect_covers_cull(rrect)) {
101 cull_rect_ = DlRect();
102 return;
103 }
104 auto safe_rects = RoundingRadiiSafeRects(bounds, rrect.GetRadii());
105 adjustCullRect(safe_rects[0], op, is_aa);
106 adjustCullRect(safe_rects[1], op, is_aa);
107 break;
108 }
109 }
110}
bool rrect_covers_cull(const DlRoundRect &content) const
void clipOval(const DlRect &bounds, DlClipOp op, bool is_aa)

References clipOval(), clipRect(), impeller::RoundRect::GetBounds(), impeller::RoundRect::GetRadii(), impeller::RoundRect::IsOval(), impeller::RoundRect::IsRect(), flutter::kDifference, flutter::kIntersect, and rrect_covers_cull().

Referenced by flutter::DisplayListBuilder::ClipRoundRect(), flutter::PrerollDelegate::clipRRect(), and flutter::testing::TEST().

◆ clipRSuperellipse()

void flutter::DisplayListMatrixClipState::clipRSuperellipse ( const DlRoundSuperellipse rse,
DlClipOp  op,
bool  is_aa 
)

Definition at line 112 of file dl_matrix_clip_tracker.cc.

115 {
116 DlRect bounds = rse.GetBounds();
117 if (rse.IsRect()) {
118 return clipRect(bounds, op, is_aa);
119 }
120 if (rse.IsOval()) {
121 return clipOval(bounds, op, is_aa);
122 }
123 switch (op) {
125 adjustCullRect(bounds, op, is_aa);
126 break;
128 if (rsuperellipse_covers_cull(rse)) {
129 cull_rect_ = DlRect();
130 return;
131 }
132 auto safe_rects = RoundingRadiiSafeRects(bounds, rse.GetRadii());
133 adjustCullRect(safe_rects[0], op, is_aa);
134 adjustCullRect(safe_rects[1], op, is_aa);
135 break;
136 }
137 }
138}
bool rsuperellipse_covers_cull(const DlRoundSuperellipse &content) const

References clipOval(), clipRect(), impeller::RoundSuperellipse::GetBounds(), impeller::RoundSuperellipse::GetRadii(), impeller::RoundSuperellipse::IsOval(), impeller::RoundSuperellipse::IsRect(), flutter::kDifference, flutter::kIntersect, and rsuperellipse_covers_cull().

Referenced by flutter::DisplayListBuilder::ClipRoundSuperellipse(), and flutter::PrerollDelegate::clipRSuperellipse().

◆ content_culled()

bool flutter::DisplayListMatrixClipState::content_culled ( const DlRect content_bounds) const

Definition at line 156 of file dl_matrix_clip_tracker.cc.

157 {
158 if (cull_rect_.IsEmpty() || content_bounds.IsEmpty()) {
159 return true;
160 }
161 if (!is_matrix_invertable()) {
162 return true;
163 }
164 if (has_perspective()) {
165 return false;
166 }
167 DlRect mapped;
168 mapRect(content_bounds, &mapped);
169 return !mapped.IntersectsWithRect(cull_rect_);
170}
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
Definition rect.h:297

References has_perspective(), impeller::TRect< T >::IntersectsWithRect(), is_matrix_invertable(), impeller::TRect< T >::IsEmpty(), and mapRect().

Referenced by flutter::PrerollDelegate::content_culled(), and flutter::DisplayListBuilder::QuickReject().

◆ GetDeviceCullCoverage()

◆ GetLocalCullCoverage()

DlRect flutter::DisplayListMatrixClipState::GetLocalCullCoverage ( ) const

Definition at line 235 of file dl_matrix_clip_tracker.cc.

235 {
236 if (cull_rect_.IsEmpty()) {
237 return DlRect();
238 }
239 if (!is_matrix_invertable()) {
240 return DlRect();
241 }
242 if (matrix_.HasPerspective2D()) {
243 // We could do a 4-point long-form conversion, but since this is
244 // only used for culling, let's just return a non-constricting
245 // cull rect.
247 }
248 DlMatrix inverse = matrix_.Invert();
249 // We eliminated perspective above so we can use the cheaper non-clipping
250 // bounds transform method.
251 return cull_rect_.TransformBounds(inverse);
252}
static constexpr DlRect kMaxCullRect
Definition dl_builder.h:32
impeller::Matrix DlMatrix
Matrix Invert() const
Definition matrix.cc:99
constexpr bool HasPerspective2D() const
Definition matrix.h:414
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
Definition rect.h:472

References impeller::Matrix::HasPerspective2D(), impeller::Matrix::Invert(), is_matrix_invertable(), impeller::TRect< T >::IsEmpty(), flutter::DisplayListBuilder::kMaxCullRect, and impeller::TRect< T >::TransformBounds().

Referenced by flutter::DisplayListBuilder::GetLocalClipCoverage(), flutter::PrerollDelegate::local_cull_rect(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), and flutter::testing::TEST().

◆ has_perspective()

bool flutter::DisplayListMatrixClipState::has_perspective ( ) const
inline

Definition at line 37 of file dl_matrix_clip_tracker.h.

37{ return matrix_.HasPerspective(); }
constexpr bool HasPerspective() const
Definition matrix.h:418

References impeller::Matrix::HasPerspective().

Referenced by content_culled().

◆ inverseTransform()

bool flutter::DisplayListMatrixClipState::inverseTransform ( const DisplayListMatrixClipState other_tracker)

Definition at line 24 of file dl_matrix_clip_tracker.cc.

25 {
26 if (tracker.is_matrix_invertable()) {
27 matrix_ = matrix_ * tracker.matrix_.Invert();
28 return true;
29 }
30 return false;
31}

References impeller::Matrix::Invert(), and is_matrix_invertable().

◆ is_cull_rect_empty()

bool flutter::DisplayListMatrixClipState::is_cull_rect_empty ( ) const
inline

Definition at line 50 of file dl_matrix_clip_tracker.h.

50{ return cull_rect_.IsEmpty(); }

References impeller::TRect< T >::IsEmpty().

◆ is_matrix_invertable()

bool flutter::DisplayListMatrixClipState::is_matrix_invertable ( ) const
inline

Definition at line 36 of file dl_matrix_clip_tracker.h.

36{ return matrix_.IsInvertible(); }
bool IsInvertible() const
Definition matrix.h:321

References impeller::Matrix::IsInvertible().

Referenced by content_culled(), GetLocalCullCoverage(), and inverseTransform().

◆ mapAndClipRect() [1/2]

bool flutter::DisplayListMatrixClipState::mapAndClipRect ( const DlRect src,
DlRect mapped 
) const

Definition at line 33 of file dl_matrix_clip_tracker.cc.

34 {
35 DlRect dl_mapped = src.TransformAndClipBounds(matrix_);
36 auto dl_intersected = dl_mapped.Intersection(cull_rect_);
37 if (dl_intersected.has_value()) {
38 *mapped = dl_intersected.value();
39 return true;
40 }
41 *mapped = DlRect();
42 return false;
43}
constexpr std::optional< TRect > Intersection(const TRect &o) const
Definition rect.h:528
constexpr TRect TransformAndClipBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle, clipped against the near clippin...
Definition rect.h:438

References impeller::TRect< T >::Intersection(), and impeller::TRect< T >::TransformAndClipBounds().

◆ mapAndClipRect() [2/2]

bool flutter::DisplayListMatrixClipState::mapAndClipRect ( DlRect rect) const
inline

Maps the rect by the current matrix and then clips it against the current cull rect, returning true if the result is non-empty.

Definition at line 104 of file dl_matrix_clip_tracker.h.

104 {
105 return mapAndClipRect(*rect, rect);
106 }
bool mapAndClipRect(DlRect *rect) const
Maps the rect by the current matrix and then clips it against the current cull rect,...

References mapAndClipRect().

Referenced by mapAndClipRect().

◆ mapRect() [1/2]

bool flutter::DisplayListMatrixClipState::mapRect ( const DlRect src,
DlRect mapped 
) const
inline

Definition at line 97 of file dl_matrix_clip_tracker.h.

97 {
98 *mapped = src.TransformAndClipBounds(matrix_);
99 return matrix_.IsAligned2D();
100 }
constexpr bool IsAligned2D(Scalar tolerance=0) const
Definition matrix.h:424

References impeller::Matrix::IsAligned2D(), and impeller::TRect< T >::TransformAndClipBounds().

◆ mapRect() [2/2]

bool flutter::DisplayListMatrixClipState::mapRect ( DlRect rect) const
inline

Definition at line 96 of file dl_matrix_clip_tracker.h.

96{ return mapRect(*rect, rect); }

References mapRect().

Referenced by flutter::DiffContext::AddLayerBounds(), content_culled(), mapRect(), and resetLocalCullRect().

◆ matrix()

◆ oval_covers_cull()

bool flutter::DisplayListMatrixClipState::oval_covers_cull ( const DlRect content_bounds) const

Definition at line 286 of file dl_matrix_clip_tracker.cc.

286 {
287 return TransformedOvalCoversBounds(bounds, matrix_, cull_rect_);
288}
static bool TransformedOvalCoversBounds(const DlRect &local_oval_bounds, const DlMatrix &matrix, const DlRect &cull_bounds)
Checks if an oval defined by the local bounds, when transformed by the matrix, completely covers the ...

References TransformedOvalCoversBounds().

Referenced by clipOval(), flutter::testing::TEST(), flutter::testing::TEST(), and flutter::testing::TEST().

◆ rect_covers_cull()

bool flutter::DisplayListMatrixClipState::rect_covers_cull ( const DlRect content) const

Definition at line 254 of file dl_matrix_clip_tracker.cc.

254 {
255 return TransformedRectCoversBounds(content, matrix_, cull_rect_);
256}
static bool TransformedRectCoversBounds(const DlRect &local_rect, const DlMatrix &matrix, const DlRect &cull_bounds)
Checks if the local rect, when transformed by the matrix, completely covers the indicated culling bou...
union flutter::testing::@2824::KeyboardChange::@78 content

References content, and TransformedRectCoversBounds().

Referenced by flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), and flutter::testing::TEST().

◆ resetDeviceCullRect()

void flutter::DisplayListMatrixClipState::resetDeviceCullRect ( const DlRect cull_rect)

Definition at line 172 of file dl_matrix_clip_tracker.cc.

172 {
173 if (cull_rect.IsEmpty()) {
174 cull_rect_ = DlRect();
175 } else {
176 cull_rect_ = cull_rect;
177 }
178}

References impeller::TRect< T >::IsEmpty().

◆ resetLocalCullRect()

void flutter::DisplayListMatrixClipState::resetLocalCullRect ( const DlRect cull_rect)

Definition at line 180 of file dl_matrix_clip_tracker.cc.

180 {
181 if (!cull_rect.IsEmpty()) {
182 mapRect(cull_rect, &cull_rect_);
183 if (!cull_rect_.IsEmpty()) {
184 return;
185 }
186 }
187 cull_rect_ = DlRect();
188}

References impeller::TRect< T >::IsEmpty(), and mapRect().

◆ rotate()

void flutter::DisplayListMatrixClipState::rotate ( DlRadians  angle)
inline

Definition at line 61 of file dl_matrix_clip_tracker.h.

61 {
62 matrix_ = matrix_ * DlMatrix::MakeRotationZ(angle);
63 }
static Matrix MakeRotationZ(Radians r)
Definition matrix.h:223

References impeller::Matrix::MakeRotationZ().

Referenced by flutter::DisplayListBuilder::Rotate(), flutter::testing::TEST(), flutter::testing::TEST(), and flutter::testing::TEST().

◆ rrect_covers_cull()

bool flutter::DisplayListMatrixClipState::rrect_covers_cull ( const DlRoundRect content) const

Definition at line 317 of file dl_matrix_clip_tracker.cc.

318 {
319 return TransformedRRectCoversBounds(content, matrix_, cull_rect_);
320}
static bool TransformedRRectCoversBounds(const DlRoundRect &local_rrect, const DlMatrix &matrix, const DlRect &cull_bounds)
Checks if the local round rect, when transformed by the matrix, completely covers the indicated culli...

References content, and TransformedRRectCoversBounds().

Referenced by clipRRect(), and flutter::testing::TEST().

◆ rsuperellipse_covers_cull()

bool flutter::DisplayListMatrixClipState::rsuperellipse_covers_cull ( const DlRoundSuperellipse content) const

Definition at line 365 of file dl_matrix_clip_tracker.cc.

366 {
367 return TransformedRoundSuperellipseCoversBounds(content, matrix_, cull_rect_);
368}
static bool TransformedRoundSuperellipseCoversBounds(const DlRoundSuperellipse &local_rse, const DlMatrix &matrix, const DlRect &cull_bounds)
Checks if the local round superellipse, when transformed by the matrix, completely covers the indicat...

References content, and TransformedRoundSuperellipseCoversBounds().

Referenced by clipRSuperellipse().

◆ scale()

void flutter::DisplayListMatrixClipState::scale ( DlScalar  sx,
DlScalar  sy 
)
inline

◆ setIdentity()

void flutter::DisplayListMatrixClipState::setIdentity ( )
inline

Definition at line 90 of file dl_matrix_clip_tracker.h.

90{ matrix_ = DlMatrix(); }

Referenced by flutter::DisplayListBuilder::TransformReset().

◆ setTransform()

void flutter::DisplayListMatrixClipState::setTransform ( const DlMatrix matrix)
inline

◆ skew()

void flutter::DisplayListMatrixClipState::skew ( DlScalar  skx,
DlScalar  sky 
)
inline

Definition at line 58 of file dl_matrix_clip_tracker.h.

58 {
59 matrix_ = matrix_ * DlMatrix::MakeSkew(skx, sky);
60 }
static constexpr Matrix MakeSkew(Scalar sx, Scalar sy)
Definition matrix.h:127

References impeller::Matrix::MakeSkew().

Referenced by flutter::DisplayListBuilder::Skew(), and flutter::testing::TEST().

◆ transform()

void flutter::DisplayListMatrixClipState::transform ( const DlMatrix matrix)
inline

Definition at line 64 of file dl_matrix_clip_tracker.h.

64{ matrix_ = matrix_ * matrix; }

References matrix().

Referenced by flutter::testing::TEST(), and flutter::PrerollDelegate::transform().

◆ transform2DAffine()

void flutter::DisplayListMatrixClipState::transform2DAffine ( DlScalar  mxx,
DlScalar  mxy,
DlScalar  mxt,
DlScalar  myx,
DlScalar  myy,
DlScalar  myt 
)
inline

Definition at line 66 of file dl_matrix_clip_tracker.h.

68 {
69 matrix_ = matrix_ * DlMatrix::MakeColumn(
70 mxx, myx, 0.0f, 0.0f,
71 mxy, myy, 0.0f, 0.0f,
72 0.0f, 0.0f, 1.0f, 0.0f,
73 mxt, myt, 0.0f, 1.0f
74 );
75 }
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

References impeller::Matrix::MakeColumn().

Referenced by flutter::testing::TEST(), and flutter::DisplayListBuilder::Transform2DAffine().

◆ TransformedOvalCoversBounds()

bool flutter::DisplayListMatrixClipState::TransformedOvalCoversBounds ( const DlRect local_oval_bounds,
const DlMatrix matrix,
const DlRect cull_bounds 
)
static

Checks if an oval defined by the local bounds, when transformed by the matrix, completely covers the indicated culling bounds.

This utility method helps answer the question of whether a clip oval being intersected under a transform is essentially obsolete because it will not reduce the already existing clip culling bounds.

Definition at line 290 of file dl_matrix_clip_tracker.cc.

293 {
294 if (local_oval_bounds.IsEmpty()) {
295 return false;
296 }
297 if (cull_bounds.IsEmpty()) {
298 return true;
299 }
300 DlPoint corners[4];
301 if (!GetLocalCorners(corners, cull_bounds, matrix)) {
302 return false;
303 }
304 DlPoint center = local_oval_bounds.GetCenter();
305 DlSize scale = 2.0 / local_oval_bounds.GetSize();
306 for (auto corner : corners) {
307 if (!local_oval_bounds.Contains(corner)) {
308 return false;
309 }
310 if (((corner - center) * scale).GetLengthSquared() >= 1.0) {
311 return false;
312 }
313 }
314 return true;
315}
void scale(DlScalar sx, DlScalar sy)
impeller::Size DlSize
impeller::Point DlPoint

References impeller::TRect< T >::Contains(), impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), impeller::TRect< T >::IsEmpty(), matrix(), and scale().

Referenced by oval_covers_cull(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), TransformedRoundSuperellipseCoversBounds(), and TransformedRRectCoversBounds().

◆ TransformedRectCoversBounds()

bool flutter::DisplayListMatrixClipState::TransformedRectCoversBounds ( const DlRect local_rect,
const DlMatrix matrix,
const DlRect cull_bounds 
)
static

Checks if the local rect, when transformed by the matrix, completely covers the indicated culling bounds.

This utility method helps answer the question of whether a clip rectangle being intersected under a transform is essentially obsolete because it will not reduce the already existing clip culling bounds.

Definition at line 258 of file dl_matrix_clip_tracker.cc.

261 {
262 if (local_rect.IsEmpty()) {
263 return false;
264 }
265 if (cull_bounds.IsEmpty()) {
266 return true;
267 }
268 if (matrix.IsAligned2D()) {
269 // This transform-to-device calculation is faster and more accurate
270 // for rect-to-rect aligned transformations, but not accurate under
271 // (non-quadrant) rotations and skews.
272 return local_rect.TransformAndClipBounds(matrix).Contains(cull_bounds);
273 }
274 DlPoint corners[4];
275 if (!GetLocalCorners(corners, cull_bounds, matrix)) {
276 return false;
277 }
278 for (auto corner : corners) {
279 if (!local_rect.ContainsInclusive(corner)) {
280 return false;
281 }
282 }
283 return true;
284}

References impeller::TRect< T >::Contains(), impeller::TRect< T >::ContainsInclusive(), impeller::Matrix::IsAligned2D(), impeller::TRect< T >::IsEmpty(), matrix(), and impeller::TRect< T >::TransformAndClipBounds().

Referenced by rect_covers_cull(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), TransformedRoundSuperellipseCoversBounds(), and TransformedRRectCoversBounds().

◆ TransformedRoundSuperellipseCoversBounds()

bool flutter::DisplayListMatrixClipState::TransformedRoundSuperellipseCoversBounds ( const DlRoundSuperellipse local_rse,
const DlMatrix matrix,
const DlRect cull_bounds 
)
static

Checks if the local round superellipse, when transformed by the matrix, completely covers the indicated culling bounds.

This utility method helps answer the question of whether a clip round superellipse being intersected under a transform is essentially obsolete because it will not reduce the already existing clip culling bounds.

Definition at line 370 of file dl_matrix_clip_tracker.cc.

373 {
374 if (local_rse.IsEmpty()) {
375 return false;
376 }
377 if (cull_bounds.IsEmpty()) {
378 return true;
379 }
380 if (local_rse.IsRect()) {
381 return TransformedRectCoversBounds(local_rse.GetBounds(), matrix,
382 cull_bounds);
383 }
384 if (local_rse.IsOval()) {
385 return TransformedOvalCoversBounds(local_rse.GetBounds(), matrix,
386 cull_bounds);
387 }
388 DlPoint corners[4];
389 if (!GetLocalCorners(corners, cull_bounds, matrix)) {
390 return false;
391 }
392 auto outer = local_rse.GetBounds();
394 outer, local_rse.GetRadii());
395 for (auto corner : corners) {
396 if (!outer.Contains(corner)) {
397 return false;
398 }
399 if (!param.Contains(corner)) {
400 return false;
401 }
402 }
403 return true;
404}
static RoundSuperellipseParam MakeBoundsRadii(const Rect &bounds, const RoundingRadii &radii)

References impeller::RoundSuperellipse::GetBounds(), impeller::RoundSuperellipse::GetRadii(), impeller::TRect< T >::IsEmpty(), impeller::RoundSuperellipse::IsEmpty(), impeller::RoundSuperellipse::IsOval(), impeller::RoundSuperellipse::IsRect(), impeller::RoundSuperellipseParam::MakeBoundsRadii(), matrix(), TransformedOvalCoversBounds(), and TransformedRectCoversBounds().

Referenced by rsuperellipse_covers_cull().

◆ TransformedRRectCoversBounds()

bool flutter::DisplayListMatrixClipState::TransformedRRectCoversBounds ( const DlRoundRect local_rrect,
const DlMatrix matrix,
const DlRect cull_bounds 
)
static

Checks if the local round rect, when transformed by the matrix, completely covers the indicated culling bounds.

This utility method helps answer the question of whether a clip rrect being intersected under a transform is essentially obsolete because it will not reduce the already existing clip culling bounds.

Definition at line 322 of file dl_matrix_clip_tracker.cc.

325 {
326 if (local_rrect.IsEmpty()) {
327 return false;
328 }
329 if (cull_bounds.IsEmpty()) {
330 return true;
331 }
332 if (local_rrect.IsRect()) {
333 return TransformedRectCoversBounds(local_rrect.GetBounds(), matrix,
334 cull_bounds);
335 }
336 if (local_rrect.IsOval()) {
337 return TransformedOvalCoversBounds(local_rrect.GetBounds(), matrix,
338 cull_bounds);
339 }
340 if (!local_rrect.GetRadii().AreAllCornersSame()) {
341 return false;
342 }
343 DlPoint corners[4];
344 if (!GetLocalCorners(corners, cull_bounds, matrix)) {
345 return false;
346 }
347 auto outer = local_rrect.GetBounds();
348 auto center = outer.GetCenter();
349 auto radii = local_rrect.GetRadii().top_left;
350 auto inner = outer.GetSize() * 0.5 - radii;
351 auto scale = 1.0 / radii;
352 for (auto corner : corners) {
353 if (!outer.Contains(corner)) {
354 return false;
355 }
356 auto rel = (corner - center).Abs() - inner;
357 if (rel.x > 0.0f && rel.y > 0.0f &&
358 (rel * scale).GetLengthSquared() >= 1.0f) {
359 return false;
360 }
361 }
362 return true;
363}

References impeller::RoundingRadii::AreAllCornersSame(), impeller::RoundRect::GetBounds(), impeller::RoundRect::GetRadii(), impeller::TRect< T >::IsEmpty(), impeller::RoundRect::IsEmpty(), impeller::RoundRect::IsOval(), impeller::RoundRect::IsRect(), matrix(), scale(), impeller::RoundingRadii::top_left, TransformedOvalCoversBounds(), and TransformedRectCoversBounds().

Referenced by rrect_covers_cull(), and flutter::testing::TEST().

◆ transformFullPerspective()

void flutter::DisplayListMatrixClipState::transformFullPerspective ( DlScalar  mxx,
DlScalar  mxy,
DlScalar  mxz,
DlScalar  mxt,
DlScalar  myx,
DlScalar  myy,
DlScalar  myz,
DlScalar  myt,
DlScalar  mzx,
DlScalar  mzy,
DlScalar  mzz,
DlScalar  mzt,
DlScalar  mwx,
DlScalar  mwy,
DlScalar  mwz,
DlScalar  mwt 
)
inline

Definition at line 76 of file dl_matrix_clip_tracker.h.

80 {
81 matrix_ = matrix_ * DlMatrix::MakeColumn(
82 mxx, myx, mzx, mwx,
83 mxy, myy, mzy, mwy,
84 mxz, myz, mzz, mwz,
85 mxt, myt, mzt, mwt
86 );
87 }

References impeller::Matrix::MakeColumn().

Referenced by flutter::testing::TEST(), flutter::testing::TEST(), and flutter::DisplayListBuilder::TransformFullPerspective().

◆ translate()

void flutter::DisplayListMatrixClipState::translate ( DlScalar  tx,
DlScalar  ty 
)
inline

Definition at line 52 of file dl_matrix_clip_tracker.h.

52 {
53 matrix_ = matrix_.Translate({tx, ty});
54 }
constexpr Matrix Translate(const Vector3 &t) const
Definition matrix.h:263

References impeller::Matrix::Translate().

Referenced by flutter::testing::TEST(), flutter::DisplayListBuilder::Translate(), and flutter::PrerollDelegate::translate().

◆ using_4x4_matrix()

bool flutter::DisplayListMatrixClipState::using_4x4_matrix ( ) const
inline

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