Revert "Revert "use serialprocs for typefaces""
This reverts commit 1a104bce20adc47a343fa910899ca6c4f261be40.
Change (from first version) is
- only signal error in readbuffer for corrupt stream, not default fonts
- change test to ensure a non-null typeface (i.e. MakeDefault())
Bug: skia:
Change-Id: I325445b56b0a402e1b89a2439df06e92314c793f
Reviewed-on: https://skia-review.googlesource.com/82687
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h
index a87c9a3..228747a 100644
--- a/include/core/SkTextBlob.h
+++ b/include/core/SkTextBlob.h
@@ -17,6 +17,9 @@
class SkReadBuffer;
class SkWriteBuffer;
+struct SkSerialProcs;
+struct SkDeserialProcs;
+
typedef void (*SkTypefaceCatalogerProc)(SkTypeface*, void* ctx);
typedef sk_sp<SkTypeface> (*SkTypefaceResolverProc)(uint32_t id, void* ctx);
@@ -71,6 +74,9 @@
static sk_sp<SkTextBlob> Deserialize(const void* data, size_t size,
SkTypefaceResolverProc, void* ctx);
+ sk_sp<SkData> serialize(const SkSerialProcs&) const;
+ static sk_sp<SkTextBlob> Deserialize(const void* data, size_t size, const SkDeserialProcs&);
+
private:
friend class SkNVRefCnt<SkTextBlob>;
class RunRecord;