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

#include <dl_accumulation_rect.h>

Public Member Functions

 AccumulationRect ()
 
void accumulate (DlScalar x, DlScalar y)
 
void accumulate (DlPoint p)
 
void accumulate (DlRect r)
 
void accumulate (AccumulationRect &ar)
 
bool is_empty () const
 
bool is_not_empty () const
 
DlRect GetBounds () const
 
void reset ()
 
bool overlap_detected () const
 
void record_overlapping_bounds ()
 

Detailed Description

Definition at line 21 of file dl_accumulation_rect.h.

Constructor & Destructor Documentation

◆ AccumulationRect()

flutter::AccumulationRect::AccumulationRect ( )
inline

Definition at line 23 of file dl_accumulation_rect.h.

References reset().

Member Function Documentation

◆ accumulate() [1/4]

void flutter::AccumulationRect::accumulate ( AccumulationRect ar)

Definition at line 53 of file dl_accumulation_rect.cc.

53 {
54 if (ar.is_empty()) {
55 return;
56 }
57 if (ar.min_x_ < max_x_ && ar.max_x_ > min_x_ && //
58 ar.min_y_ < max_y_ && ar.max_y_ > min_y_) {
60 }
61 if (min_x_ > ar.min_x_) {
62 min_x_ = ar.min_x_;
63 }
64 if (min_y_ > ar.min_y_) {
65 min_y_ = ar.min_y_;
66 }
67 if (max_x_ < ar.max_x_) {
68 max_x_ = ar.max_x_;
69 }
70 if (max_y_ < ar.max_y_) {
71 max_y_ = ar.max_y_;
72 }
73}

References is_empty(), and record_overlapping_bounds().

◆ accumulate() [2/4]

void flutter::AccumulationRect::accumulate ( DlPoint  p)
inline

Definition at line 26 of file dl_accumulation_rect.h.

26{ accumulate(p.x, p.y); }
void accumulate(DlScalar x, DlScalar y)

References accumulate(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by accumulate().

◆ accumulate() [3/4]

void flutter::AccumulationRect::accumulate ( DlRect  r)

Definition at line 31 of file dl_accumulation_rect.cc.

31 {
32 if (r.IsEmpty()) {
33 return;
34 }
35 if (r.GetLeft() < max_x_ && r.GetRight() > min_x_ && //
36 r.GetTop() < max_y_ && r.GetBottom() > min_y_) {
38 }
39 if (min_x_ > r.GetLeft()) {
40 min_x_ = r.GetLeft();
41 }
42 if (min_y_ > r.GetTop()) {
43 min_y_ = r.GetTop();
44 }
45 if (max_x_ < r.GetRight()) {
46 max_x_ = r.GetRight();
47 }
48 if (max_y_ < r.GetBottom()) {
49 max_y_ = r.GetBottom();
50 }
51}

References impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetTop(), impeller::TRect< T >::IsEmpty(), and record_overlapping_bounds().

◆ accumulate() [4/4]

void flutter::AccumulationRect::accumulate ( DlScalar  x,
DlScalar  y 
)

Definition at line 9 of file dl_accumulation_rect.cc.

9 {
10 if (!std::isfinite(x) || !std::isfinite(y)) {
11 return;
12 }
13 if (x >= min_x_ && x < max_x_ && y >= min_y_ && y < max_y_) {
15 return;
16 }
17 if (min_x_ > x) {
18 min_x_ = x;
19 }
20 if (min_y_ > y) {
21 min_y_ = y;
22 }
23 if (max_x_ < x) {
24 max_x_ = x;
25 }
26 if (max_y_ < y) {
27 max_y_ = y;
28 }
29}
int32_t x
double y

References record_overlapping_bounds(), x, and y.

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

◆ GetBounds()

DlRect flutter::AccumulationRect::GetBounds ( ) const

Definition at line 75 of file dl_accumulation_rect.cc.

75 {
76 return (max_x_ >= min_x_ && max_y_ >= min_y_)
77 ? DlRect::MakeLTRB(min_x_, min_y_, max_x_, max_y_)
78 : DlRect();
79}
impeller::Rect DlRect
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition rect.h:129

References impeller::TRect< Scalar >::MakeLTRB().

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

◆ is_empty()

bool flutter::AccumulationRect::is_empty ( ) const
inline

◆ is_not_empty()

bool flutter::AccumulationRect::is_not_empty ( ) const
inline

Definition at line 31 of file dl_accumulation_rect.h.

31{ return min_x_ < max_x_ && min_y_ < max_y_; }

◆ overlap_detected()

bool flutter::AccumulationRect::overlap_detected ( ) const
inline

◆ record_overlapping_bounds()

void flutter::AccumulationRect::record_overlapping_bounds ( )
inline

Definition at line 38 of file dl_accumulation_rect.h.

38{ overlap_detected_ = true; }

Referenced by accumulate(), accumulate(), and accumulate().

◆ reset()

void flutter::AccumulationRect::reset ( )

Definition at line 81 of file dl_accumulation_rect.cc.

81 {
82 min_x_ = std::numeric_limits<DlScalar>::infinity();
83 min_y_ = std::numeric_limits<DlScalar>::infinity();
84 max_x_ = -std::numeric_limits<DlScalar>::infinity();
85 max_y_ = -std::numeric_limits<DlScalar>::infinity();
86 overlap_detected_ = false;
87}

Referenced by AccumulationRect().


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