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

Unified Diff: gm/textblobrandomfont.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 | « gm/textblobmixedsizes.cpp ('k') | gm/typeface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/textblobrandomfont.cpp
diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp
index 267fe7a320c79e77d2b98434698d0cc4c44a066b..51dbfceab3331c578c82cbf04e12272eb5163304 100644
--- a/gm/textblobrandomfont.cpp
+++ b/gm/textblobrandomfont.cpp
@@ -39,13 +39,12 @@ protected:
paint.setLCDRenderText(true);
// Setup our random scaler context
- SkAutoTUnref<SkTypeface> orig(sk_tool_utils::create_portable_typeface("sans-serif",
- SkTypeface::kBold));
+ sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface("sans-serif",
+ SkTypeface::kBold));
if (nullptr == orig) {
- orig.reset(SkTypeface::RefDefault());
+ orig = SkTypeface::MakeDefault();
}
- SkAutoTUnref<SkTypeface> random(new SkRandomTypeface(orig, paint, false));
- paint.setTypeface(random);
+ paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false));
SkRect bounds;
paint.measureText(text, strlen(text), &bounds);
@@ -66,16 +65,14 @@ protected:
sk_tool_utils::add_to_text_blob(&builder, bigtext2, paint, 0, offset);
// color emoji
- SkAutoTUnref<SkTypeface> origEmoji;
- sk_tool_utils::emoji_typeface(&origEmoji);
+ sk_sp<SkTypeface> origEmoji = sk_tool_utils::emoji_typeface();
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();
- SkAutoTUnref<SkTypeface> randomEmoji(new SkRandomTypeface(orig, paint, false));
- paint.setTypeface(randomEmoji);
+ paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false));
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698