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

Unified Diff: samplecode/SampleFontScalerTest.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: samplecode/SampleFontScalerTest.cpp
diff --git a/samplecode/SampleFontScalerTest.cpp b/samplecode/SampleFontScalerTest.cpp
index 72371ed8073004f8f10a38f8e0e4d6d0b8621098..ce3b81ee8a7e031c54666e8a0e7fdc5b2c5f84c1 100644
--- a/samplecode/SampleFontScalerTest.cpp
+++ b/samplecode/SampleFontScalerTest.cpp
@@ -36,14 +36,21 @@
static const int gFaceCount = SK_ARRAY_COUNT(gFaces);
class FontScalerTestView : public SampleView {
- sk_sp<SkTypeface> fFaces[gFaceCount];
+ SkTypeface* fFaces[gFaceCount];
public:
FontScalerTestView() {
for (int i = 0; i < gFaceCount; i++) {
- fFaces[i] = SkTypeface::MakeFromName(gFaces[i].fName, gFaces[i].fStyle);
+ fFaces[i] = SkTypeface::CreateFromName(gFaces[i].fName,
+ gFaces[i].fStyle);
}
// this->setBGColor(0xFFDDDDDD);
+ }
+
+ virtual ~FontScalerTestView() {
+ for (int i = 0; i < gFaceCount; i++) {
+ SkSafeUnref(fFaces[i]);
+ }
}
protected:
@@ -85,7 +92,7 @@
// paint.setSubpixelText(true);
paint.setAntiAlias(true);
paint.setLCDRenderText(true);
- paint.setTypeface(SkTypeface::MakeFromName("Times Roman", SkTypeface::kNormal));
+ SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromName("Times Roman", SkTypeface::kNormal)));
// const char* text = "abcdefghijklmnopqrstuvwxyz";
const char* text = "Hamburgefons ooo mmm";

Powered by Google App Engine
This is Rietveld 408576698