| Index: src/images/SkImageRef.cpp
|
| diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp
|
| index ea129642db15617ccf4f2a1f23b96c2a2979d9de..f3cc9e55901395f9b9fafe5a2f1323de4775e532 100644
|
| --- a/src/images/SkImageRef.cpp
|
| +++ b/src/images/SkImageRef.cpp
|
| @@ -30,6 +30,10 @@ SkImageRef::SkImageRef(const SkImageInfo& info, SkStreamRewindable* stream,
|
| fPrev = fNext = NULL;
|
| fFactory = NULL;
|
|
|
| + // This sets the colortype/alphatype to exactly match our info, so that this
|
| + // can get communicated down to the codec.
|
| + fBitmap.setConfig(info);
|
| +
|
| #ifdef DUMP_IMAGEREF_LIFECYCLE
|
| SkDebugf("add ImageRef %p [%d] data=%d\n",
|
| this, this->info().fColorType, (int)stream->getLength());
|
| @@ -118,6 +122,12 @@ bool SkImageRef::prepareBitmap(SkImageDecoder::Mode mode) {
|
| codec->setSampleSize(fSampleSize);
|
| codec->setDitherImage(fDoDither);
|
| if (this->onDecode(codec, fStream, &fBitmap, fBitmap.config(), mode)) {
|
| + if (kOpaque_SkAlphaType == fBitmap.alphaType()) {
|
| + this->changeAlphaType(kOpaque_SkAlphaType);
|
| + }
|
| + SkASSERT(this->info().fColorType == fBitmap.colorType());
|
| + SkASSERT(this->info().fWidth == fBitmap.width());
|
| + SkASSERT(this->info().fHeight == fBitmap.height());
|
| return true;
|
| }
|
| }
|
| @@ -178,6 +188,10 @@ SkImageRef::SkImageRef(SkReadBuffer& buffer, SkBaseMutex* mutex)
|
|
|
| fPrev = fNext = NULL;
|
| fFactory = NULL;
|
| +
|
| + // This sets the colortype/alphatype to exactly match our info, so that this
|
| + // can get communicated down to the codec.
|
| + fBitmap.setConfig(this->info());
|
| }
|
|
|
| void SkImageRef::flatten(SkWriteBuffer& buffer) const {
|
|
|