diff options
author | Jim Van Verth <jvanverth@google.com> | 2018-06-26 14:58:58 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-26 20:28:55 +0000 |
commit | 3645bb069d893e8a8be9955485f2b34a19c72994 (patch) | |
tree | 0cf22a4c166ec7fe17336c325591e64023954673 /src/core/SkMask.cpp | |
parent | 9396bc3fc63df48c8e3aaee3e4f46c6ea4539e5f (diff) |
Fix some shadow issues.
* Clamp path polygon points to nearest 1/16th of a pixel to help
with floating point issues.
* Added check for multiple contour paths.
* Return empty SkVertices for certain degenerate cases to avoid
unnecessary blurs.
* Check iteration count in SkOffsetPolygon to avoid infinite loops.
* Add new tests to verify these.
Bug: skia:
Change-Id: Ie6ad48d2504e065dcc822609d369f90c56ef3ad3
Reviewed-on: https://skia-review.googlesource.com/136701
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/core/SkMask.cpp')
-rw-r--r-- | src/core/SkMask.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/SkMask.cpp b/src/core/SkMask.cpp index 7336116f93..c0875b84e8 100644 --- a/src/core/SkMask.cpp +++ b/src/core/SkMask.cpp @@ -62,12 +62,17 @@ SkMask SkMask::PrepareDestination(int radiusX, int radiusY, const SkMask& src) { // dstH = srcH + 2 * radiusY; size_t dstH = safe.add(src.fBounds.height(), safe.add(radiusY, radiusY)); - dst.fBounds.set(0, 0, SkTo<int>(dstW), SkTo<int>(dstH)); - dst.fBounds.offset(src.fBounds.x(), src.fBounds.y()); - dst.fBounds.offset(-radiusX, -radiusY); + if (!SkTFitsIn<int>(dstW) || !SkTFitsIn<int>(dstH)) { + dst.fBounds.setEmpty(); + dst.fRowBytes = 0; + } else { + dst.fBounds.set(0, 0, SkTo<int>(dstW), SkTo<int>(dstH)); + dst.fBounds.offset(src.fBounds.x(), src.fBounds.y()); + dst.fBounds.offset(-radiusX, -radiusY); + dst.fRowBytes = SkTo<uint32_t>(dstW); + } dst.fImage = nullptr; - dst.fRowBytes = SkTo<uint32_t>(dstW); dst.fFormat = SkMask::kA8_Format; size_t toAlloc = safe.mul(dstW, dstH); |