12#include <CoreGraphics/CoreGraphics.h>
13#elif defined(OS_APPLE)
14#include <ApplicationServices/ApplicationServices.h>
27 : origin_(r.
left, r.top),
29#elif defined(OS_APPLE)
30Rect::Rect(
const CGRect& r)
35RECT Rect::ToRECT()
const {
43#elif defined(OS_APPLE)
44CGRect Rect::ToCGRect()
const {
50 *size = std::min(dst_size, *size);
51 if (*origin < dst_origin)
54 *origin = std::min(dst_origin + dst_size, *origin + *size) - *size;
70 int effective_span = base::ClampSub(
max,
min);
71 int span_loss = base::ClampSub(
max,
min + effective_span);
76 *span = effective_span;
84 constexpr unsigned kMaxDimension = std::numeric_limits<int>::max() / 2;
85 if (base::SafeUnsignedAbs(
max) < kMaxDimension) {
87 *span = effective_span;
88 *origin =
max - effective_span;
89 }
else if (base::SafeUnsignedAbs(
min) < kMaxDimension) {
91 *span = effective_span;
95 *span = effective_span;
96 *origin =
min + span_loss / 2;
122 origin_ +=
Vector2d(horizontal, vertical);
145 if (origin_ == other.origin_) {
152 return origin_ < other.origin_;
157 return (point_x >=
x()) && (point_x <
right()) && (point_y >=
y()) &&
162 return (rect.x() >=
x() && rect.right() <=
right() && rect.y() >=
y() &&
163 rect.bottom() <=
bottom());
167 return !(
IsEmpty() || rect.IsEmpty() || rect.x() >=
right() ||
168 rect.right() <=
x() || rect.y() >=
bottom() || rect.bottom() <=
y());
172 if (
IsEmpty() || rect.IsEmpty()) {
177 int left = std::max(
x(), rect.x());
178 int top = std::max(
y(), rect.y());
179 int new_right = std::min(
right(), rect.right());
180 int new_bottom = std::min(
bottom(), rect.bottom());
182 if (
left >= new_right || top >= new_bottom) {
198 SetByBounds(std::min(
x(), rect.x()), std::min(
y(), rect.y()),
199 std::max(
right(), rect.right()),
200 std::max(
bottom(), rect.bottom()));
206 if (rect.Contains(*
this)) {
216 if (rect.y() <=
y() && rect.bottom() >=
bottom()) {
218 if (rect.x() <=
x()) {
220 }
else if (rect.right() >=
right()) {
223 }
else if (rect.x() <=
x() && rect.right() >=
right()) {
225 if (rect.y() <=
y()) {
227 }
else if (rect.bottom() >=
bottom()) {
237 int new_width =
width();
238 int new_height =
height();
241 SetRect(new_x, new_y, new_width, new_height);
251 int new_x =
x() + (
width() - new_width) / 2;
252 int new_y =
y() + (
height() - new_height) / 2;
253 SetRect(new_x, new_y, new_width, new_height);
270 return (
y() == rect.y() &&
height() == rect.height() &&
271 (
x() == rect.right() ||
right() == rect.x())) ||
272 (
x() == rect.x() &&
width() == rect.width() &&
273 (
y() == rect.bottom() ||
bottom() == rect.y()));
278 std::max<int>(0, std::max(
x() - point.
x(), point.
x() -
right()));
280 std::max<int>(0, std::max(
y() - point.
y(), point.
y() -
bottom()));
282 return x_distance + y_distance;
289 int x = std::max(0, c.
width() -
width() - rect.width() + 1);
290 int y = std::max(0, c.
height() -
height() - rect.height() + 1);
300 return std::abs(
x() - rect.x()) <= tolerance &&
301 std::abs(
y() - rect.y()) <= tolerance &&
302 std::abs(
right() - rect.right()) <= tolerance &&
303 std::abs(
bottom() - rect.bottom()) <= tolerance;
339 std::max(p1.
x(), p2.
x()), std::max(p1.
y(), p2.
y()));
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
constexpr int right() const
constexpr int bottom() const
constexpr int top() const
constexpr int left() const
void SetPoint(int x, int y)
bool Intersects(const Rect &rect) const
bool ApproximatelyEqual(const Rect &rect, int tolerance) const
constexpr int height() const
int ManhattanDistanceToPoint(const Point &point) const
Insets InsetsFrom(const Rect &inner) const
Point CenterPoint() const
void operator+=(const Vector2d &offset)
void set_width(int width)
void Offset(int horizontal, int vertical)
void SetByBounds(int left, int top, int right, int bottom)
void Intersect(const Rect &rect)
bool operator<(const Rect &other) const
void AdjustToFit(const Rect &rect)
constexpr int right() const
constexpr const Point & origin() const
constexpr int bottom() const
bool SharesEdgeWith(const Rect &rect) const
void Subtract(const Rect &rect)
void set_height(int height)
std::string ToString() const
constexpr const Size & size() const
void operator-=(const Vector2d &offset)
void Inset(int horizontal, int vertical)
void SetRect(int x, int y, int width, int height)
bool Contains(int point_x, int point_y) const
int ManhattanInternalDistance(const Rect &rect) const
void Union(const Rect &rect)
void ClampToCenteredSize(const Size &size)
void SplitVertically(Rect *left_half, Rect *right_half) const
constexpr int width() const
constexpr int height() const
void SetSize(int width, int height)
constexpr int width() const
static float max(float r, float g, float b)
static float min(float r, float g, float b)
std::string StringPrintf(const std::string &format, Args... args)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Rect BoundingRect(const Point &p1, const Point &p2)
void AdjustAlongAxis(int dst_origin, int dst_size, int *origin, int *size)
Rect IntersectRects(const Rect &a, const Rect &b)
Insets operator+(Insets lhs, const Insets &rhs)
Rect UnionRects(const Rect &a, const Rect &b)
Rect SubtractRects(const Rect &a, const Rect &b)
static void SaturatedClampRange(int min, int max, int *origin, int *span)
Insets operator-(Insets lhs, const Insets &rhs)
constexpr size_t size(const T(&array)[N]) noexcept
SIN Vec< N, float > abs(const Vec< N, float > &x)
#define BASE_DCHECK(condition)