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