aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkRect.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkRect.h')
-rw-r--r--include/core/SkRect.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index c8fc7c65c8..d249aee8d0 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -702,8 +702,19 @@ struct SK_API SkRect {
void join(const SkRect& r) {
this->join(r.fLeft, r.fTop, r.fRight, r.fBottom);
}
- // alias for join()
- void growToInclude(const SkRect& r) { this->join(r); }
+
+ void joinNonEmptyArg(const SkRect& r) {
+ SkASSERT(!r.isEmpty());
+ // if we are empty, just assign
+ 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());
+ }
+ }
/**
* Grow the rect to include the specified (x,y). After this call, the