diff options
author | Robert Phillips <robertphillips@google.com> | 2018-05-18 10:19:05 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-18 14:53:45 +0000 |
commit | 8f8d481b44fc486e7190c6e2db8077226d53c969 (patch) | |
tree | 9b95ff9d8d2a801f7daf15c74b796d4c18660a28 /include | |
parent | dd8b1fc41bb8b09974836a30ec357f8f20ad7cae (diff) |
Add SkIRect::adjust method
Change-Id: Ib18d1a82944524e20d5d72912d8db7a823c470de
Reviewed-on: https://skia-review.googlesource.com/128884
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkRect.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h index d4a9c05c68..7b8e0032e5 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -413,6 +413,25 @@ struct SK_API SkIRect { */ void outset(int32_t dx, int32_t dy) { this->inset(-dx, -dy); } + /** Adjust SkIRect by adding dL to fLeft, dT to fTop, dR to fRight and fB to fBottom. + + If dL is positive, narrows SkIRect on the left. If negative, widens it on the left. + If dT is positive, shrinks SkIRect on the top. If negative, lengthens it on the top. + If dR is positive, narrows SkIRect on the right. If negative, widens it on the right. + If dB is positive, shrinks SkIRect on the bottom. If negative, lengthens it on the bottom. + + @param dL offset added to fLeft + @param dT offset added to fTop + @param dR offset added to fRight + @param dB offset added to fBottom + */ + void adjust(int32_t dL, int32_t dT, int32_t dR, int32_t dB) { + fLeft = Sk32_sat_add(fLeft, dL); + fTop = Sk32_sat_add(fTop, dT); + fRight = Sk32_sat_add(fRight, dR); + fBottom = Sk32_sat_add(fBottom, dB); + } + /** Returns true if: fLeft <= x < fRight && fTop <= y < fBottom. Returns false if SkIRect is empty. |