Chromium Code Reviews| 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. |
| * |