rearrange functions to group clamp, repeat, mirror helpers together.
git-svn-id: http://skia.googlecode.com/svn/trunk@3135 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkGradientShader.cpp b/src/effects/SkGradientShader.cpp
index cfae9aa..ef3edc0 100644
--- a/src/effects/SkGradientShader.cpp
+++ b/src/effects/SkGradientShader.cpp
@@ -49,35 +49,33 @@
return retval;
}
-///////////////////////////////////////////////////////////////////////////////
-
-typedef SkFixed (*TileProc)(SkFixed);
+// Clamp
static SkFixed clamp_tileproc(SkFixed x) {
return SkClampMax(x, 0xFFFF);
}
+// Repeat
+
static SkFixed repeat_tileproc(SkFixed x) {
return x & 0xFFFF;
}
+static inline int repeat_bits(int x, const int bits) {
+ return x & ((1 << bits) - 1);
+}
+
+static inline int repeat_8bits(int x) {
+ return x & 0xFF;
+}
+
+// Mirror
+
static inline SkFixed mirror_tileproc(SkFixed x) {
int s = x << 15 >> 31;
return (x ^ s) & 0xFFFF;
}
-static const TileProc gTileProcs[] = {
- clamp_tileproc,
- repeat_tileproc,
- mirror_tileproc
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-static inline int repeat_bits(int x, const int bits) {
- return x & ((1 << bits) - 1);
-}
-
static inline int mirror_bits(int x, const int bits) {
#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
if (x & (1 << bits))
@@ -89,10 +87,6 @@
#endif
}
-static inline int repeat_8bits(int x) {
- return x & 0xFF;
-}
-
static inline int mirror_8bits(int x) {
#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
if (x & 256) {
@@ -107,6 +101,17 @@
///////////////////////////////////////////////////////////////////////////////
+typedef SkFixed (*TileProc)(SkFixed);
+
+static const TileProc gTileProcs[] = {
+ clamp_tileproc,
+ repeat_tileproc,
+ mirror_tileproc
+};
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
class Gradient_Shader : public SkShader {
public:
Gradient_Shader(const SkColor colors[], const SkScalar pos[],