aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-21 11:53:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-21 19:38:15 +0000
commitaaa3056e46ed9004097dc784db94c3a97d070569 (patch)
tree64e4f3eb40168c83b95f5d36597ce312c3a1b3fa /include
parentc686ce39f06d556d55befd290e0eb82851c7d33b (diff)
switch away from std::function in public api
Bug: skia: Change-Id: I181382dc1f9d8671b814134c1a787185745b90a8 Reviewed-on: https://skia-review.googlesource.com/25643 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkTextBlob.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h
index a4d2dba9a0..2fe852c762 100644
--- a/include/core/SkTextBlob.h
+++ b/include/core/SkTextBlob.h
@@ -17,8 +17,13 @@
class SkReadBuffer;
class SkWriteBuffer;
+#ifdef SK_SUPPORT_LEGACY_TEXTBLOB_SERIAL_API
typedef std::function<void(SkTypeface*)> SkTypefaceCataloger;
typedef std::function<sk_sp<SkTypeface>(uint32_t)> SkTypefaceResolver;
+#endif
+
+typedef void (*SkTypefaceCatalogerProc)(SkTypeface*, void* ctx);
+typedef sk_sp<SkTypeface> (*SkTypefaceResolverProc)(uint32_t id, void* ctx);
/** \class SkTextBlob
@@ -65,14 +70,20 @@ public:
* During this process, each time a typeface is encountered, it is passed to the catalog,
* allowing the caller to what typeface IDs will need to be resolved in Deserialize().
*/
- sk_sp<SkData> serialize(const SkTypefaceCataloger&) const;
+ sk_sp<SkData> serialize(SkTypefaceCatalogerProc, void* ctx) 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.
*/
+ static sk_sp<SkTextBlob> Deserialize(const void* data, size_t size,
+ SkTypefaceResolverProc, void* ctx);
+
+#ifdef SK_SUPPORT_LEGACY_TEXTBLOB_SERIAL_API
+ sk_sp<SkData> serialize(const SkTypefaceCataloger&) const;
static sk_sp<SkTextBlob> Deserialize(const void* data, size_t size, const SkTypefaceResolver&);
+#endif
private:
friend class SkNVRefCnt<SkTextBlob>;