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

Unified Diff: gm/gammatext.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/gammatext.cpp
diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp
index c7d4309f970de134b2839250aa8cc902cc9bcfa6..bc5feb3375b512dce9405098f7591b9d0324debb 100644
--- a/gm/gammatext.cpp
+++ b/gm/gammatext.cpp
@@ -19,8 +19,12 @@
}
static bool setFont(SkPaint* paint, const char name[]) {
- paint->setTypeface(SkTypeface::MakeFromName(name, SkTypeface::kNormal));
- return SkToBool(paint->getTypeface());
+ SkTypeface* tf = SkTypeface::CreateFromName(name, SkTypeface::kNormal);
+ if (tf) {
+ paint->setTypeface(tf)->unref();
+ return true;
+ }
+ return false;
}
/**
@@ -104,7 +108,8 @@
}
static void set_face(SkPaint* paint) {
- paint->setTypeface(SkTypeface::MakeFromName("serif", SkTypeface::kItalic));
+ SkTypeface* face = SkTypeface::CreateFromName("serif", SkTypeface::kItalic);
+ SkSafeUnref(paint->setTypeface(face));
}
static void draw_pair(SkCanvas* canvas, SkPaint* paint, const sk_sp<SkShader>& shader) {

Powered by Google App Engine
This is Rietveld 408576698