don't try to extract or blur a zero-sized bitmap
Bug:884473 Change-Id: Ic61238633f65c66db0d5d00c2c438f03552ec7c9 Reviewed-on: https://skia-review.googlesource.com/154634 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
8e73f4b6bb
commit
840debe9c7
@ -542,6 +542,9 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
|
||||
SkMatrix identity;
|
||||
SkMask srcM, dstM;
|
||||
|
||||
if (this->width() == 0 || this->height() == 0) {
|
||||
return false;
|
||||
}
|
||||
srcM.fBounds.set(0, 0, this->width(), this->height());
|
||||
srcM.fRowBytes = SkAlign4(this->width());
|
||||
srcM.fFormat = SkMask::kA8_Format;
|
||||
|
@ -732,3 +732,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest, reporter, ctxInfo) {
|
||||
REPORTER_ASSERT(reporter, SkColorGetB(readback.getColor(15, 15)) == 0);
|
||||
REPORTER_ASSERT(reporter, readback.getColor(31, 31) == SK_ColorBLACK);
|
||||
}
|
||||
|
||||
DEF_TEST(zero_blur, reporter) {
|
||||
SkBitmap alpha, bitmap;
|
||||
|
||||
SkPaint paint;
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3));
|
||||
SkIPoint offset;
|
||||
bitmap.extractAlpha(&alpha, &paint, nullptr, &offset);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user