Flutter Engine
The Flutter Engine
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)
19 FuzzEvilPath(fuzz, &path, SkPath::Verb::kDone_Verb);
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
Definition: FontMgrTest.cpp:50
void FuzzEvilPath(Fuzz *fuzz, SkPath *path, int last_verb)
Definition: FuzzCommon.cpp:237
DEF_FUZZ(Triangulation, fuzz)
sk_sp< GrThreadSafeCache::VertexData > detachVertexData()
static int PathToTriangles(const SkPath &path, SkScalar tolerance, const SkRect &clipBounds, GrEagerVertexAllocator *vertexAllocator, bool *isLinear)
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
static const SkScalar kDefaultTolerance
Definition: GrPathUtils.h:32
SkScalar scaleToleranceToSrc(SkScalar devTol, const SkMatrix &viewM, const SkRect &pathBounds)
Definition: GrPathUtils.cpp:41
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57