26#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
35 if (expectSuccess !=
SkToBool(verts)) {
36 ERRORF(
reporter,
"Expected shadow tessellation to %s but it did not.",
37 expectSuccess ?
"succeed" :
"fail");
41 ERRORF(
reporter,
"Expected shadow tessellation to generate no vertices but it did.");
42 }
else if (
kDo_ExpectVerts == expectVerts && !verts->priv().vertexCount()) {
43 ERRORF(
reporter,
"Expected shadow tessellation to generate vertices but it didn't.");
75 path.cubicTo(100, 50, 20, 100, 0, 0);
83 path.lineTo(10.f, 10.f);
88 for (
int i = 0; i < 10; ++i) {
95 path.moveTo(-134217728, 2.22265153e+21f);
96 path.cubicTo(-2.33326106e+21f, 7.36298265e-41f, 3.72237738e-22f, 5.99502692e-36f,
97 1.13631943e+22f, 2.0890786e+33f);
98 path.cubicTo(1.03397626e-25f, 5.99502692e-36f, 9.18354962e-41f, 0, 4.6142745e-37f, -213558848);
99 path.lineTo(-134217728, 2.2226515e+21f);
104 path.moveTo(0.0f, -50.0f);
105 path.lineTo(14.43f, -25.0f);
106 path.lineTo(43.30f, -25.0f);
107 path.lineTo(28.86f, 0.0f);
108 path.lineTo(43.30f, 25.0f);
109 path.lineTo(14.43f, 25.0f);
110 path.lineTo(0.0f, 50.0f);
111 path.lineTo(-14.43f, 25.0f);
112 path.lineTo(-43.30f, 25.0f);
113 path.lineTo(-28.86f, 0.0f);
114 path.lineTo(-43.30f, -25.0f);
115 path.lineTo(-14.43f, -25.0f);
121 path.moveTo(-50, -50);
122 path.lineTo(-50, 50);
123 path.lineTo(50, -50);
125 path.lineTo(-50, -50);
184 const bool fixed_shadows_in_perspective =
false;
195 if (fixed_shadows_in_perspective) {
218 path.cubicTo(100, 50, 20, 100, 0, 0);
void check_result(skiatest::Reporter *reporter, sk_sp< SkVertices > verts, ExpectVerts expectVerts, bool expectSuccess)
void check_xformed_bounds(skiatest::Reporter *reporter, const SkPath &path, const SkMatrix &ctm)
void check_bounds(skiatest::Reporter *reporter, const SkPath &path)
void tessellate_shadow(skiatest::Reporter *reporter, const SkPath &path, const SkMatrix &ctm, const SkPoint3 &heightParams, ExpectVerts expectVerts, bool expectSuccess)
@ kDirectionalLight_ShadowFlag
static constexpr bool SkToBool(const T &x)
#define DEF_TEST(name, reporter)
#define REPORTER_ASSERT(r, cond,...)
SkMatrix getTotalMatrix() const
SkMatrix & preSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
static constexpr int kMPersp1
input y perspective factor
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
void mapXY(SkScalar x, SkScalar y, SkPoint *result) const
static constexpr int kMPersp0
input x perspective factor
SkMatrix & preRotate(SkScalar degrees, SkScalar px, SkScalar py)
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
void GetLocalBounds(const SkPath &path, const SkDrawShadowRec &rec, const SkMatrix &ctm, SkRect *bounds)
sk_sp< SkVertices > MakeAmbient(const SkPath &path, const SkMatrix &ctm, const SkPoint3 &zPlane, bool transparent)
sk_sp< SkVertices > MakeSpot(const SkPath &path, const SkMatrix &ctm, const SkPoint3 &zPlane, const SkPoint3 &lightPos, SkScalar lightRadius, bool transparent, bool directional)
static SkPoint3 Make(SkScalar x, SkScalar y, SkScalar z)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)