removed dead code behind legacy fontmgr api flag
Bug: skia: Change-Id: I7766b10947df384b0e94a32642d5b4321f2e53bd Reviewed-on: https://skia-review.googlesource.com/58241 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
a317a99807
commit
4815db5938
@ -104,10 +104,6 @@ public:
|
||||
*/
|
||||
sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, int ttcIndex = 0) const;
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_FONTMGR_API
|
||||
using FontParameters = SkFontArguments;
|
||||
#endif
|
||||
|
||||
/* Experimental, API subject to change. */
|
||||
sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, const SkFontArguments&) const;
|
||||
|
||||
@ -128,15 +124,6 @@ public:
|
||||
|
||||
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,28 +143,6 @@ 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* 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;
|
||||
@ -187,7 +152,6 @@ protected:
|
||||
virtual sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const = 0;
|
||||
|
||||
virtual sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const = 0;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
@ -164,56 +164,6 @@ sk_sp<SkTypeface> SkFontMgr::legacyMakeTypeface(const char familyName[], SkFontS
|
||||
return this->onLegacyMakeTypeface(familyName, style);
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_FONTMGR_API
|
||||
SkTypeface* SkFontMgr::createFromData(SkData* data, int ttcIndex) const {
|
||||
return this->makeFromData(sk_ref_sp(data), ttcIndex).release();
|
||||
}
|
||||
SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* strm, int ttcIndex) const {
|
||||
return this->makeFromStream(std::unique_ptr<SkStreamAsset>(strm), ttcIndex).release();
|
||||
}
|
||||
SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* strm, const SkFontArguments& args) const {
|
||||
return this->makeFromStream(std::unique_ptr<SkStreamAsset>(strm), args).release();
|
||||
}
|
||||
SkTypeface* SkFontMgr::createFromFontData(std::unique_ptr<SkFontData> fd) const {
|
||||
return this->makeFromFontData(std::move(fd)).release();
|
||||
}
|
||||
SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
|
||||
return this->makeFromFile(path, ttcIndex).release();
|
||||
}
|
||||
SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const {
|
||||
return this->legacyMakeTypeface(familyName, style).release();
|
||||
}
|
||||
|
||||
// These implementations are temporary until they can be made pure virtual.
|
||||
SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const SkFontArguments& args) const {
|
||||
return this->makeFromStream(std::unique_ptr<SkStreamAsset>(stream),
|
||||
args.getCollectionIndex()).release();
|
||||
}
|
||||
SkTypeface* SkFontMgr::onCreateFromFontData(std::unique_ptr<SkFontData> data) const {
|
||||
return this->makeFromStream(data->detachStream(), data->getIndex()).release();
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> SkFontMgr::onMakeFromData(sk_sp<SkData> data, int ttcIndex) const {
|
||||
return sk_sp<SkTypeface>(this->onCreateFromData(data.get(), ttcIndex));
|
||||
}
|
||||
sk_sp<SkTypeface> SkFontMgr::onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset> strm,
|
||||
int ttcIndex) const {
|
||||
return sk_sp<SkTypeface>(this->onCreateFromStream(strm.release(), ttcIndex));
|
||||
}
|
||||
sk_sp<SkTypeface> SkFontMgr::onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset> strm,
|
||||
const SkFontArguments& args) const {
|
||||
return sk_sp<SkTypeface>(onCreateFromStream(strm.release(), args));
|
||||
}
|
||||
sk_sp<SkTypeface> SkFontMgr::onMakeFromFontData(std::unique_ptr<SkFontData> fd) const {
|
||||
return sk_sp<SkTypeface>(this->onCreateFromFontData(std::move(fd)));
|
||||
}
|
||||
sk_sp<SkTypeface> SkFontMgr::onMakeFromFile(const char path[], int ttcIndex) const {
|
||||
return sk_sp<SkTypeface>(this->onCreateFromFile(path, ttcIndex));
|
||||
}
|
||||
sk_sp<SkTypeface> SkFontMgr::onLegacyMakeTypeface(const char familyName[], SkFontStyle style) const {
|
||||
return sk_sp<SkTypeface>(this->onLegacyCreateTypeface(familyName, style));
|
||||
}
|
||||
#else
|
||||
sk_sp<SkTypeface> SkFontMgr::onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset> stream,
|
||||
const SkFontArguments& args) const {
|
||||
return this->makeFromStream(std::move(stream), args.getCollectionIndex());
|
||||
@ -221,7 +171,6 @@ sk_sp<SkTypeface> SkFontMgr::onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>
|
||||
sk_sp<SkTypeface> SkFontMgr::onMakeFromFontData(std::unique_ptr<SkFontData> data) const {
|
||||
return this->makeFromStream(data->detachStream(), data->getIndex());
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<SkFontMgr> SkFontMgr::RefDefault() {
|
||||
static SkOnce once;
|
||||
|
Loading…
Reference in New Issue
Block a user