aboutsummaryrefslogtreecommitdiffhomepage
path: root/fuzz/FuzzPathop.cpp
blob: 18f9e81564a7e125839cbe80e409eefbf16c5a5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "Fuzz.h"
#include "FuzzCommon.h"
#include "SkPath.h"
#include "SkPathOps.h"

const int kLastOp = SkPathOp::kReverseDifference_SkPathOp;

DEF_FUZZ(Pathop, fuzz) {
    SkOpBuilder builder;

    uint8_t stragglerOp;
    fuzz->next(&stragglerOp);
    SkPath path;

    BuildPath(fuzz, &path, SkPath::Verb::kDone_Verb);
    builder.add(path, static_cast<SkPathOp>(stragglerOp % (kLastOp + 1)));

    SkPath result;
    builder.resolve(&result);
}