Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
fuzz
FuzzPathMeasure.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2018 Google Inc.
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/SkPathMeasure.h
"
11
12
void
inline
ignoreResult
(
bool
) {}
13
14
DEF_FUZZ
(PathMeasure, fuzz) {
15
uint8_t bits;
16
fuzz->next(&bits);
17
SkScalar
distance[6];
18
for
(
auto
index = 0; index < 6; ++index) {
19
fuzz->next(&distance[index]);
20
}
21
SkPath
path;
22
FuzzEvilPath
(fuzz, &path,
SkPath::Verb::kDone_Verb
);
23
SkRect
bounds = path.getBounds();
24
SkScalar
maxDim = std::max(bounds.width(), bounds.height());
25
if
(maxDim > 1000000) {
26
return
;
27
}
28
SkScalar
resScale = maxDim / 1000;
29
SkPathMeasure
measure(path, bits & 1, resScale);
30
SkPoint
position;
31
SkVector
tangent;
32
ignoreResult
(measure.
getPosTan
(distance[0], &position, &tangent));
33
SkPath
dst;
34
ignoreResult
(measure.
getSegment
(distance[1], distance[2], &dst, (bits >> 1) & 1));
35
ignoreResult
(measure.
nextContour
());
36
ignoreResult
(measure.
getPosTan
(distance[3], &position, &tangent));
37
ignoreResult
(measure.
getSegment
(distance[4], distance[5], &dst, (bits >> 2) & 1));
38
}
FuzzEvilPath
void FuzzEvilPath(Fuzz *fuzz, SkPath *path, int last_verb)
Definition
FuzzCommon.cpp:237
FuzzCommon.h
ignoreResult
void ignoreResult(bool)
Definition
FuzzPathMeasure.cpp:12
Fuzz.h
DEF_FUZZ
#define DEF_FUZZ(name, f)
Definition
Fuzz.h:156
SkPathMeasure.h
SkPathMeasure
Definition
SkPathMeasure.h:20
SkPathMeasure::nextContour
bool nextContour()
Definition
SkPathMeasure.cpp:56
SkPathMeasure::getSegment
bool getSegment(SkScalar startD, SkScalar stopD, SkPath *dst, bool startWithMoveTo)
Definition
SkPathMeasure.cpp:48
SkPathMeasure::getPosTan
bool getPosTan(SkScalar distance, SkPoint *position, SkVector *tangent)
Definition
SkPathMeasure.cpp:40
SkPath
Definition
SkPath.h:59
SkPath::kDone_Verb
@ kDone_Verb
Definition
SkPath.h:1464
SkScalar
float SkScalar
Definition
extension.cpp:12
SkPoint
Definition
SkPoint_impl.h:163
SkRect
Definition
extension.cpp:13
Generated on Fri Apr 26 2024 06:15:59 for Flutter Engine by
1.9.8