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

Unified Diff: gm/colortypexfermode.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/colortypexfermode.cpp
diff --git a/gm/colortypexfermode.cpp b/gm/colortypexfermode.cpp
index 058b92d223f01983b5967a79a1f0715f5da4a6f4..36db2aa3f5f861bbc6b0216540357248ca6022f4 100644
--- a/gm/colortypexfermode.cpp
+++ b/gm/colortypexfermode.cpp
@@ -19,7 +19,13 @@
public:
const static int W = 64;
const static int H = 64;
- ColorTypeXfermodeGM() {}
+ ColorTypeXfermodeGM()
+ : fColorType(nullptr) {
+ }
+
+ virtual ~ColorTypeXfermodeGM() {
+ SkSafeUnref(fColorType);
+ }
protected:
void onOnceBeforeDraw() override {
@@ -34,11 +40,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>(orig, paint);
+ fColorType = new SkGTypeface(orig, paint);
+ orig->unref();
fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType,
kOpaque_SkAlphaType), gData, 4);
@@ -142,8 +149,8 @@
}
private:
- SkBitmap fBG;
- sk_sp<SkTypeface> fColorType;
+ SkBitmap fBG;
+ SkTypeface* fColorType;
typedef GM INHERITED;
};
« no previous file with comments | « gm/colortype.cpp ('k') | gm/dftext.cpp » ('j') | src/ports/SkFontMgr_android.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698