Flutter Engine
The Flutter Engine
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
5#include "flutter/display_list/utils/dl_accumulation_rect.h"
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.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}
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 ? SkRect::MakeLTRB(min_x_, min_y_, max_x_, max_y_)
79}
80
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}
88
89} // namespace flutter
void accumulate(SkScalar x, SkScalar y)
float SkScalar
Definition: extension.cpp:12
double y
double x
SINT bool isfinite(const Vec< N, T > &v)
Definition: SkVx.h:1003
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595
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
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15