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

Unified Diff: gm/colortype.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments. Created 4 years, 8 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/colortype.cpp
diff --git a/gm/colortype.cpp b/gm/colortype.cpp
index c9314de2a456479eecd88b92fcd3cec6c41ac9e1..dd0e7b8699accf84666ff7cfd7c192ff02dd4d9e 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);
+ auto orig = sk_tool_utils::create_portable_typeface("serif", SkTypeface::kBold);
f(malita) 2016/05/02 13:46:35 Nit: Chrome disallows auto for smart ptrs, and I t
bungeman-skia 2016/05/02 20:24:54 These were all in the CL I started this with... wi
reed1 2016/05/03 13:45:00 I didn't know that. I'd like to be caught up in th
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') | gm/colortypexfermode.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698