Go from a 1x2 to a 2x2 dither cell, and change/simplify the logic for how we
compute the "dithered" version of a color to just a graduated fixed-point-round.
Also, add this new dither to conical and sweep, which before had no dithering.

Disabled for now using SK_IGNORE_GRADIENT_DITHER_FIX. Will enable this and
and rebaseline skia.

http://code.google.com/p/skia/issues/detail?id=1098
Review URL: https://codereview.appspot.com/7248046

git-svn-id: http://skia.googlecode.com/svn/trunk@7549 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 4d14dc6..82535de 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2012 Google Inc.
  *
@@ -20,6 +19,8 @@
 #include "SkBitmapCache.h"
 #include "SkShader.h"
 
+#define SK_IGNORE_GRADIENT_DITHER_FIX
+
 #ifndef SK_DISABLE_DITHER_32BIT_GRADIENT
     #define USE_DITHER_32BIT_GRADIENT
 #endif
@@ -108,7 +109,7 @@
         /// Seems like enough for visual accuracy. TODO: if pos[] deserves
         /// it, use a larger cache.
         kCache32Bits    = 8,
-        kCache32Count = (1 << kCache32Bits),
+        kCache32Count   = (1 << kCache32Bits),
         kCache32Shift   = 16 - kCache32Bits,
         kSqrt32Shift    = 8 - kCache32Bits,
 
@@ -176,7 +177,13 @@
 };
 
 static inline int init_dither_toggle(int x, int y) {
+#ifdef SK_IGNORE_GRADIENT_DITHER_FIX
     return ((x ^ y) & 1) * SkGradientShaderBase::kDitherStride32;
+#else
+    x &= 1;
+    y = (y & 1) << 1;
+    return (x | y) * SkGradientShaderBase::kDitherStride32;
+#endif
 }
 
 static inline int next_dither_toggle(int toggle) {