Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: src/ports/SkImageDecoder_CG.cpp

Issue 23004008: Don't require getLength on Mac. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/images.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkImageDecoder_CG.cpp
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index 7734ea527b3610573b1aa56ec3f5396f41ff8f52..b1d16136c464068090e6bc50afebb7ced1bc6931 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);
}
« no previous file with comments | « gyp/images.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698