90 const bool all_finite =
all(accum * 0 == 0);
106#define CHECK_INTERSECT(al, at, ar, ab, bl, bt, br, bb) \
107 float L = std::max(al, bl); \
108 float R = std::min(ar, br); \
109 float T = std::max(at, bt); \
110 float B = std::min(ab, bb); \
111 do { if (!(L < R && T < B)) return false; } while (0)
149 return storage->
c_str();
168 line.printf(
"SkRect::MakeLTRB(%s, %s, %s, %s);",
178 if (
a.isEmpty() ||
b.isEmpty() || !R::Intersects(
a,
b)) {
204 float aHeight = (
float)
a.height();
205 float aWidth = (
float)
a.width();
206 float leftArea = 0.f, rightArea = 0.f, topArea = 0.f, bottomArea = 0.f;
207 int positiveCount = 0;
208 if (
b.fLeft >
a.fLeft) {
209 leftArea = (
b.fLeft -
a.fLeft) / aWidth;
212 if (
a.fRight >
b.fRight) {
213 rightArea = (
a.fRight -
b.fRight) / aWidth;
216 if (
b.fTop >
a.fTop) {
217 topArea = (
b.fTop -
a.fTop) / aHeight;
220 if (
a.fBottom >
b.fBottom) {
221 bottomArea = (
a.fBottom -
b.fBottom) / aHeight;
225 if (positiveCount == 0) {
227 *
out = R::MakeEmpty();
232 if (leftArea > rightArea && leftArea > topArea && leftArea > bottomArea) {
234 out->fRight =
b.fLeft;
235 }
else if (rightArea > topArea && rightArea > bottomArea) {
237 out->fLeft =
b.fRight;
238 }
else if (topArea > bottomArea) {
240 out->fBottom =
b.fTop;
244 out->fTop =
b.fBottom;
249 return positiveCount == 1;
253 return subtract<SkRect>(
a,
b,
out);
257 return subtract<SkIRect>(
a,
b,
out);
292 auto max =
m.rc(0,0)*
ax +
m.rc(0,1)*ay +
m.rc(0,3);
293 auto may =
m.rc(1,0)*
ax +
m.rc(1,1)*ay +
m.rc(1,3);
294 auto maw =
m.rc(3,0)*
ax +
m.rc(3,1)*ay +
m.rc(3,3);
296 if (
all(maw < 0.f)) {
303 auto lA = may*skvx::shuffle<1,2,3,0>(maw) - maw*skvx::shuffle<1,2,3,0>(may);
304 auto lB = maw*skvx::shuffle<1,2,3,0>(
max) -
max*skvx::shuffle<1,2,3,0>(maw);
305 auto lC =
max*skvx::shuffle<1,2,3,0>(may) - may*skvx::shuffle<1,2,3,0>(
max);
309 float sign = (lA[0]*lB[1] - lB[0]*lA[1]) < 0 ? -1.f : 1.f;
313 SkRect bInset =
b.makeInset(tol, tol);
320 return (d0 >= 0.f) & (d1 >= 0.f) & (d2 >= 0.f) & (d3 >= 0.f);
324 if (
src.isEmpty() ||
dst.isEmpty()) {
330 if (r <=
dst.fLeft) {
333 }
else if (l >=
dst.fRight) {
347 }
else if (t >=
dst.fBottom) {
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
constexpr float SK_FloatNaN
static int sign(SkScalar x)
static bool subtract(const R &a, const R &b, R *out)
static const char * set_scalar(SkString *storage, float value, SkScalarAsStringType asType)
#define CHECK_INTERSECT(al, at, ar, ab, bl, bt, br, bb)
void SkAppendScalar(SkString *str, SkScalar value, SkScalarAsStringType asType)
@ kHex_SkScalarAsStringType
@ kDec_SkScalarAsStringType
static void SkAppendScalarDec(SkString *str, SkScalar value)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static skvx::int4 QuadContainsRectMask(const SkM44 &m, const SkRect &a, const SkRect &b, float tol=0.f)
static SkIRect ClosestDisjointEdge(const SkIRect &src, const SkIRect &dst)
static bool Subtract(const SkRect &a, const SkRect &b, SkRect *out)
static bool QuadContainsRect(const SkMatrix &m, const SkIRect &a, const SkIRect &b, float tol=0.f)
const char * c_str() const
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SIT bool all(const Vec< 1, T > &x)
SIT T max(const Vec< 1, T > &x)
SIT T min(const Vec< 1, T > &x)
bool intersect(const SkIRect &r)
int32_t fBottom
larger y-axis bounds
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
int32_t fTop
smaller y-axis bounds
void join(const SkIRect &r)
static constexpr SkIRect MakeEmpty()
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds
void set(float x, float y)
static SkRect Make(const SkISize &size)
SkScalar fBottom
larger y-axis bounds
void toQuad(SkPoint quad[4]) const
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
SkScalar fRight
larger x-axis bounds
bool setBoundsCheck(const SkPoint pts[], int count)
void setLTRB(float left, float top, float right, float bottom)
void join(const SkRect &r)
void setBoundsNoCheck(const SkPoint pts[], int count)
SkScalar fTop
smaller y-axis bounds
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)