aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/SkBitmapProcState.h7
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),