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

Unified Diff: src/core/SkPixmap.cpp

Issue 1662353002: Add SkAutoPixmapStorage::detachPixelsAsData() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: detachPixelsAsData Created 4 years, 10 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/SkPixmap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « include/core/SkPixmap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698