diff options
author | 2016-07-28 10:47:50 -0700 | |
---|---|---|
committer | 2016-07-28 10:47:50 -0700 | |
commit | a0605bf9d13f5758a6fa2fa366c4dc5341c2cf61 (patch) | |
tree | b97a154e5fc108baf33ee71baa3ee8c7ec20fdbf /include/core | |
parent | 0634317cbe50f5dd21e7e78da59cb2dba0edcae4 (diff) |
Add writeToMemory() API to SkColorSpace
New API mirrors the form of similar APIs in SkRegion,
SkMatrix, etc.
This also fixes a bug:
SkImageInfo appears in a object that Chrome stores in
discardable memory. So when sk_sp<SkColorSpace> was added
to SkImageInfo a leak was introduced. We'll use this new
method and deserialize to store the SkColorSpace in the
discardable object.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2192903002
Review-Url: https://codereview.chromium.org/2192903002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkColorSpace.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h index 2bf2ed0de6..9fc5ccde71 100644 --- a/include/core/SkColorSpace.h +++ b/include/core/SkColorSpace.h @@ -96,6 +96,12 @@ public: */ sk_sp<SkData> serialize() const; + /** + * If |memory| is nullptr, returns the size required to serialize. + * Otherwise, serializes into |memory| and returns the size. + */ + size_t writeToMemory(void* memory) const; + static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); protected: |