diff options
author | Hal Canary <halcanary@google.com> | 2017-03-15 12:58:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-15 20:45:04 +0000 |
commit | 0361d49e2a663b9fc36352e308728a470320366b (patch) | |
tree | 2802cc5f9bcfc9a29902fe4b79ce6871238cbec7 | |
parent | 0b83319b7f301145b7fc89d7096ddcea91d4a56b (diff) |
FuzzCanvas: make fuzzing drawImgNine easier
Change-Id: I82c8723d0b9192008b323f65232054d9acafddcc
Reviewed-on: https://skia-review.googlesource.com/9724
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
-rw-r--r-- | fuzz/FuzzCanvas.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp index 64a818b370..d59cee034f 100644 --- a/fuzz/FuzzCanvas.cpp +++ b/fuzz/FuzzCanvas.cpp @@ -1462,10 +1462,19 @@ static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) { SkIRect center; SkRect dst; bool usePaint; - fuzz->next(¢er, &dst, &usePaint); + fuzz->next(&usePaint); if (usePaint) { fuzz_paint(fuzz, &paint, depth - 1); } + if (make_fuzz_t<bool>(fuzz)) { + fuzz->next(¢er); + } else { // Make valid center, see SkLatticeIter::Valid(). + fuzz->nextRange(¢er.fLeft, 0, img->width() - 1); + fuzz->nextRange(¢er.fTop, 0, img->height() - 1); + fuzz->nextRange(¢er.fRight, center.fLeft + 1, img->width()); + fuzz->nextRange(¢er.fBottom, center.fTop + 1, img->height()); + } + fuzz->next(&dst); canvas->drawImageNine(img, center, dst, usePaint ? &paint : nullptr); break; } @@ -1528,10 +1537,19 @@ static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) { SkIRect center; SkRect dst; bool usePaint; - fuzz->next(¢er, &dst, &usePaint); + fuzz->next(&usePaint); if (usePaint) { fuzz_paint(fuzz, &paint, depth - 1); } + if (make_fuzz_t<bool>(fuzz)) { + fuzz->next(¢er); + } else { // Make valid center, see SkLatticeIter::Valid(). + fuzz->nextRange(¢er.fLeft, 0, img.width() - 1); + fuzz->nextRange(¢er.fTop, 0, img.height() - 1); + fuzz->nextRange(¢er.fRight, center.fLeft + 1, img.width()); + fuzz->nextRange(¢er.fBottom, center.fTop + 1, img.height()); + } + fuzz->next(&dst); canvas->drawBitmapNine(img, center, dst, usePaint ? &paint : nullptr); break; } |