diff options
Diffstat (limited to 'src/images/SkImageDecoder_libico.cpp')
-rw-r--r-- | src/images/SkImageDecoder_libico.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp index 6335136fa0..b14e19614c 100644 --- a/src/images/SkImageDecoder_libico.cpp +++ b/src/images/SkImageDecoder_libico.cpp @@ -152,6 +152,20 @@ bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) int offset = read4Bytes(buf, 18 + choice*16); if ((size_t)(offset + size) > length) return false; + + // Check to see if this is a PNG image inside the ICO + { + SkMemoryStream subStream(buf + offset, size, false); + SkAutoTDelete<SkImageDecoder> otherDecoder(SkImageDecoder::Factory(&subStream)); + if (otherDecoder.get() != NULL) { + // Set fields on the other decoder to be the same as this one. + this->copyFieldsToOther(otherDecoder.get()); + if(otherDecoder->decode(&subStream, bm, this->getDefaultPref(), mode)) { + return true; + } + } + } + //int infoSize = read4Bytes(buf, offset); //40 //int width = read4Bytes(buf, offset+4); //should == w //int height = read4Bytes(buf, offset+8); //should == 2*h |