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

Unified Diff: include/core/SkRect.h

Issue 1118293002: Simple CL to add a joinWithPossiblyEmptyArg to SkRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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/SkRect.h
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 0f68825fc1ced755a9ae41e89f807c9fcd76ff3b..00712a74bae419ce0aff7242c55a45c7440d5eb0 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -747,14 +747,22 @@ public:
if (fLeft >= fRight || fTop >= fBottom) {
*this = r;
} else {
- fLeft = SkMinScalar(fLeft, r.left());
- fTop = SkMinScalar(fTop, r.top());
- fRight = SkMaxScalar(fRight, r.right());
- fBottom = SkMaxScalar(fBottom, r.bottom());
+ this->joinPossiblyEmptyArg(r);
}
}
/**
+ * Updates this rectangle to enclose itself and a potentially empty rect. We really treat the
bsalomon 2015/05/01 15:45:12 I'm not sure the comment and name are right. The p
+ * argument rectangle as two sorted points.
+ */
+ void joinPossiblyEmptyArg(const SkRect& r) {
reed1 2015/05/01 15:44:40 nit: I think joinPossiblyEmptyRect is more clear.
+ fLeft = SkMinScalar(fLeft, r.left());
+ fTop = SkMinScalar(fTop, r.top());
+ fRight = SkMaxScalar(fRight, r.right());
+ fBottom = SkMaxScalar(fBottom, r.bottom());
+ }
+
+ /**
* Grow the rect to include the specified (x,y). After this call, the
* following will be true: fLeft <= x <= fRight && fTop <= y <= fBottom.
*
« 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