Index: src/core/SkAnalyticEdge.h |
diff --git a/src/core/SkAnalyticEdge.h b/src/core/SkAnalyticEdge.h |
index f4b23ba2b6bd6ab77c5e0b2d0bc5aaeb1d291d96..00812866d5063cc848e42239dea2ba57a4dcd84d 100644 |
--- a/src/core/SkAnalyticEdge.h |
+++ b/src/core/SkAnalyticEdge.h |
@@ -43,7 +43,8 @@ struct SkAnalyticEdge { |
static const int kDefaultAccuracy = 2; // default accuracy for snapping |
static inline SkFixed snapY(SkFixed y, int accuracy = kDefaultAccuracy) { |
- return SkFixedRoundToFixed(y << accuracy) >> accuracy; |
+ // This approach is safer than left shift, round, then right shift |
+ return (y + (SK_Fixed1 >> (accuracy + 1))) >> (16 - accuracy) << (16 - accuracy); |
} |
// Update fX, fY of this edge so fY = y |