add roundOut()

git-svn-id: http://skia.googlecode.com/svn/trunk@2019 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-08-01 20:53:19 +00:00
parent 1b20280f9b
commit 099d22dbce

View File

@ -566,6 +566,18 @@ struct SK_API SkRect {
SkScalarCeil(fRight), SkScalarCeil(fBottom));
}
/**
* 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