diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-28 19:13:13 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-28 19:13:13 +0000 |
commit | 1a2e71d9a84238f49844ac8020b7bd8a6ede60ce (patch) | |
tree | 9d5ac38f5c37c96ccf377bf7138eb811e781e748 /src | |
parent | 3f0a10858672e38e44ccafb7895cc1b887807db8 (diff) |
Don't require getLength on Mac.
For consistency with our other image decoders, do not depend on getLength
in Mac specific decoder.
BUG=skia:1570
R=djsollen@google.com
Review URL: https://codereview.chromium.org/23004008
git-svn-id: http://skia.googlecode.com/svn/trunk@10990 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/ports/SkImageDecoder_CG.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp index 7734ea527b..b1d16136c4 100644 --- a/src/ports/SkImageDecoder_CG.cpp +++ b/src/ports/SkImageDecoder_CG.cpp @@ -11,6 +11,7 @@ #include "SkImageEncoder.h" #include "SkMovie.h" #include "SkStream.h" +#include "SkStreamHelpers.h" #include "SkTemplates.h" #include "SkUnPreMultiply.h" @@ -30,9 +31,9 @@ static void malloc_release_proc(void* info, const void* data, size_t size) { static CGDataProviderRef SkStreamToDataProvider(SkStream* stream) { // TODO: use callbacks, so we don't have to load all the data into RAM - size_t len = stream->getLength(); - void* data = sk_malloc_throw(len); - stream->read(data, len); + SkAutoMalloc storage; + const size_t len = CopyStreamToStorage(&storage, stream); + void* data = storage.detach(); return CGDataProviderCreateWithData(data, data, len, malloc_release_proc); } |