Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
FuzzTriangulation.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google, LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "fuzz/Fuzz.h"
9#include "fuzz/FuzzCommon.h"
10#include "include/core/SkPath.h"
14
15
16DEF_FUZZ(Triangulation, fuzz) {
17#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
18 SkPath path;
20
22 SkMatrix::I(), path.getBounds());
23
24
25 // TODO(robertphillips): messing w/ the clipBounds might be another axis to fuzz.
26 // afaict it only affects inverse filled paths.
27 SkRect clipBounds = path.getBounds();
28
29 GrCpuVertexAllocator allocator;
30 bool isLinear;
31
32 int count = GrTriangulator::PathToTriangles(path, tol, clipBounds, &allocator, &isLinear);
33 if (count > 0) {
34 allocator.detachVertexData(); // normally handled by the triangulating path renderer.
35 }
36#endif // SK_ENABLE_OPTIMIZE_SIZE
37}
int count
void FuzzEvilPath(Fuzz *fuzz, SkPath *path, int last_verb)
#define DEF_FUZZ(name, f)
Definition Fuzz.h:156
sk_sp< GrThreadSafeCache::VertexData > detachVertexData()
static int PathToTriangles(const SkPath &path, SkScalar tolerance, const SkRect &clipBounds, GrEagerVertexAllocator *vertexAllocator, bool *isLinear)
static const SkMatrix & I()
@ kDone_Verb
Definition SkPath.h:1464
float SkScalar
Definition extension.cpp:12
static const SkScalar kDefaultTolerance
Definition GrPathUtils.h:32
SkScalar scaleToleranceToSrc(SkScalar devTol, const SkMatrix &viewM, const SkRect &pathBounds)