Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::AccumulationRect Class Reference

#include <dl_accumulation_rect.h>

Public Member Functions

 AccumulationRect ()
 
void accumulate (SkScalar x, SkScalar y)
 
void accumulate (SkPoint p)
 
void accumulate (DlPoint p)
 
void accumulate (SkRect r)
 
void accumulate (DlRect r)
 
void accumulate (AccumulationRect &ar)
 
bool is_empty () const
 
bool is_not_empty () const
 
SkRect bounds () const
 
void reset ()
 
bool overlap_detected () const
 
void record_overlapping_bounds ()
 

Detailed Description

Definition at line 25 of file dl_accumulation_rect.h.

Constructor & Destructor Documentation

◆ AccumulationRect()

flutter::AccumulationRect::AccumulationRect ( )
inline

Definition at line 27 of file dl_accumulation_rect.h.

Member Function Documentation

◆ accumulate() [1/6]

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}

◆ accumulate() [2/6]

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

Definition at line 31 of file dl_accumulation_rect.h.

31{ accumulate(p.x, p.y); }
void accumulate(SkScalar x, SkScalar y)

◆ accumulate() [3/6]

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

Definition at line 33 of file dl_accumulation_rect.h.

33{ accumulate(ToSkRect(r)); }
const SkRect & ToSkRect(const DlRect &rect)

◆ accumulate() [4/6]

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

Definition at line 30 of file dl_accumulation_rect.h.

30{ accumulate(p.fX, p.fY); }

◆ accumulate() [5/6]

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

Definition at line 31 of file dl_accumulation_rect.cc.

31 {
32 if (r.isEmpty()) {
33 return;
34 }
35 if (r.fLeft < max_x_ && r.fRight > min_x_ && //
36 r.fTop < max_y_ && r.fBottom > min_y_) {
38 }
39 if (min_x_ > r.fLeft) {
40 min_x_ = r.fLeft;
41 }
42 if (min_y_ > r.fTop) {
43 min_y_ = r.fTop;
44 }
45 if (max_x_ < r.fRight) {
46 max_x_ = r.fRight;
47 }
48 if (max_y_ < r.fBottom) {
49 max_y_ = r.fBottom;
50 }
51}
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
bool isEmpty() const
Definition: SkRect.h:693
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

◆ accumulate() [6/6]

void flutter::AccumulationRect::accumulate ( SkScalar  x,
SkScalar  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}
double y
double x
SINT bool isfinite(const Vec< N, T > &v)
Definition: SkVx.h:1003

◆ bounds()

SkRect flutter::AccumulationRect::bounds ( ) const

Definition at line 75 of file dl_accumulation_rect.cc.

75 {
76 return (max_x_ >= min_x_ && max_y_ >= min_y_)
77 ? SkRect::MakeLTRB(min_x_, min_y_, max_x_, max_y_)
78 : SkRect::MakeEmpty();
79}
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ is_empty()

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

Definition at line 36 of file dl_accumulation_rect.h.

36{ return min_x_ >= max_x_ || min_y_ >= max_y_; }

◆ is_not_empty()

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

Definition at line 37 of file dl_accumulation_rect.h.

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

◆ overlap_detected()

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

Definition at line 43 of file dl_accumulation_rect.h.

43{ return overlap_detected_; }

◆ record_overlapping_bounds()

void flutter::AccumulationRect::record_overlapping_bounds ( )
inline

Definition at line 44 of file dl_accumulation_rect.h.

44{ overlap_detected_ = true; }

◆ reset()

void flutter::AccumulationRect::reset ( )

Definition at line 81 of file dl_accumulation_rect.cc.

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

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