aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/ports
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-09-25 20:00:31 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-25 20:00:41 +0000
commitf40ae1a4b5365620463bd63b5140bd3fc78894a1 (patch)
tree3070160f98d80ea9e2ab53eb8b06035d70582701 /include/ports
parenta3ab53b93a40185d7f29409264f91b835ae8929e (diff)
Revert "migrate to sk_sp for SkFontMgr API"
This reverts commit 4bf296be2821d2bdd0afabae9fdfe18e7e9b59cb. Reason for revert: need guard for flutter Original change's description: > migrate to sk_sp for SkFontMgr API > > Bug: skia: > Change-Id: I1bf2a13537f67938cdc9956080065d10ea0bd1d8 > Reviewed-on: https://skia-review.googlesource.com/48740 > Commit-Queue: Ben Wagner <bungeman@google.com> > Reviewed-by: Ben Wagner <bungeman@google.com> TBR=bungeman@google.com,reed@google.com Change-Id: Ib0b2d00fcbcdb6131444f94d1046df6dae24f551 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/50940 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/ports')
-rw-r--r--include/ports/SkFontMgr.h59
-rw-r--r--include/ports/SkFontMgr_indirect.h9
2 files changed, 17 insertions, 51 deletions
diff --git a/include/ports/SkFontMgr.h b/include/ports/SkFontMgr.h
index 08e406a97d..b13e113a2e 100644
--- a/include/ports/SkFontMgr.h
+++ b/include/ports/SkFontMgr.h
@@ -95,28 +95,26 @@ public:
* or NULL if the data is not recognized. The caller must call unref() on
* the returned object if it is not null.
*/
- sk_sp<SkTypeface> makeFromData(sk_sp<SkData>, int ttcIndex = 0) const;
+ SkTypeface* createFromData(SkData*, int ttcIndex = 0) const;
/**
* Create a typeface for the specified stream and TTC index
* (pass 0 for none) or NULL if the stream is not recognized. The caller
* must call unref() on the returned object if it is not null.
*/
- sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, int ttcIndex = 0) const;
+ SkTypeface* createFromStream(SkStreamAsset*, int ttcIndex = 0) const;
-#ifdef SK_SUPPORT_LEGACY_FONTMGR_API
+ // deprecated, use SkFontArguments instead.
using FontParameters = SkFontArguments;
-#endif
-
/* Experimental, API subject to change. */
- sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, const SkFontArguments&) const;
+ SkTypeface* createFromStream(SkStreamAsset*, const SkFontArguments&) const;
/**
* Create a typeface from the specified font data.
* Will return NULL if the typeface could not be created.
* The caller must call unref() on the returned object if it is not null.
*/
- sk_sp<SkTypeface> makeFromFontData(std::unique_ptr<SkFontData>) const;
+ SkTypeface* createFromFontData(std::unique_ptr<SkFontData>) const;
/**
* Create a typeface for the specified fileName and TTC index
@@ -124,18 +122,9 @@ public:
* not recognized. The caller must call unref() on the returned object
* if it is not null.
*/
- sk_sp<SkTypeface> makeFromFile(const char path[], int ttcIndex = 0) const;
-
- sk_sp<SkTypeface> legacyMakeTypeface(const char familyName[], SkFontStyle style) const;
-
-#ifdef SK_SUPPORT_LEGACY_FONTMGR_API
- SkTypeface* createFromData(SkData* data, int ttcIndex = 0) const;
- SkTypeface* createFromStream(SkStreamAsset* strm, int ttcIndex = 0) const;
- SkTypeface* createFromStream(SkStreamAsset* strm, const SkFontArguments& args) const;
- SkTypeface* createFromFontData(std::unique_ptr<SkFontData> fd) const;
SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const;
+
SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style) const;
-#endif
/** Return the default fontmgr. */
static sk_sp<SkFontMgr> RefDefault();
@@ -156,38 +145,14 @@ protected:
virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
const SkFontStyle&) const = 0;
-#ifdef SK_SUPPORT_LEGACY_FONTMGR_API
- // legacy virtuals
- virtual SkTypeface* onCreateFromData(SkData*, int) const { return nullptr; }
- virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int) const { return nullptr; }
+ virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const = 0;
+ virtual SkTypeface* onCreateFromStream(SkStreamAsset*, int ttcIndex) const = 0;
+ // TODO: make pure virtual.
virtual SkTypeface* onCreateFromStream(SkStreamAsset*, const SkFontArguments&) const;
virtual SkTypeface* onCreateFromFontData(std::unique_ptr<SkFontData>) const;
- virtual SkTypeface* onCreateFromFile(const char[], int) const { return nullptr; }
- virtual SkTypeface* onLegacyCreateTypeface(const char[], SkFontStyle) const {
- return nullptr;
- }
-
- // new virtuals express as calling legacy versions
-
- virtual sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData> data, int ttcIndex) const;
- virtual sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset> strm,
- int ttcIndex) const;
- virtual sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset> strm,
- const SkFontArguments& args) const;
- virtual sk_sp<SkTypeface> onMakeFromFontData(std::unique_ptr<SkFontData> fd) const;
- virtual sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const;
- virtual sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle style) const;
-#else
- virtual sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const = 0;
- virtual sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
- int ttcIndex) const = 0;
- virtual sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
- const SkFontArguments&) const;
- virtual sk_sp<SkTypeface> onMakeFromFontData(std::unique_ptr<SkFontData>) const;
- virtual sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const = 0;
-
- virtual sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const = 0;
-#endif
+ virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0;
+
+ virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const = 0;
private:
diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h
index 04e903ed14..251d74a83a 100644
--- a/include/ports/SkFontMgr_indirect.h
+++ b/include/ports/SkFontMgr_indirect.h
@@ -50,10 +50,11 @@ protected:
SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
const SkFontStyle& fontStyle) const override;
- sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int ttcIndex) const override;
- sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const override;
- sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override;
- sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const override;
+ SkTypeface* onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const override;
+ SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override;
+ SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override;
+
+ SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const override;
private:
SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const;