aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-08-28 13:32:37 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-28 17:54:06 +0000
commit3c2d09f89ae119de506722f550a6e28305d4813f (patch)
tree15ec5a80e6d3292bef61fea74d8fedf4b8790309 /include
parentde67a2c0e01a68ca8bb3a569947f8e33350f31f7 (diff)
change SkRect::growToInclude to take a point instead of x,y
This avoids the dangerous overload problem of growToInclude(0, 0) matching to (const SkPoint[], count) rather than growToInclude(x, y) Bug: skia: Change-Id: Iaba8b1a579638ff363fde62e4e3004052dd2b2ac Reviewed-on: https://skia-review.googlesource.com/39501 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkRect.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index a2668d9604..ea09c6bcba 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -790,11 +790,11 @@ public:
* contains(x,y) -> fLeft <= x < fRight && fTop <= y < fBottom. Also note
* that contains(x,y) always returns false if the rect is empty.
*/
- void growToInclude(SkScalar x, SkScalar y) {
- fLeft = SkMinScalar(x, fLeft);
- fRight = SkMaxScalar(x, fRight);
- fTop = SkMinScalar(y, fTop);
- fBottom = SkMaxScalar(y, fBottom);
+ void growToInclude(SkPoint pt) {
+ fLeft = SkMinScalar(pt.fX, fLeft);
+ fRight = SkMaxScalar(pt.fX, fRight);
+ fTop = SkMinScalar(pt.fY, fTop);
+ fBottom = SkMaxScalar(pt.fY, fBottom);
}
/** Bulk version of growToInclude */
@@ -808,7 +808,7 @@ public:
SkASSERT(stride >= sizeof(SkPoint));
const SkPoint* end = (const SkPoint*)((intptr_t)pts + count * stride);
for (; pts < end; pts = (const SkPoint*)((intptr_t)pts + stride)) {
- this->growToInclude(pts->fX, pts->fY);
+ this->growToInclude(*pts);
}
}