Flutter Engine
 
Loading...
Searching...
No Matches
dl_accumulation_rect.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7namespace flutter {
8
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}
30
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}
52
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}
74
76 return (max_x_ >= min_x_ && max_y_ >= min_y_)
77 ? DlRect::MakeLTRB(min_x_, min_y_, max_x_, max_y_)
78 : DlRect();
79}
80
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}
88
89} // namespace flutter
void accumulate(DlScalar x, DlScalar y)
int32_t x
double y
impeller::Scalar DlScalar
impeller::Rect DlRect
constexpr auto GetBottom() const
Definition rect.h:357
constexpr auto GetTop() const
Definition rect.h:353
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
Definition rect.h:297
constexpr auto GetLeft() const
Definition rect.h:351
constexpr auto GetRight() const
Definition rect.h:355
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition rect.h:129