Fix some SkCodecPrintfs

Silence the warning about peeking. Until we implement peeking for the
stream often used, it will always print, cluttering the logs.

Add some more information to the warning about failing to rewind.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1564843002

Review URL: https://codereview.chromium.org/1564843002
This commit is contained in:
scroggo 2016-01-06 09:53:34 -08:00 committed by Commit bot
parent b50b97d70a
commit 3ab9f2ede4

View File

@ -62,13 +62,16 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream,
// we trust the caller to use a large enough buffer.
if (0 == bytesRead) {
SkCodecPrintf("Could not peek!\n");
// TODO: After implementing peek in CreateJavaOutputStreamAdaptor.cpp, this
// printf could be useful to notice failures.
// SkCodecPrintf("Encoded image data failed to peek!\n");
// It is possible the stream does not support peeking, but does support
// rewinding.
// Attempt to read() and pass the actual amount read to the decoder.
bytesRead = stream->read(buffer, bytesToRead);
if (!stream->rewind()) {
SkCodecPrintf("Could not rewind!\n");
SkCodecPrintf("Encoded image data could not peek or rewind to determine format!\n");
return nullptr;
}
}