Index: src/utils/mac/SkStream_mac.cpp |
diff --git a/src/utils/mac/SkStream_mac.cpp b/src/utils/mac/SkStream_mac.cpp |
index 36e5194a1990b3e65bdbf0fe3654bcff5659b167..e878c97244151f52d8f2d4dfdf027cb791e9f4a2 100644 |
--- a/src/utils/mac/SkStream_mac.cpp |
+++ b/src/utils/mac/SkStream_mac.cpp |
@@ -48,14 +48,14 @@ static void release_info_proc(void* info) { |
delete (SkStream*)info; |
} |
-CGDataProviderRef SkCreateDataProviderFromStream(SkStream* stream) { |
+CGDataProviderRef SkCreateDataProviderFromStream(std::unique_ptr<SkStreamRewindable> stream) { |
// TODO: Replace with SkStream::getData() when that is added. Then we only |
// have one version of CGDataProviderCreateWithData (i.e. same release proc) |
const void* addr = stream->getMemoryBase(); |
if (addr) { |
// special-case when the stream is just a block of ram |
- return CGDataProviderCreateWithData(stream, addr, stream->getLength(), |
- delete_stream_proc); |
+ size_t size = stream->getLength(); |
+ return CGDataProviderCreateWithData(stream.release(), addr, size, delete_stream_proc); |
} |
CGDataProviderSequentialCallbacks rec; |
@@ -65,17 +65,17 @@ CGDataProviderRef SkCreateDataProviderFromStream(SkStream* stream) { |
rec.skipForward = skip_forward_proc; |
rec.rewind = rewind_proc; |
rec.releaseInfo = release_info_proc; |
- return CGDataProviderCreateSequential(stream, &rec); |
+ return CGDataProviderCreateSequential(stream.release(), &rec); |
} |
/////////////////////////////////////////////////////////////////////////////// |
#include "SkData.h" |
-CGDataProviderRef SkCreateDataProviderFromData(SkData* data) { |
- data->ref(); |
- return CGDataProviderCreateWithData(data, data->data(), data->size(), |
- unref_proc); |
+CGDataProviderRef SkCreateDataProviderFromData(sk_sp<SkData> data) { |
+ const void* addr = data->data(); |
+ size_t size = data->size(); |
+ return CGDataProviderCreateWithData(data.release(), addr, size, unref_proc); |
} |
#endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |