Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(986)

Unified Diff: include/core/SkRegion.h

Issue 2116513002: inline very common intersect+rect_rgn (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRegion.h
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h
index eb0f1367aba4a6b14bca770525bda848bcbbe9c9..a0f0e4ad3c6809dbd562894ea4ed3b754c38fe05 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698