Index: src/core/SkData.cpp |
=================================================================== |
--- src/core/SkData.cpp (revision 9384) |
+++ src/core/SkData.cpp (working copy) |
@@ -97,6 +97,16 @@ |
return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, NULL); |
} |
+SkData* SkData::NewFromFD(int fd) { |
+ size_t size; |
+ void* addr = sk_fdmmap(fd, &size); |
+ if (NULL == addr) { |
+ return NULL; |
+ } |
+ |
+ return SkData::NewWithProc(addr, size, sk_mmap_releaseproc, NULL); |
+} |
+ |
// assumes context is a SkData |
static void sk_dataref_releaseproc(const void*, size_t, void* context) { |
SkData* src = reinterpret_cast<SkData*>(context); |