diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-09-24 17:21:05 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-09-24 17:21:05 +0000 |
commit | bb9aea999c29a45fcac3fdb9ecd4a45b65f603cb (patch) | |
tree | a1bdb5197ba9b9410581843c0a0c1f148d0f6b41 | |
parent | 3bbac13902257225beeeb6a25e70bda5f6c4da0c (diff) |
record dither setting so we can replay it when we (re)decode
git-svn-id: http://skia.googlecode.com/svn/trunk@368 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | include/images/SkImageRef.h | 5 | ||||
-rw-r--r-- | src/images/SkImageRef.cpp | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/include/images/SkImageRef.h b/include/images/SkImageRef.h index 6ab6e525ff..9c9896f6fc 100644 --- a/include/images/SkImageRef.h +++ b/include/images/SkImageRef.h @@ -43,6 +43,10 @@ public: */ 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 @@ private: 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 cff57aa32b..7ef5f40418 100644 --- a/src/images/SkImageRef.cpp +++ b/src/images/SkImageRef.cpp @@ -19,6 +19,7 @@ SkImageRef::SkImageRef(SkStream* stream, SkBitmap::Config config, fStream = stream; fConfig = config; fSampleSize = sampleSize; + fDoDither = true; fPrev = fNext = NULL; fFactory = NULL; @@ -104,6 +105,7 @@ bool SkImageRef::prepareBitmap(SkImageDecoder::Mode mode) { SkAutoTDelete<SkImageDecoder> ad(codec); codec->setSampleSize(fSampleSize); + codec->setDitherImage(fDoDither); if (this->onDecode(codec, fStream, &fBitmap, fConfig, mode)) { return true; } |