commit | 440c5a98dee428c661b77d149e30c794d264b8cd | [log] [tgz] |
---|---|---|
author | scroggo <scroggo@google.com> | Wed Jan 27 10:51:56 2016 -0800 |
committer | Commit bot <commit-bot@chromium.org> | Wed Jan 27 10:51:56 2016 -0800 |
tree | 84aca6706c9602b3e59c476badaa7bbce92ee10c | |
parent | 2bbc343c148218c0f47e155ffc6f2ebfbfe05a76 [diff] |
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
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp index 9529308..80628d4 100644 --- a/src/core/SkStream.cpp +++ b/src/core/SkStream.cpp
@@ -890,12 +890,9 @@ } 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(); }