21 constexpr float kLimit = 1.0e35f;
22 *f = (v == v && v <= kLimit && v >= -kLimit) ? v : 0.0f;
25template <
typename... Args>
38 if (maxOps <= 0 || fuzz->exhausted() || path->countPoints() > 100000) {
46 for (uint8_t i = 0; i < numOps; ++i) {
49 if (path->countPoints() > 100000) {
53 constexpr uint8_t MAX_PATH_OPERATION = 32;
55 fuzz->
nextRange(&op, 0, MAX_PATH_OPERATION);
83 path->quadTo(
a,
b, c,
d);
87 path->rQuadTo(
a,
b, c,
d);
91 path->conicTo(
a,
b, c,
d, e);
95 path->rConicTo(
a,
b, c,
d, e);
99 path->cubicTo(
a,
b, c,
d, e, f);
103 path->rCubicTo(
a,
b, c,
d, e, f);
107 path->arcTo(
a,
b, c,
d, e);
113 path->arcTo(r,
a,
b,
test);
122 path->addRect(r, dir);
129 path->addRect(r, dir,
ui);
135 path->addOval(r, dir);
142 path->addOval(r, dir,
ui);
148 path->addCircle(
a,
b, c, dir);
153 path->addArc(r,
a,
b);
160 path->addRoundRect(r,
a,
b, dir);
166 path->addRRect(rr, dir);
172 path->addRRect(rr, dir,
ui);
179 path->addPath(p, m, mode);
186 path->addPath(*path, m, mode);
191 path->reverseAddPath(p);
194 path->addPath(*path);
197 path->reverseAddPath(*path);
201 path->offset(
a,
b, path);
206 p.offset(
a,
b, path);
210 path->transform(m, path);
215 if (p.countPoints() <= 100000) {
217 p.transform(m, path);
222 path->setLastPt(
a,
b);
224 case MAX_PATH_OPERATION:
232 SkASSERTF( path->isValid(),
"path->isValid() failed at op %d, case %d", i, op);
258 path->quadTo(
a,
b, c,
d);
262 fuzz->
next(&
a, &
b, &c, &
d, &e);
263 path->conicTo(
a,
b, c,
d, e);
267 fuzz->
next(&
a, &
b, &c, &
d, &e, &f);
268 path->cubicTo(
a,
b, c,
d, e, f);
289 vec.fX *= 0.5f * r.
width();
291 vec.fY *= 0.5f * r.
height();
298 constexpr int kArrayLength = 9;
302 switch (matrixType) {
336 for (uint8_t i = 0; i <
N; ++i) {
346 if (!region->
op(r, op)) {
357 void* uniformData = uniformBytes->writable_data();
362 static_assert(
sizeof(
int) == 4 &&
sizeof(
float) == 4);
363 size_t numFields = u.sizeInBytes() / 4;
370 while (numFields--) {
372 *
static_cast<int*
>(uniformData) = intVal++;
373 uniformData =
static_cast<int*
>(uniformData) + 1;
376 float floatVal = 0.0f;
377 while (numFields--) {
379 *
static_cast<float*
>(uniformData) = floatVal++;
380 uniformData =
static_cast<float*
>(uniformData) + 1;
390 case SkRuntimeEffect::ChildType::kShader:
393 case SkRuntimeEffect::ChildType::kColorFilter:
396 case SkRuntimeEffect::ChildType::kBlender:
void FuzzNiceRegion(Fuzz *fuzz, SkRegion *region, int maxN)
static void fuzz_nice_float(Fuzz *fuzz, float *f)
void FuzzCreateValidInputsForRuntimeEffect(SkRuntimeEffect *effect, sk_sp< SkData > &uniformBytes, TArray< SkRuntimeEffect::ChildPtr > &children)
static void fuzz_nice_rect(Fuzz *fuzz, SkRect *r)
void FuzzNiceRRect(Fuzz *fuzz, SkRRect *rr)
void FuzzNiceMatrix(Fuzz *fuzz, SkMatrix *m)
void FuzzEvilPath(Fuzz *fuzz, SkPath *path, int last_verb)
void FuzzNicePath(Fuzz *fuzz, SkPath *path, int maxOps)
#define SkASSERTF(cond, fmt,...)
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static void operation(T operation, uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint8_t s, uint32_t t)
Type::kYUV Type::kRGBA() int(0.7 *637)
void nextRange(T *, Min, Max)
void nextEnum(T *ptr, T max)
void nextN(T *ptr, int n)
static sk_sp< SkBlender > Arithmetic(float k1, float k2, float k3, float k4, bool enforcePremul)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkData > MakeZeroInitialized(size_t length)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
static const SkMatrix & I()
static void ShrinkToFit(SkPath *path)
void setRectRadii(const SkRect &rect, const SkVector radii[4])
bool op(const SkIRect &rect, Op op)
size_t uniformSize() const
SkSpan< const Child > children() const
SkSpan< const Uniform > uniforms() const
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static const uint8_t buffer[]
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
SkScalar fRight
larger x-axis bounds
constexpr float height() const
constexpr float width() const
SkScalar fTop
smaller y-axis bounds