Index: src/codec/SkCodec_libico.cpp |
diff --git a/src/codec/SkCodec_libico.cpp b/src/codec/SkCodec_libico.cpp |
index 798169d82b344902571d996d34c127818b3576e7..888bb807998961a759048ca78a5a790e9c58f97a 100644 |
--- a/src/codec/SkCodec_libico.cpp |
+++ b/src/codec/SkCodec_libico.cpp |
@@ -113,7 +113,7 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) { |
for (uint32_t i = 0; i < numImages; i++) { |
uint32_t offset = directoryEntries.get()[i].offset; |
uint32_t size = directoryEntries.get()[i].size; |
- |
+ |
// Ensure that the offset is valid |
if (offset < bytesRead) { |
SkCodecPrintf("Warning: invalid ico offset.\n"); |
@@ -133,6 +133,9 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) { |
SkData::NewFromStream(inputStream.get(), size)); |
if (nullptr == data.get()) { |
SkCodecPrintf("Warning: could not create embedded stream.\n"); |
+ // FIXME: This is a good solution if we have already created at |
+ // least one valid codec. Otherwise, we may want to try to |
+ // partially decode this incomplete embedded image. |
scroggo
2015/10/01 14:48:31
Is there anything to partially decode if no embedd
msarett
2015/10/01 18:14:14
Good point, this comment makes no sense.
|
break; |
} |
SkAutoTDelete<SkMemoryStream> embeddedStream(new SkMemoryStream(data.get())); |
@@ -235,8 +238,8 @@ SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const { |
*/ |
SkCodec::Result SkIcoCodec::onGetPixels(const SkImageInfo& dstInfo, |
void* dst, size_t dstRowBytes, |
- const Options& opts, SkPMColor* ct, |
- int* ptr) { |
+ const Options& opts, SkPMColor* colorTable, |
+ int* colorCount, int* rowsDecoded) { |
if (opts.fSubset) { |
// Subsets are not supported. |
return kUnimplemented; |
@@ -272,7 +275,11 @@ SkCodec::Result SkIcoCodec::onGetPixels(const SkImageInfo& dstInfo, |
break; |
} |
SkImageInfo info = dstInfo.makeAlphaType(embeddedAlpha); |
- result = embeddedCodec->getPixels(info, dst, dstRowBytes, &opts, ct, ptr); |
+ result = embeddedCodec->getPixels(info, dst, dstRowBytes, &opts, colorTable, |
+ colorCount); |
+ // The embedded codec will handle filling incomplete images, so we will indicate |
+ // that all of the rows are initialized. |
+ *rowsDecoded = info.height(); |
msarett
2015/10/01 12:44:52
It's a bit strange when a call to getPixels() call
|
// On a fatal error, keep trying to find an image to decode |
if (kInvalidConversion == result || kInvalidInput == result || |