aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-25 16:56:40 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-25 16:56:40 +0000
commit3c0ecc588b145497232b24eeaee409d7878ad4f2 (patch)
tree608eaa1e6adb29f7a95b90c251c446e77ae7859b
parentf2bfd54de32ffbcf90ddcd0e249aaebb1559d9c2 (diff)
Work around overzealous assertion in SkMaskFilter.
When drawing nine-patch filters, we assert that the source contains the destination. However, at least on the new analytic rect blur path, we can get 0-width destinations, and a 0-width rectangle is considered empty and therefore *not contained in any other rectangle*, even if the bounds are valid and numerically properly contained. This patch makes sure we don't try to draw any of the four corners if they are of 0 width or height. (The assert doesn't exist on the other codepaths.) git-svn-id: http://skia.googlecode.com/svn/trunk@8860 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/core/SkMaskFilter.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 9805bf9b05..0346ce0e9c 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -69,34 +69,42 @@ static void draw_nine_clipped(const SkMask& mask, const SkIRect& outerR,
m.fBounds = mask.fBounds;
m.fBounds.fRight = cx;
m.fBounds.fBottom = cy;
- extractMaskSubset(mask, &m);
- m.fBounds.offsetTo(outerR.left(), outerR.top());
- blitClippedMask(blitter, m, m.fBounds, clipR);
+ if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
+ extractMaskSubset(mask, &m);
+ m.fBounds.offsetTo(outerR.left(), outerR.top());
+ blitClippedMask(blitter, m, m.fBounds, clipR);
+ }
// top-right
m.fBounds = mask.fBounds;
m.fBounds.fLeft = cx + 1;
m.fBounds.fBottom = cy;
- extractMaskSubset(mask, &m);
- m.fBounds.offsetTo(outerR.right() - m.fBounds.width(), outerR.top());
- blitClippedMask(blitter, m, m.fBounds, clipR);
+ if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
+ extractMaskSubset(mask, &m);
+ m.fBounds.offsetTo(outerR.right() - m.fBounds.width(), outerR.top());
+ blitClippedMask(blitter, m, m.fBounds, clipR);
+ }
// bottom-left
m.fBounds = mask.fBounds;
m.fBounds.fRight = cx;
m.fBounds.fTop = cy + 1;
- extractMaskSubset(mask, &m);
- m.fBounds.offsetTo(outerR.left(), outerR.bottom() - m.fBounds.height());
- blitClippedMask(blitter, m, m.fBounds, clipR);
+ if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
+ extractMaskSubset(mask, &m);
+ m.fBounds.offsetTo(outerR.left(), outerR.bottom() - m.fBounds.height());
+ blitClippedMask(blitter, m, m.fBounds, clipR);
+ }
// bottom-right
m.fBounds = mask.fBounds;
m.fBounds.fLeft = cx + 1;
m.fBounds.fTop = cy + 1;
- extractMaskSubset(mask, &m);
- m.fBounds.offsetTo(outerR.right() - m.fBounds.width(),
- outerR.bottom() - m.fBounds.height());
- blitClippedMask(blitter, m, m.fBounds, clipR);
+ if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
+ extractMaskSubset(mask, &m);
+ m.fBounds.offsetTo(outerR.right() - m.fBounds.width(),
+ outerR.bottom() - m.fBounds.height());
+ blitClippedMask(blitter, m, m.fBounds, clipR);
+ }
SkIRect innerR;
innerR.set(outerR.left() + cx - mask.fBounds.left(),