Add asserts to SkBlurImageFilter flatten & CreateProc

It seems rather implausible that this could be occuring but the Chrome
bug seems to say otherwise.

Bug: 748155
Change-Id: I8e14f1562c71da4ae80d626e4dba053d7ee13d97
Reviewed-on: https://skia-review.googlesource.com/28863
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-07-31 15:27:02 -04:00 committed by Skia Commit-Bot
parent 8e3c42b1ee
commit 49f58a3825

View File

@ -100,6 +100,9 @@ sk_sp<SkFlattenable> SkBlurImageFilterImpl::CreateProc(SkReadBuffer& buffer) {
tileMode = static_cast<SkBlurImageFilter::TileMode>(buffer.readInt());
}
static_assert(SkBlurImageFilter::kMax_TileMode == 2, "CreateProc");
SkASSERT(tileMode <= SkBlurImageFilter::kMax_TileMode);
return SkBlurImageFilter::Make(
sigmaX, sigmaY, common.getInput(0), &common.cropRect(), tileMode);
}
@ -108,6 +111,10 @@ void SkBlurImageFilterImpl::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fSigma.fWidth);
buffer.writeScalar(fSigma.fHeight);
static_assert(SkBlurImageFilter::kMax_TileMode == 2, "flatten");
SkASSERT(fTileMode <= SkBlurImageFilter::kMax_TileMode);
buffer.writeInt(static_cast<int>(fTileMode));
}