diff options
author | fmalita <fmalita@chromium.org> | 2016-02-04 13:09:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-04 13:09:59 -0800 |
commit | 3a94c6c62c3c40866684b4c4772551fa95be097d (patch) | |
tree | 8e4f0068214db990e71517f1ffebecaba507140c /include/core/SkPixmap.h | |
parent | 92098e691f10a010e7421125ba4d44c02506bb55 (diff) |
Add SkAutoPixmapStorage::detachPixelsAsData()
Allows passing pixels ownership to clients.
BUG=skia:4896
R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1662353002
Review URL: https://codereview.chromium.org/1662353002
Diffstat (limited to 'include/core/SkPixmap.h')
-rw-r--r-- | include/core/SkPixmap.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h index da97025cab..523c40f294 100644 --- a/include/core/SkPixmap.h +++ b/include/core/SkPixmap.h @@ -13,6 +13,7 @@ #include "SkImageInfo.h" class SkColorTable; +class SkData; struct SkMask; /** @@ -184,6 +185,12 @@ public: */ void alloc(const SkImageInfo&); + /** + * Returns an SkData object wrapping the allocated pixels memory, and resets the pixmap. + * If the storage hasn't been allocated, the result is NULL. + */ + const SkData* SK_WARN_UNUSED_RESULT detachPixelsAsData(); + // We wrap these so we can clear our internal storage void reset() { @@ -208,7 +215,7 @@ private: void freeStorage() { sk_free(fStorage); - fStorage = NULL; + fStorage = nullptr; } typedef SkPixmap INHERITED; |