diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-31 15:24:24 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-31 15:24:24 +0000 |
commit | 633c32b13b5d199d797be669d3dc7981d603a945 (patch) | |
tree | a2479b7d6d2500816c143aa14ff71d69aa21165d | |
parent | a3c134897602f878da9dd858109498392a5daae9 (diff) |
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
-rw-r--r-- | gyp/bench.gypi | 1 | ||||
-rw-r--r-- | src/core/SkRegion.cpp | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/gyp/bench.gypi b/gyp/bench.gypi index 27e307cfa1..cf5c02e6ac 100644 --- a/gyp/bench.gypi +++ b/gyp/bench.gypi @@ -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', diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index dcad9eaab6..936c87e832 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -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: |