Index: src/core/SkAntiRun.h |
diff --git a/src/core/SkAntiRun.h b/src/core/SkAntiRun.h |
index 8214e28d5b7ee8d8575c082d31b77e9f49388d5a..5ac0e62a6ce99129f356c43709b14c45c5fb2712 100644 |
--- a/src/core/SkAntiRun.h |
+++ b/src/core/SkAntiRun.h |
@@ -21,6 +21,11 @@ public: |
int16_t* fRuns; |
uint8_t* fAlpha; |
+ // Return 0-255 given 0-256 |
+ static inline SkAlpha CatchOverflow(int alpha) { |
+ return alpha - (alpha >> 8); |
+ } |
+ |
/// Returns true if the scanline contains only a single run, |
/// of alpha value 0. |
bool empty() const { |
@@ -79,7 +84,7 @@ public: |
runs += x; |
x = 0; |
do { |
- alpha[0] = SkToU8(alpha[0] + maxValue); |
+ alpha[0] = SkToU8(CatchOverflow(alpha[0] + maxValue)); |
int n = runs[0]; |
SkASSERT(n <= middleCount); |
alpha += n; |