18#define ASSERT(cond) REPORTER_ASSERT(r, cond)
19#define ASSERTF(cond, ...) REPORTER_ASSERT(r, cond, __VA_ARGS__)
20#define TEST(name) DEF_TEST(GrQuadCrop##name, r)
21#define ASSERT_NEARLY_EQUAL(expected, actual) \
22 ASSERTF(SkScalarNearlyEqual(expected, actual), "expected: %f, actual: %f", \
39 ASSERTF(exact,
"Expected exact crop");
41 "Expected quad to remain axis-aligned");
60 for (
int p = 0;
p < 4; ++
p) {
114 containsCrop.
outset(10.f, 10.f);
127 ASSERTF(!exact,
"Expected crop to be not exact");
129 "Expected edge flags not to be modified");
131 for (
int i = 0;
i < 4; ++
i) {
148 ASSERTF(!exact,
"Expected no change for perspective");
149 for (
int i = 0;
i < 4; ++
i) {
157 ASSERTF(exact,
"Expected crop to be exact");
161 "Expected edge flags do not match clip AA setting");
189 kInsideEdge, kInsideEdge);
191 kOutsideEdge, kOutsideEdge);
193 kIntersectEdge, kIntersectEdge);
195 kIntersectEdge, kOutsideEdge);
197 kOutsideEdge, kIntersectEdge);
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static void test_axis_aligned_all_clips(skiatest::Reporter *r, const SkMatrix &viewMatrix, const SkMatrix *localMatrix)
static const SkRect kDrawRect
#define ASSERTF(cond,...)
static void run_crop_fully_covered_test(skiatest::Reporter *r, GrAA clipAA, const SkMatrix &viewMatrix, const SkMatrix *localMatrix)
static void test_crop_fully_covered(skiatest::Reporter *r, const SkMatrix &viewMatrix)
static void test_axis_aligned(skiatest::Reporter *r, const SkMatrix &viewMatrix)
static void run_crop_axis_aligned_test(skiatest::Reporter *r, const SkRect &clipRect, GrAA clipAA, const SkMatrix &viewMatrix, const SkMatrix *localMatrix)
#define ASSERT_NEARLY_EQUAL(expected, actual)
static GrQuad MakeFromRect(const SkRect &, const SkMatrix &)
SkPoint point(int i) const
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
SkMatrix & setSkewX(SkScalar v)
SkMatrix & setPerspX(SkScalar v)
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
bool invert(SkMatrix *inverse) const
bool rectStaysRect() const
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
SkMatrix & setPerspY(SkScalar v)
static const SkMatrix & I()
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
SkMatrix & setSkewY(SkScalar v)
bool CropToRect(const SkRect &cropRect, GrAA cropAA, DrawQuad *quad, bool computeLocal)
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
SkScalar fBottom
larger y-axis bounds
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
void outset(float dx, float dy)
SkScalar fRight
larger x-axis bounds
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
SkScalar fTop
smaller y-axis bounds