kjlubick | e565450 | 2016-07-19 16:50:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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.h" |
Cary Clark | 91390c8 | 2018-03-09 14:02:46 -0500 | [diff] [blame] | 9 | #include "FuzzCommon.h" |
kjlubick | e565450 | 2016-07-19 16:50:03 -0700 | [diff] [blame] | 10 | #include "SkPath.h" |
| 11 | #include "SkPathOps.h" |
| 12 | |
| 13 | const int kLastOp = SkPathOp::kReverseDifference_SkPathOp; |
| 14 | |
kjlubick | e565450 | 2016-07-19 16:50:03 -0700 | [diff] [blame] | 15 | DEF_FUZZ(Pathop, fuzz) { |
| 16 | SkOpBuilder builder; |
kjlubick | e565450 | 2016-07-19 16:50:03 -0700 | [diff] [blame] | 17 | |
Kevin Lubick | 416b248 | 2016-11-10 16:17:49 -0500 | [diff] [blame] | 18 | uint8_t stragglerOp; |
| 19 | fuzz->next(&stragglerOp); |
Kevin Lubick | 2f535ce | 2016-11-01 15:01:12 -0400 | [diff] [blame] | 20 | SkPath path; |
| 21 | |
| 22 | BuildPath(fuzz, &path, SkPath::Verb::kDone_Verb); |
| 23 | builder.add(path, static_cast<SkPathOp>(stragglerOp % (kLastOp + 1))); |
kjlubick | e565450 | 2016-07-19 16:50:03 -0700 | [diff] [blame] | 24 | |
| 25 | SkPath result; |
| 26 | builder.resolve(&result); |
| 27 | } |