optimize region::intersect when one wholly contains the other

clone of https://codereview.appspot.com/7237055/



git-svn-id: http://skia.googlecode.com/svn/trunk@7491 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2013-01-31 15:24:24 +00:00
parent a3c1348976
commit 633c32b13b
2 changed files with 7 additions and 0 deletions

View File

@ -36,6 +36,7 @@
'../bench/RectBench.cpp',
'../bench/RefCntBench.cpp',
'../bench/RegionBench.cpp',
'../bench/RegionContainBench.cpp',
'../bench/RepeatTileBench.cpp',
'../bench/RTreeBench.cpp',
'../bench/ScalarBench.cpp',

View File

@ -1019,6 +1019,12 @@ bool SkRegion::Oper(const SkRegion& rgnaOrig, const SkRegion& rgnbOrig, Op op,
if (a_rect & b_rect) {
return setRectCheck(result, bounds);
}
if (a_rect && rgna->fBounds.contains(rgnb->fBounds)) {
return setRegionCheck(result, *rgnb);
}
if (b_rect && rgnb->fBounds.contains(rgna->fBounds)) {
return setRegionCheck(result, *rgna);
}
break;
case kUnion_Op: