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

Unified Diff: tools/sk_tool_utils.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: tools/sk_tool_utils.cpp
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 7343ce4744e661bd5a08600fb58df0d202c6d253..f46ebb6e60cda97dc91272c7ca0b2836fbea18e8 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
@@ -75,14 +75,17 @@
return "";
}
-sk_sp<SkTypeface> emoji_typeface() {
+void emoji_typeface(SkAutoTUnref<SkTypeface>* tf) {
if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
- return MakeResourceAsTypeface("/fonts/Funkster.ttf");
+ tf->reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
+ return;
}
if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
- return SkTypeface::MakeFromName("Apple Color Emoji", SkTypeface::kNormal);
- }
- return nullptr;
+ tf->reset(SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNormal));
+ return;
+ }
+ tf->reset(nullptr);
+ return;
}
const char* emoji_sample_text() {
@@ -156,12 +159,13 @@
return SkPixel16ToColor(color16);
}
-sk_sp<SkTypeface> create_portable_typeface(const char* name, SkTypeface::Style style) {
+SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style style) {
return create_font(name, style);
}
void set_portable_typeface(SkPaint* paint, const char* name, SkTypeface::Style style) {
- paint->setTypeface(create_font(name, style));
+ SkTypeface* face = create_font(name, style);
+ SkSafeUnref(paint->setTypeface(face));
}
void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y,

Powered by Google App Engine
This is Rietveld 408576698