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

Unified Diff: src/core/SkData.cpp

Issue 15941025: Add SkData::NewFromFD. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Remove an indentation level. Created 7 years, 7 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 | « include/core/SkTemplates.h ('k') | src/ports/SkDebug_brew.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « include/core/SkTemplates.h ('k') | src/ports/SkDebug_brew.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698