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

Unified Diff: gm/textblobrandomfont.cpp

Issue 1974783002: Revert of Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
Index: gm/textblobrandomfont.cpp
diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp
index 51dbfceab3331c578c82cbf04e12272eb5163304..267fe7a320c79e77d2b98434698d0cc4c44a066b 100644
--- a/gm/textblobrandomfont.cpp
+++ b/gm/textblobrandomfont.cpp
@@ -39,12 +39,13 @@
paint.setLCDRenderText(true);
// Setup our random scaler context
- sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface("sans-serif",
- SkTypeface::kBold));
+ SkAutoTUnref<SkTypeface> orig(sk_tool_utils::create_portable_typeface("sans-serif",
+ SkTypeface::kBold));
if (nullptr == orig) {
- orig = SkTypeface::MakeDefault();
+ orig.reset(SkTypeface::RefDefault());
}
- paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false));
+ SkAutoTUnref<SkTypeface> random(new SkRandomTypeface(orig, paint, false));
+ paint.setTypeface(random);
SkRect bounds;
paint.measureText(text, strlen(text), &bounds);
@@ -65,14 +66,16 @@
sk_tool_utils::add_to_text_blob(&builder, bigtext2, paint, 0, offset);
// color emoji
- sk_sp<SkTypeface> origEmoji = sk_tool_utils::emoji_typeface();
+ SkAutoTUnref<SkTypeface> origEmoji;
+ sk_tool_utils::emoji_typeface(&origEmoji);
const char* osName = sk_tool_utils::platform_os_name();
// The mac emoji string will break us
if (origEmoji && (!strcmp(osName, "Android") || !strcmp(osName, "Ubuntu"))) {
const char* emojiText = sk_tool_utils::emoji_sample_text();
paint.measureText(emojiText, strlen(emojiText), &bounds);
offset += bounds.height();
- paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false));
+ SkAutoTUnref<SkTypeface> randomEmoji(new SkRandomTypeface(orig, paint, false));
+ paint.setTypeface(randomEmoji);
sk_tool_utils::add_to_text_blob(&builder, emojiText, paint, 0, offset);
}
« no previous file with comments | « gm/textblobmixedsizes.cpp ('k') | gm/typeface.cpp » ('j') | src/ports/SkFontMgr_android.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698