Consolidate SkStream copying methods
Make SkCopyStreamToData call SkStreamCopy, removing duplicate code. The former still has its own method of copying with a length, since it saves one copy. BUG=skia:4788 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1640793002 Review URL: https://codereview.chromium.org/1640793002
This commit is contained in:
parent
2bbc343c14
commit
440c5a98de
@ -890,12 +890,9 @@ SkData* SkCopyStreamToData(SkStream* stream) {
|
||||
}
|
||||
|
||||
SkDynamicMemoryWStream tempStream;
|
||||
const size_t bufferSize = 4096;
|
||||
char buffer[bufferSize];
|
||||
do {
|
||||
size_t bytesRead = stream->read(buffer, bufferSize);
|
||||
tempStream.write(buffer, bytesRead);
|
||||
} while (!stream->isAtEnd());
|
||||
if (!SkStreamCopy(&tempStream, stream)) {
|
||||
return nullptr;
|
||||
}
|
||||
return tempStream.copyToData();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user