OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkClampRange_DEFINED | 10 #ifndef SkClampRange_DEFINED |
11 #define SkClampRange_DEFINED | 11 #define SkClampRange_DEFINED |
12 | 12 |
13 #include "SkFixed.h" | 13 #include "SkFixed.h" |
14 | 14 |
15 /** | 15 /** |
16 * Iteration fixed fx by dx, clamping as you go to [0..0xFFFF], this class | 16 * Iteration fixed fx by dx, clamping as you go to [0..0xFFFF], this class |
17 * computes the (up to) 3 spans there are: | 17 * computes the (up to) 3 spans there are: |
18 * | 18 * |
19 * range0: use constant value V0 | 19 * range0: use constant value V0 |
20 * range1: iterate as usual fx += dx | 20 * range1: iterate as usual fx += dx |
21 * range2: use constant value V1 | 21 * range2: use constant value V1 |
22 */ | 22 */ |
23 struct SkClampRange { | 23 struct SkClampRange { |
24 int fCount0; // count for fV0 | 24 int fCount0; // count for fV0 |
25 int fCount1; // count for interpolating (fV0...fV1) | 25 int fCount1; // count for interpolating (fV0...fV1) |
26 int fCount2; // count for fV1 | 26 int fCount2; // count for fV1 |
27 SkFixed fFx1; // initial fx value for the fCount1 range. | 27 SkFixed fFx1; // initial fx value for the fCount1 range. |
28 // only valid if fCount1 > 0 | 28 // only valid if fCount1 > 0 |
29 int fV0, fV1; | 29 int fV0, fV1; |
30 bool fOverflowed; // true if we had to clamp due to numerical overflow | |
31 | 30 |
32 void init(SkFixed fx, SkFixed dx, int count, int v0, int v1); | 31 void init(SkFixed fx, SkFixed dx, int count, int v0, int v1); |
33 | 32 |
34 private: | 33 private: |
35 void initFor1(SkFixed fx); | 34 void initFor1(SkFixed fx); |
36 }; | 35 }; |
37 | 36 |
38 #endif | 37 #endif |
OLD | NEW |