Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Unified Diff: src/ports/SkFontMgr_android.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/svg/SkSVGDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_android.cpp
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 4aea047cdeee106cbffc401d4217fb638d8d0ad4..2e619af0fb4bcfb798b7a9a6c8e89145439de2be 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -364,14 +364,14 @@ protected:
return nullptr;
}
- static SkTypeface_AndroidSystem* find_family_style_character(
+ static sk_sp<SkTypeface_AndroidSystem> find_family_style_character(
const SkTDArray<NameToFamily>& fallbackNameToFamilyMap,
const SkFontStyle& style, bool elegant,
const SkString& langTag, SkUnichar character)
{
for (int i = 0; i < fallbackNameToFamilyMap.count(); ++i) {
SkFontStyleSet_Android* family = fallbackNameToFamilyMap[i].styleSet;
- SkAutoTUnref<SkTypeface_AndroidSystem> face(family->matchStyle(style));
+ sk_sp<SkTypeface_AndroidSystem> face(family->matchStyle(style));
if (!langTag.isEmpty() && !face->fLang.getTag().startsWith(langTag.c_str())) {
continue;
@@ -388,7 +388,7 @@ protected:
uint16_t glyphID;
paint.textToGlyphs(&character, sizeof(character), &glyphID);
if (glyphID != 0) {
- return face.release();
+ return face;
}
}
return nullptr;
@@ -410,23 +410,23 @@ protected:
for (int bcp47Index = bcp47Count; bcp47Index --> 0;) {
SkLanguage lang(bcp47[bcp47Index]);
while (!lang.getTag().isEmpty()) {
- SkTypeface_AndroidSystem* matchingTypeface =
+ sk_sp<SkTypeface_AndroidSystem> matchingTypeface =
find_family_style_character(fFallbackNameToFamilyMap,
style, SkToBool(elegant),
lang.getTag(), character);
if (matchingTypeface) {
- return matchingTypeface;
+ return matchingTypeface.release();
}
lang = lang.getParent();
}
}
- SkTypeface_AndroidSystem* matchingTypeface =
+ sk_sp<SkTypeface_AndroidSystem> matchingTypeface =
find_family_style_character(fFallbackNameToFamilyMap,
style, SkToBool(elegant),
SkString(), character);
if (matchingTypeface) {
- return matchingTypeface;
+ return matchingTypeface.release();
}
}
return nullptr;
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/svg/SkSVGDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698