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
This commit is contained in:
parent
5a7ae4f5e5
commit
796a1753d9
@ -338,6 +338,10 @@ bool SkRegion::contains(int32_t x, int32_t y) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SkRegion::RunType scanline_bottom(const SkRegion::RunType runs[]) {
|
||||||
|
return runs[0];
|
||||||
|
}
|
||||||
|
|
||||||
static const SkRegion::RunType* scanline_next(const SkRegion::RunType runs[]) {
|
static const SkRegion::RunType* scanline_next(const SkRegion::RunType runs[]) {
|
||||||
// skip [B N [L R]... S]
|
// skip [B N [L R]... S]
|
||||||
return runs + 2 + runs[1] * 2 + 1;
|
return runs + 2 + runs[1] * 2 + 1;
|
||||||
@ -370,13 +374,14 @@ bool SkRegion::contains(const SkIRect& r) const {
|
|||||||
|
|
||||||
SkASSERT(this->isComplex());
|
SkASSERT(this->isComplex());
|
||||||
const RunType* scanline = fRunHead->findScanline(r.fTop);
|
const RunType* scanline = fRunHead->findScanline(r.fTop);
|
||||||
|
RunType bottom;
|
||||||
do {
|
do {
|
||||||
if (!scanline_contains(scanline, r.fLeft, r.fRight)) {
|
if (!scanline_contains(scanline, r.fLeft, r.fRight)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bottom = scanline_bottom(scanline);
|
||||||
scanline = scanline_next(scanline);
|
scanline = scanline_next(scanline);
|
||||||
} while (r.fBottom >= scanline[0]);
|
} while (r.fBottom > bottom);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ static void Union(SkRegion* rgn, const SkIRect& rect) {
|
|||||||
|
|
||||||
#define TEST_NO_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, !rgn.intersects(rect))
|
#define TEST_NO_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, !rgn.intersects(rect))
|
||||||
#define TEST_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, rgn.intersects(rect))
|
#define TEST_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, rgn.intersects(rect))
|
||||||
#define TEST_NO_CONTAINS(rgn, rect) REPORTER_ASSERT(reporter, rgn.contains(rect))
|
#define TEST_NO_CONTAINS(rgn, rect) REPORTER_ASSERT(reporter, !rgn.contains(rect))
|
||||||
|
|
||||||
// inspired by http://code.google.com/p/skia/issues/detail?id=958
|
// inspired by http://code.google.com/p/skia/issues/detail?id=958
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user