Chromium Code Reviews| Index: src/gpu/SkGr.cpp | 
| diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp | 
| index fb2ebdd53fcbbf70c1ed93568f14ed3526b7bce8..c566d6ffaf7b48fd6d48eadda680d2e0c4050f3f 100644 | 
| --- a/src/gpu/SkGr.cpp | 
| +++ b/src/gpu/SkGr.cpp | 
| @@ -13,6 +13,7 @@ | 
| #include "SkPixelRef.h" | 
| #include "GrResourceCache.h" | 
| #include "GrGpu.h" | 
| +#include "effects/GrDitherEffect.h" | 
| #include "GrDrawTargetCaps.h" | 
| #ifndef SK_IGNORE_ETC1_SUPPORT | 
| @@ -465,6 +466,28 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, bool ju | 
| } | 
| } | 
| } | 
| + | 
| 
 
robertphillips
2014/06/11 17:20:24
Wrap this in SK_IGNORE_GPU_DITHER and add it to gy
 
krajcevski
2014/06/11 22:33:18
Done.
 
 | 
| + // If the dither flag is set, then we need to see if the underlying context | 
| + // supports it. If not, then install a dither effect. | 
| + if (skPaint.isDither()) { | 
| + // What are we rendering into? | 
| + const GrRenderTarget *target = context->getRenderTarget(); | 
| + if (NULL == target) { | 
| + target = context->getGpu()->getDrawState().getRenderTarget(); | 
| + } | 
| + SkASSERT(NULL != target); | 
| + | 
| + if (target->config() == kRGBA_8888_GrPixelConfig || | 
| + target->config() == kBGRA_8888_GrPixelConfig) { | 
| + // The dither flag is set and the target is likely | 
| + // not going to be dithered by the GPU. | 
| + SkAutoTUnref<GrEffectRef> effect(GrDitherEffect::Create()); | 
| + if (NULL != effect.get()) { | 
| + grPaint->addColorEffect(effect); | 
| + grPaint->setDither(false); | 
| + } | 
| + } | 
| + } | 
| } | 
| /** |