OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #ifndef SkClampRange_DEFINED | 8 #ifndef SkClampRange_DEFINED |
9 #define SkClampRange_DEFINED | 9 #define SkClampRange_DEFINED |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 struct SkClampRange { | 28 struct SkClampRange { |
29 int fCount0; // count for fV0 | 29 int fCount0; // count for fV0 |
30 int fCount1; // count for interpolating (fV0...fV1) | 30 int fCount1; // count for interpolating (fV0...fV1) |
31 int fCount2; // count for fV1 | 31 int fCount2; // count for fV1 |
32 SkGradFixed fFx1; // initial fx value for the fCount1 range. | 32 SkGradFixed fFx1; // initial fx value for the fCount1 range. |
33 // only valid if fCount1 > 0 | 33 // only valid if fCount1 > 0 |
34 int fV0, fV1; | 34 int fV0, fV1; |
35 | 35 |
36 void init(SkGradFixed fx, SkGradFixed dx, int count, int v0, int v1); | 36 void init(SkGradFixed fx, SkGradFixed dx, int count, int v0, int v1); |
37 | 37 |
| 38 void validate(int count) const { |
| 39 #ifdef SK_DEBUG |
| 40 SkASSERT(fCount0 >= 0); |
| 41 SkASSERT(fCount1 >= 0); |
| 42 SkASSERT(fCount2 >= 0); |
| 43 SkASSERT(fCount0 + fCount1 + fCount2 == count); |
| 44 #endif |
| 45 } |
| 46 |
38 private: | 47 private: |
39 void initFor1(SkGradFixed fx); | 48 void initFor1(SkGradFixed fx); |
40 }; | 49 }; |
41 | 50 |
42 #endif | 51 #endif |
OLD | NEW |