expose skdata -> cgdataprovider helper
git-svn-id: http://skia.googlecode.com/svn/trunk@8374 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
2874906bf2
commit
12b1f19c1f
@ -19,6 +19,7 @@
|
||||
#endif
|
||||
|
||||
class SkBitmap;
|
||||
class SkData;
|
||||
class SkStream;
|
||||
|
||||
/**
|
||||
@ -60,5 +61,6 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output);
|
||||
* Now when the provider is finally deleted, it will delete the stream.
|
||||
*/
|
||||
CGDataProviderRef SkCreateDataProviderFromStream(SkStream*);
|
||||
CGDataProviderRef SkCreateDataProviderFromStream(SkData*);
|
||||
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// This is used by CGDataProviderCreateWithData
|
||||
|
||||
static void unref_data_proc(void* info, const void* addr, size_t size) {
|
||||
static void unref_proc(void* info, const void* addr, size_t size) {
|
||||
SkASSERT(info);
|
||||
((SkRefCnt*)info)->unref();
|
||||
}
|
||||
@ -43,7 +43,7 @@ CGDataProviderRef SkCreateDataProviderFromStream(SkStream* stream) {
|
||||
if (addr) {
|
||||
// special-case when the stream is just a block of ram
|
||||
return CGDataProviderCreateWithData(stream, addr, stream->getLength(),
|
||||
unref_data_proc);
|
||||
unref_proc);
|
||||
}
|
||||
|
||||
CGDataProviderSequentialCallbacks rec;
|
||||
@ -55,3 +55,14 @@ CGDataProviderRef SkCreateDataProviderFromStream(SkStream* stream) {
|
||||
rec.releaseInfo = release_info_proc;
|
||||
return CGDataProviderCreateSequential(stream, &rec);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SkData.h"
|
||||
|
||||
CGDataProviderRef SkCreateDataProviderFromStream(SkData* data) {
|
||||
data->ref();
|
||||
return CGDataProviderCreateWithData(data, data->data(), data->size(),
|
||||
unref_proc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user