• Home
  • Raw
  • Download

Lines Matching refs:rect

88 bool RectF::Contains(const RectF& rect) const {  in Contains()
89 return rect.x() >= x() && rect.right() <= right() && rect.y() >= y() && in Contains()
90 rect.bottom() <= bottom(); in Contains()
93 bool RectF::Intersects(const RectF& rect) const { in Intersects()
94 return !IsEmpty() && !rect.IsEmpty() && rect.x() < right() && in Intersects()
95 rect.right() > x() && rect.y() < bottom() && rect.bottom() > y(); in Intersects()
98 void RectF::Intersect(const RectF& rect) { in Intersect() argument
99 if (IsEmpty() || rect.IsEmpty()) { in Intersect()
104 float rx = std::max(x(), rect.x()); in Intersect()
105 float ry = std::max(y(), rect.y()); in Intersect()
106 float rr = std::min(right(), rect.right()); in Intersect()
107 float rb = std::min(bottom(), rect.bottom()); in Intersect()
117 void RectF::Union(const RectF& rect) { in Union() argument
119 *this = rect; in Union()
122 if (rect.IsEmpty()) in Union()
125 float rx = std::min(x(), rect.x()); in Union()
126 float ry = std::min(y(), rect.y()); in Union()
127 float rr = std::max(right(), rect.right()); in Union()
128 float rb = std::max(bottom(), rect.bottom()); in Union()
133 void RectF::Subtract(const RectF& rect) { in Subtract() argument
134 if (!Intersects(rect)) in Subtract()
136 if (rect.Contains(*this)) { in Subtract()
146 if (rect.y() <= y() && rect.bottom() >= bottom()) { in Subtract()
148 if (rect.x() <= x()) { in Subtract()
149 rx = rect.right(); in Subtract()
150 } else if (rect.right() >= right()) { in Subtract()
151 rr = rect.x(); in Subtract()
153 } else if (rect.x() <= x() && rect.right() >= right()) { in Subtract()
155 if (rect.y() <= y()) { in Subtract()
156 ry = rect.bottom(); in Subtract()
157 } else if (rect.bottom() >= bottom()) { in Subtract()
158 rb = rect.y(); in Subtract()
164 void RectF::AdjustToFit(const RectF& rect) { in AdjustToFit() argument
169 AdjustAlongAxis(rect.x(), rect.width(), &new_x, &new_width); in AdjustToFit()
170 AdjustAlongAxis(rect.y(), rect.height(), &new_y, &new_height); in AdjustToFit()
195 bool RectF::SharesEdgeWith(const RectF& rect) const { in SharesEdgeWith()
196 return (y() == rect.y() && height() == rect.height() && in SharesEdgeWith()
197 (x() == rect.right() || right() == rect.x())) || in SharesEdgeWith()
198 (x() == rect.x() && width() == rect.width() && in SharesEdgeWith()
199 (y() == rect.bottom() || bottom() == rect.y())); in SharesEdgeWith()
211 float RectF::ManhattanInternalDistance(const RectF& rect) const { in ManhattanInternalDistance()
213 c.Union(rect); in ManhattanInternalDistance()
216 float x = std::max(0.f, c.width() - width() - rect.width() + kEpsilon); in ManhattanInternalDistance()
217 float y = std::max(0.f, c.height() - height() - rect.height() + kEpsilon); in ManhattanInternalDistance()