aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/fonts
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-09-25 13:21:45 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-25 19:45:09 +0000
commit4bf296be2821d2bdd0afabae9fdfe18e7e9b59cb (patch)
treeada1341d6943d4e8b91b5d9da331ac82873c3677 /src/fonts
parentd6c04d9a05c1b4066c09083a673d7d3cf61a3aa6 (diff)
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>
Diffstat (limited to 'src/fonts')
-rw-r--r--src/fonts/SkFontMgr_indirect.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp
index c04c2b851d..98889b6abd 100644
--- a/src/fonts/SkFontMgr_indirect.cpp
+++ b/src/fonts/SkFontMgr_indirect.cpp
@@ -111,7 +111,7 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i
if (dataTypeface.get() != nullptr) {
std::unique_ptr<SkStreamAsset> stream(dataTypeface->openStream(nullptr));
if (stream.get() != nullptr) {
- return fImpl->createFromStream(stream.release(), dataTypefaceIndex);
+ return fImpl->makeFromStream(std::move(stream), dataTypefaceIndex).release();
}
}
@@ -121,7 +121,7 @@ SkTypeface* SkFontMgr_Indirect::createTypefaceFromFontId(const SkFontIdentity& i
return nullptr;
}
- sk_sp<SkTypeface> typeface(fImpl->createFromStream(stream.release(), id.fTtcIndex));
+ sk_sp<SkTypeface> typeface(fImpl->makeFromStream(std::move(stream), id.fTtcIndex));
if (typeface.get() == nullptr) {
return nullptr;
}
@@ -158,20 +158,21 @@ SkTypeface* SkFontMgr_Indirect::onMatchFaceStyle(const SkTypeface* familyMember,
return this->matchFamilyStyle(familyName.c_str(), fontStyle);
}
-SkTypeface* SkFontMgr_Indirect::onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const {
- return fImpl->createFromStream(stream, ttcIndex);
+sk_sp<SkTypeface> SkFontMgr_Indirect::onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset> stream,
+ int ttcIndex) const {
+ return fImpl->makeFromStream(std::move(stream), ttcIndex);
}
-SkTypeface* SkFontMgr_Indirect::onCreateFromFile(const char path[], int ttcIndex) const {
- return fImpl->createFromFile(path, ttcIndex);
+sk_sp<SkTypeface> SkFontMgr_Indirect::onMakeFromFile(const char path[], int ttcIndex) const {
+ return fImpl->makeFromFile(path, ttcIndex);
}
-SkTypeface* SkFontMgr_Indirect::onCreateFromData(SkData* data, int ttcIndex) const {
- return fImpl->createFromData(data, ttcIndex);
+sk_sp<SkTypeface> SkFontMgr_Indirect::onMakeFromData(sk_sp<SkData> data, int ttcIndex) const {
+ return fImpl->makeFromData(std::move(data), ttcIndex);
}
-SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
- SkFontStyle style) const {
+sk_sp<SkTypeface> SkFontMgr_Indirect::onLegacyMakeTypeface(const char familyName[],
+ SkFontStyle style) const {
sk_sp<SkTypeface> face(this->matchFamilyStyle(familyName, style));
if (nullptr == face.get()) {
@@ -183,5 +184,5 @@ SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
face.reset(this->createTypefaceFromFontId(fontId));
}
- return face.release();
+ return face;
}