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 @@ -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