diff options
author | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-07 03:39:46 +0000 |
---|---|---|
committer | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-07 03:39:46 +0000 |
commit | 796a1753d96eb0c76e742c8288617d758ddf33df (patch) | |
tree | fff725a2f23e1fecb45f8db09d7805be30794006 /src | |
parent | 5a7ae4f5e5de3be99210dd9df89794f52c7c6d6e (diff) |
fix SkRegion::contains(rect), thanks to danakj and http://code.google.com/p/skia/issues/detail?id=958
git-svn-id: http://skia.googlecode.com/svn/trunk@6324 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkRegion.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index 0dcacd849e..f6fc2dc6c5 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -338,6 +338,10 @@ bool SkRegion::contains(int32_t x, int32_t y) const { return false; } +static SkRegion::RunType scanline_bottom(const SkRegion::RunType runs[]) { + return runs[0]; +} + static const SkRegion::RunType* scanline_next(const SkRegion::RunType runs[]) { // skip [B N [L R]... S] return runs + 2 + runs[1] * 2 + 1; @@ -370,13 +374,14 @@ bool SkRegion::contains(const SkIRect& r) const { SkASSERT(this->isComplex()); const RunType* scanline = fRunHead->findScanline(r.fTop); - + RunType bottom; do { if (!scanline_contains(scanline, r.fLeft, r.fRight)) { return false; } + bottom = scanline_bottom(scanline); scanline = scanline_next(scanline); - } while (r.fBottom >= scanline[0]); + } while (r.fBottom > bottom); return true; } |