add setDither api, so we can retain this setting when we (re)decode the bitmap
diff --git a/include/images/SkImageRef.h b/include/images/SkImageRef.h
index 6ab6e52..9c9896f 100644
--- a/include/images/SkImageRef.h
+++ b/include/images/SkImageRef.h
@@ -43,6 +43,10 @@
*/
SkImageRef(SkStream*, SkBitmap::Config config, int sampleSize = 1);
virtual ~SkImageRef();
+
+ /** this value is passed onto the decoder. Default is true
+ */
+ void setDitherImage(bool dither) { fDoDither = dither; }
/** Return true if the image can be decoded. If so, and bitmap is non-null,
call its setConfig() with the corresponding values, but explicitly will
@@ -89,6 +93,7 @@
SkStream* fStream;
SkBitmap::Config fConfig;
int fSampleSize;
+ bool fDoDither;
bool fErrorInDecoding;
friend class SkImageRefPool;
diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp
index cff57aa..7ef5f40 100644
--- a/src/images/SkImageRef.cpp
+++ b/src/images/SkImageRef.cpp
@@ -19,6 +19,7 @@
fStream = stream;
fConfig = config;
fSampleSize = sampleSize;
+ fDoDither = true;
fPrev = fNext = NULL;
fFactory = NULL;
@@ -104,6 +105,7 @@
SkAutoTDelete<SkImageDecoder> ad(codec);
codec->setSampleSize(fSampleSize);
+ codec->setDitherImage(fDoDither);
if (this->onDecode(codec, fStream, &fBitmap, fConfig, mode)) {
return true;
}