OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SkAntiRun_DEFINED | 9 #ifndef SkAntiRun_DEFINED |
10 #define SkAntiRun_DEFINED | 10 #define SkAntiRun_DEFINED |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 x = 0; | 72 x = 0; |
73 SkDEBUGCODE(this->validate();) | 73 SkDEBUGCODE(this->validate();) |
74 } | 74 } |
75 | 75 |
76 if (middleCount) { | 76 if (middleCount) { |
77 SkAlphaRuns::Break(runs, alpha, x, middleCount); | 77 SkAlphaRuns::Break(runs, alpha, x, middleCount); |
78 alpha += x; | 78 alpha += x; |
79 runs += x; | 79 runs += x; |
80 x = 0; | 80 x = 0; |
81 do { | 81 do { |
82 alpha[0] = SkToU8(alpha[0] + maxValue); | 82 alpha[0] = SkToU8(SkTMin<int>(0xFF, alpha[0] + maxValue)); |
caryclark
2016/08/10 13:08:09
In what case is this needed?
liyuqian
2016/08/16 13:22:05
Our RunBaseAdditiveBlitter uses SkAntiRun and it m
| |
83 int n = runs[0]; | 83 int n = runs[0]; |
84 SkASSERT(n <= middleCount); | 84 SkASSERT(n <= middleCount); |
85 alpha += n; | 85 alpha += n; |
86 runs += n; | 86 runs += n; |
87 middleCount -= n; | 87 middleCount -= n; |
88 } while (middleCount > 0); | 88 } while (middleCount > 0); |
89 SkDEBUGCODE(this->validate();) | 89 SkDEBUGCODE(this->validate();) |
90 lastAlpha = alpha; | 90 lastAlpha = alpha; |
91 } | 91 } |
92 | 92 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 x -= n; | 181 x -= n; |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 private: | 185 private: |
186 SkDEBUGCODE(int fWidth;) | 186 SkDEBUGCODE(int fWidth;) |
187 SkDEBUGCODE(void validate() const;) | 187 SkDEBUGCODE(void validate() const;) |
188 }; | 188 }; |
189 | 189 |
190 #endif | 190 #endif |
OLD | NEW |