diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-21 22:00:12 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-21 22:00:12 +0000 |
commit | c41513c4dac51d68570b309ec28a315d974edea7 (patch) | |
tree | c0e49b2f2b322ea3023e7864f22b6b858f953c7f /src | |
parent | d5ed395048275660239ba537413f0ba4882686d0 (diff) |
Add a sanity check to MaskSuperBlitter::blitH(), to avoid a subsequent
crash in *Blitter::blitMask(), and add some more asserts.
http://codereview.appspot.com/110050
http://crbug.com/17569
git-svn-id: http://skia.googlecode.com/svn/trunk@330 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkScan_AntiPath.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp index 922c0ab4a7..c5504c6c2e 100644 --- a/src/core/SkScan_AntiPath.cpp +++ b/src/core/SkScan_AntiPath.cpp @@ -286,6 +286,13 @@ void MaskSuperBlitter::blitH(int x, int y, int width) SkASSERT(iy >= fMask.fBounds.fTop && iy < fMask.fBounds.fBottom); iy -= fMask.fBounds.fTop; // make it relative to 0 + // This should never happen, but it does. Until the true cause is + // discovered, let's skip this span instead of crashing. + // See http://crbug.com/17569. + if (iy < 0) { + return; + } + #ifdef SK_DEBUG { int ix = x >> SHIFT; @@ -359,6 +366,7 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& clip, if (ir.isEmpty()) { return; } + SkASSERT(SkIntToScalar(ir.fTop) <= path.getBounds().fTop); // use bit-or since we expect all to pass, so no need to go slower with // a short-circuiting logical-or @@ -397,11 +405,14 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& clip, superClipRect = &superRect; } + SkASSERT(SkIntToScalar(ir.fTop) <= path.getBounds().fTop); + // MaskSuperBlitter can't handle drawing outside of ir, so we can't use it // if we're an inverse filltype if (!path.isInverseFillType() && MaskSuperBlitter::CanHandleRect(ir)) { MaskSuperBlitter superBlit(blitter, ir, clip); + SkASSERT(SkIntToScalar(ir.fTop) <= path.getBounds().fTop); sk_fill_path(path, superClipRect, &superBlit, ir.fBottom, SHIFT, clip); } else |