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 SkFixed mirror_tileproc(SkFixed x) {
- int s = x << 15 >> 31;
- return (x ^ s) & 0xFFFF;
+static inline int repeat_bits(int x, const int bits) {
+ return x & ((1 << bits) - 1);
}
-static const TileProc gTileProcs[] = {
- clamp_tileproc,
- repeat_tileproc,
- mirror_tileproc
-};
+static inline int repeat_8bits(int x) {
+ return x & 0xFF;
+}
-///////////////////////////////////////////////////////////////////////////////
+// Mirror
-static inline int repeat_bits(int x, const int bits) {
- return x & ((1 << bits) - 1);
+static inline SkFixed mirror_tileproc(SkFixed x) {
+ int s = x << 15 >> 31;
+ return (x ^ s) & 0xFFFF;
}
static inline int mirror_bits(int x, const int bits) {
#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) {
///////////////////////////////////////////////////////////////////////////////
+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[],