michael@0: michael@0: /* michael@0: * Copyright 2011 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #ifndef SkClampRange_DEFINED michael@0: #define SkClampRange_DEFINED michael@0: michael@0: #include "SkFixed.h" michael@0: michael@0: /** michael@0: * Iteration fixed fx by dx, clamping as you go to [0..0xFFFF], this class michael@0: * computes the (up to) 3 spans there are: michael@0: * michael@0: * range0: use constant value V0 michael@0: * range1: iterate as usual fx += dx michael@0: * range2: use constant value V1 michael@0: */ michael@0: struct SkClampRange { michael@0: int fCount0; // count for fV0 michael@0: int fCount1; // count for interpolating (fV0...fV1) michael@0: int fCount2; // count for fV1 michael@0: SkFixed fFx1; // initial fx value for the fCount1 range. michael@0: // only valid if fCount1 > 0 michael@0: int fV0, fV1; michael@0: bool fOverflowed; // true if we had to clamp due to numerical overflow michael@0: michael@0: void init(SkFixed fx, SkFixed dx, int count, int v0, int v1); michael@0: michael@0: private: michael@0: void initFor1(SkFixed fx); michael@0: }; michael@0: michael@0: #endif