diff options
author | Robert Phillips <robertphillips@google.com> | 2017-07-31 15:27:02 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-31 20:15:20 +0000 |
commit | 49f58a3825ca7f7745d7f311baa2b65c5eb46c02 (patch) | |
tree | 1c68c38c045f5308914b0c31ac00be1e3ee385b5 | |
parent | 8e3c42b1ee981643b9dc78b67b7da0a7b470dc37 (diff) |
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>
-rw-r--r-- | src/core/SkBlurImageFilter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/SkBlurImageFilter.cpp b/src/core/SkBlurImageFilter.cpp index 928da9841d..a349b961f6 100644 --- a/src/core/SkBlurImageFilter.cpp +++ b/src/core/SkBlurImageFilter.cpp @@ -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)); } |