Change bitmap initialization in DrawFunctions fuzzer

BUG=skia:

Change-Id: Ibfd778315a0c3bf6c3abc23f8935c485fab89366
Reviewed-on: https://skia-review.googlesource.com/8615
Reviewed-by: twsmith@mozilla.com <twsmith@mozilla.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Kevin Lubick 2017-02-17 10:27:30 -05:00 committed by Skia Commit-Bot
parent ef0a15b164
commit 8c8b6182cd

View File

@ -71,28 +71,28 @@ static void init_paint(Fuzz* fuzz, SkPaint* p) {
static void init_bitmap(Fuzz* fuzz, SkBitmap* bmp) {
uint8_t colorType;
fuzz->nextRange(&colorType, 0, (int)kLastEnum_SkColorType);
bool b;
fuzz->next(&b);
SkImageInfo info = SkImageInfo::Make(kBmpSize,
kBmpSize,
(SkColorType)colorType,
kPremul_SkAlphaType);
b ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
if (!bmp->tryAllocPixels(info)) {
SkDebugf("Bitmap not allocated\n");
}
SkCanvas canvas(*bmp);
canvas.clear(0);
SkColor c;
fuzz->next(&c);
bmp->eraseColor(c);
bool b;
fuzz->next(&b);
SkPaint p;
if (b) {
init_paint(fuzz, &p);
}
else {
SkColor c;
fuzz->next(&c);
p.setColor(c);
}
canvas.drawRect(SkRect::MakeXYWH(0, 0, kBmpSize, kBmpSize), p);
}
static void init_surface(Fuzz* fuzz, sk_sp<SkSurface>* s) {