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

Unified Diff: gm/colortype.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/coloremoji.cpp ('k') | gm/colortypexfermode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/colortype.cpp
diff --git a/gm/colortype.cpp b/gm/colortype.cpp
index c9314de2a456479eecd88b92fcd3cec6c41ac9e1..68dfeee535e28fd84dfecb8fa34aac0f3c397dcf 100644
--- a/gm/colortype.cpp
+++ b/gm/colortype.cpp
@@ -12,13 +12,7 @@
class ColorTypeGM : public skiagm::GM {
public:
- ColorTypeGM()
- : fColorType(nullptr) {
- }
-
- virtual ~ColorTypeGM() {
- SkSafeUnref(fColorType);
- }
+ ColorTypeGM() {}
protected:
void onOnceBeforeDraw() override {
@@ -33,12 +27,11 @@ protected:
paint.setShader(SkGradientShader::MakeSweep(0, 0, colors, nullptr, SK_ARRAY_COUNT(colors),
0, &local));
- SkTypeface* orig = sk_tool_utils::create_portable_typeface("serif", SkTypeface::kBold);
+ sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface("serif", SkTypeface::kBold));
if (nullptr == orig) {
- orig = SkTypeface::RefDefault();
+ orig = SkTypeface::MakeDefault();
}
- fColorType = new SkGTypeface(orig, paint);
- orig->unref();
+ fColorType = sk_make_sp<SkGTypeface>(std::move(orig), paint);
}
SkString onShortName() override {
@@ -62,7 +55,7 @@ protected:
}
private:
- SkTypeface* fColorType;
+ sk_sp<SkTypeface> fColorType;
typedef skiagm::GM INHERITED;
};
« no previous file with comments | « gm/coloremoji.cpp ('k') | gm/colortypexfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698