Add API for SkTextBlob serialization into caller's memory.
R=reed@google.com
Change-Id: Iaeb67504aabf0dc036e81fa23c1a3c949b72b2b9
Reviewed-on: https://skia-review.googlesource.com/114262
Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h
index 89c6697..59151d3 100644
--- a/include/core/SkTextBlob.h
+++ b/include/core/SkTextBlob.h
@@ -67,6 +67,12 @@
sk_sp<SkData> serialize(SkTypefaceCatalogerProc, void* ctx) const;
/**
+ * Similar to serialize above, but writes directly into |memory|. Returns bytes written or 0u
+ * if serialization failed due to insufficient size.
+ */
+ size_t serialize(const SkSerialProcs& procs, void* memory, size_t memory_size) const;
+
+ /**
* Re-create a text blob previously serialized. Since the serialized form records the uniqueIDs
* of its typefaces, deserialization requires that the caller provide the corresponding
* SkTypefaces for those IDs.