Index: src/effects/gradients/SkClampRange.h |
diff --git a/src/effects/gradients/SkClampRange.h b/src/effects/gradients/SkClampRange.h |
index 09386d7e71bb7e9bf37c2eaede1f83885e35463f..a71009d65436aa72d82a3c2f3a88ea5faf29da00 100644 |
--- a/src/effects/gradients/SkClampRange.h |
+++ b/src/effects/gradients/SkClampRange.h |
@@ -1,4 +1,3 @@ |
- |
/* |
* Copyright 2011 Google Inc. |
* |
@@ -6,14 +5,30 @@ |
* found in the LICENSE file. |
*/ |
- |
#ifndef SkClampRange_DEFINED |
#define SkClampRange_DEFINED |
#include "SkFixed.h" |
+#include "SkScalar.h" |
+ |
+#define SK_SUPPORT_LEGACY_GRADIENT_PRECISION |
+ |
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_PRECISION |
+ #define SkGradFixed SkFixed |
+ #define SkScalarToGradFixed SkScalarToFixed |
+ #define SkFixedToGradFixed(x) (x) |
+ #define SkGradFixedToFixed(x) (x) |
+ #define kFracMax_SkGradFixed 0xFFFF |
+#else |
+ #define SkGradFixed SkFixed3232 |
+ #define SkScalarToGradFixed SkScalarToFixed3232 |
+ #define SkFixedToGradFixed SkFixedToFixed3232 |
+ #define SkGradFixedToFixed(x) (SkFixed)((x) >> 16) |
+ #define kFracMax_SkGradFixed 0xFFFFFFFFLL |
+#endif |
/** |
- * Iteration fixed fx by dx, clamping as you go to [0..0xFFFF], this class |
+ * Iteration fixed fx by dx, clamping as you go to [0..kFracMax_SkGradFixed], this class |
* computes the (up to) 3 spans there are: |
* |
* range0: use constant value V0 |
@@ -24,14 +39,14 @@ struct SkClampRange { |
int fCount0; // count for fV0 |
int fCount1; // count for interpolating (fV0...fV1) |
int fCount2; // count for fV1 |
- SkFixed fFx1; // initial fx value for the fCount1 range. |
+ SkGradFixed fFx1; // initial fx value for the fCount1 range. |
// only valid if fCount1 > 0 |
int fV0, fV1; |
- void init(SkFixed fx, SkFixed dx, int count, int v0, int v1); |
+ void init(SkGradFixed fx, SkGradFixed dx, int count, int v0, int v1); |
private: |
- void initFor1(SkFixed fx); |
+ void initFor1(SkGradFixed fx); |
}; |
#endif |