| Index: src/core/SkOrderedReadBuffer.cpp | 
| diff --git a/src/core/SkOrderedReadBuffer.cpp b/src/core/SkOrderedReadBuffer.cpp | 
| index 85491c5607545b04f8c48652399a611b3524cd21..4af64706a1db70e9246863a75f1ef9d183982c11 100644 | 
| --- a/src/core/SkOrderedReadBuffer.cpp | 
| +++ b/src/core/SkOrderedReadBuffer.cpp | 
| @@ -197,8 +197,23 @@ void SkOrderedReadBuffer::readBitmap(SkBitmap* bitmap) { | 
| // A non-zero size means the SkBitmap was encoded. | 
| const void* data = this->skip(length); | 
| if (fBitmapDecoder != NULL && fBitmapDecoder(data, length, bitmap)) { | 
| -                SkASSERT(bitmap->width() == width && bitmap->height() == height); | 
| -                return; | 
| +                if (bitmap->width() == width && bitmap->height() == height) { | 
| +                    return; | 
| +                } | 
| + | 
| +                // This case can only be reached if extractSubset was called, so | 
| +                // the recorded width and height must be smaller than (or equal to | 
| +                // the encoded width and height. | 
| +                SkASSERT(width <= bitmap->width() && height <= bitmap->height()); | 
| + | 
| +                // FIXME: Once the writer is changed to record the (x,y) offset, | 
| +                // they will be used to store the correct portion of the picture. | 
| +                SkBitmap subsetBm; | 
| +                SkIRect subset = SkIRect::MakeWH(width, height); | 
| +                if (bitmap->extractSubset(&subsetBm, subset)) { | 
| +                    bitmap->swap(subsetBm); | 
| +                    return; | 
| +                } | 
| } | 
| // This bitmap was encoded when written, but we are unable to decode, possibly due to | 
| // not having a decoder. | 
|  |