Index: src/core/SkPixmap.cpp |
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp |
index 943287bad30a22373b1954342c8f02ad395d2cc5..e2d4d30ebff3a07aa07368262ba7b31f1427ca26 100644 |
--- a/src/core/SkPixmap.cpp |
+++ b/src/core/SkPixmap.cpp |
@@ -7,6 +7,7 @@ |
#include "SkColorPriv.h" |
#include "SkConfig8888.h" |
+#include "SkData.h" |
#include "SkMask.h" |
#include "SkPixmap.h" |
#include "SkUtils.h" |
@@ -272,3 +273,15 @@ void SkAutoPixmapStorage::alloc(const SkImageInfo& info) { |
sk_throw(); |
} |
} |
+ |
+const SkData* SkAutoPixmapStorage::detachPixelsAsData() { |
+ if (!fStorage) { |
+ return nullptr; |
+ } |
+ |
+ const SkData* data = SkData::NewFromMalloc(fStorage, this->getSafeSize()); |
+ fStorage = nullptr; |
+ this->INHERITED::reset(); |
+ |
+ return data; |
+} |