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/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 03393f7..059cc93 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -94,7 +94,11 @@
unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
if ((fDstToIndex.getType() & ~mask) == 0) {
+#ifdef SK_IGNORE_GRADIENT_DITHER_FIX
fFlags |= SkShader::kConstInY32_Flag;
+#else
+ // when we dither, we are (usually) not const-in-Y
+#endif
if ((fFlags & SkShader::kHasSpan16_Flag) && !paint.isDither()) {
// only claim this if we do have a 16bit mode (i.e. none of our
// colors have alpha), and if we are not dithering (which obviously
@@ -328,7 +332,6 @@
SkASSERT(fi < SkGradientShaderBase::kCache16Count);
dither_memset16(dstC, cache[toggle + fi],
cache[next_dither_toggle16(toggle) + fi], count);
-
}
void shadeSpan16_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,