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>
This commit is contained in:
parent
0b83319b7f
commit
0361d49e2a
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user