aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkRect.h
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-01 20:53:19 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-01 20:53:19 +0000
commit099d22dbce650abdda0c5c5a7ee89ee0850897f1 (patch)
tree4922fd4a9b9dba5fd046c9d9759af14c835f23bb /include/core/SkRect.h
parent1b20280f9b2e95fdcf4a2ee6f7f9d5a92c5b94c2 (diff)
add roundOut()
git-svn-id: http://skia.googlecode.com/svn/trunk@2019 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkRect.h')
-rw-r--r--include/core/SkRect.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 932af79aaf..5270e33895 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -567,6 +567,18 @@ struct SK_API SkRect {
}
/**
+ * Expand this rectangle by rounding its coordinates "out", choosing the
+ * floor of top and left, and the ceil of right and bottom. If this rect
+ * is already on integer coordinates, then it will be unchanged.
+ */
+ void roundOut() {
+ this->set(SkScalarFloorToScalar(fLeft),
+ SkScalarFloorToScalar(fTop),
+ SkScalarCeilToScalar(fRight),
+ SkScalarCeilToScalar(fBottom));
+ }
+
+ /**
* Swap top/bottom or left/right if there are flipped (i.e. if width()
* or height() would have returned a negative value.) This should be called
* if the edges are computed separately, and may have crossed over each