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

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

Powered by Google App Engine
This is Rietveld 408576698