aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-06-30 07:47:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-30 07:47:34 -0700
commitd922c33a8e804f9d32aa9aa399ca52e50ec9f2d2 (patch)
treee89f9c1dc246e5f7bb051acc06d5c35f9be12f49 /include
parent40e25b2e348d18148c57b4551a8989fbc08e7fd1 (diff)
inline very common intersect+rect_rgn
Extracted from previous compound CL (with other changes). This is the very common case for clips, and inlining this eliminates a series of function calls. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2116513002 TBR=mtklein Review-Url: https://codereview.chromium.org/2116513002
Diffstat (limited to 'include')
-rw-r--r--include/core/SkRegion.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h
index eb0f1367ab..a0f0e4ad3c 100644
--- a/include/core/SkRegion.h
+++ b/include/core/SkRegion.h
@@ -255,7 +255,15 @@ public:
* specified rectangle: this = (this op rect).
* Return true if the resulting region is non-empty.
*/
- bool op(const SkIRect& rect, Op op) { return this->op(*this, rect, op); }
+ bool op(const SkIRect& rect, Op op) {
+ if (this->isRect() && kIntersect_Op == op) {
+ if (!fBounds.intersect(rect)) {
+ return this->setEmpty();
+ }
+ return true;
+ }
+ return this->op(*this, rect, op);
+ }
/**
* Set this region to the result of applying the Op to this region and the