diff options
author | Florin Malita <fmalita@chromium.org> | 2016-12-12 15:43:51 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-12 21:25:37 +0000 |
commit | 9d1cc66b6065e7aafc4e999a36c9ec680e4f13b7 (patch) | |
tree | c4c72292ea7681cd96ca83825918b4c5194d3eab | |
parent | 689169dcad2e8a42e868588815f465f3da68816a (diff) |
Use unsigned arithmetic for SkBitmapProcStateAutoMapper bias
To avoid undefined int underflow behavior.
BUG=skia:6017
R=mtklein@google.com,reed@google.com
Change-Id: Ib707ad5e1d87eda70525c56db14849c4164c5640
Reviewed-on: https://skia-review.googlesource.com/5861
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
-rw-r--r-- | src/core/SkBitmapProcState.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h index cdf02ea9e0..88e5193b2a 100644 --- a/src/core/SkBitmapProcState.h +++ b/src/core/SkBitmapProcState.h @@ -236,8 +236,11 @@ public: biasY = s.fFilterOneY >> 1; } - fX = SkScalarToFractionalInt(pt.x()) - SkFixedToFractionalInt(biasX); - fY = SkScalarToFractionalInt(pt.y()) - SkFixedToFractionalInt(biasY); + // punt to unsigned for defined underflow behavior + fX = (SkFractionalInt)((uint64_t)SkScalarToFractionalInt(pt.x()) - + (uint64_t)SkFixedToFractionalInt(biasX)); + fY = (SkFractionalInt)((uint64_t)SkScalarToFractionalInt(pt.y()) - + (uint64_t)SkFixedToFractionalInt(biasY)); if (scalarPoint) { scalarPoint->set(pt.x() - SkFixedToScalar(biasX), |