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

Unified Diff: gm/gammatext.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/fontscalerdistortable.cpp ('k') | gm/mixedtextblobs.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gammatext.cpp
diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp
index bc5feb3375b512dce9405098f7591b9d0324debb..c7d4309f970de134b2839250aa8cc902cc9bcfa6 100644
--- a/gm/gammatext.cpp
+++ b/gm/gammatext.cpp
@@ -19,12 +19,8 @@ static sk_sp<SkShader> make_heatGradient(const SkPoint pts[2]) {
}
static bool setFont(SkPaint* paint, const char name[]) {
- SkTypeface* tf = SkTypeface::CreateFromName(name, SkTypeface::kNormal);
- if (tf) {
- paint->setTypeface(tf)->unref();
- return true;
- }
- return false;
+ paint->setTypeface(SkTypeface::MakeFromName(name, SkTypeface::kNormal));
+ return SkToBool(paint->getTypeface());
}
/**
@@ -108,8 +104,7 @@ static sk_sp<SkShader> make_gradient(SkColor c) {
}
static void set_face(SkPaint* paint) {
- SkTypeface* face = SkTypeface::CreateFromName("serif", SkTypeface::kItalic);
- SkSafeUnref(paint->setTypeface(face));
+ paint->setTypeface(SkTypeface::MakeFromName("serif", SkTypeface::kItalic));
}
static void draw_pair(SkCanvas* canvas, SkPaint* paint, const sk_sp<SkShader>& shader) {
« no previous file with comments | « gm/fontscalerdistortable.cpp ('k') | gm/mixedtextblobs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698