Index: tests/FontHostStreamTest.cpp |
diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp |
index 0b436552a3c9a232bea50626ea26cb21edb87989..ec32d9f031ed83861b11801e9b8ebb4647d6adea 100644 |
--- a/tests/FontHostStreamTest.cpp |
+++ b/tests/FontHostStreamTest.cpp |
@@ -69,9 +69,7 @@ DEF_TEST(FontHostStream, reporter) { |
paint.setColor(SK_ColorGRAY); |
paint.setTextSize(SkIntToScalar(30)); |
- SkTypeface* fTypeface = SkTypeface::CreateFromName("Georgia", |
- SkTypeface::kNormal); |
- SkSafeUnref(paint.setTypeface(fTypeface)); |
+ paint.setTypeface(SkTypeface::MakeFromName("Georgia", SkTypeface::kNormal)); |
SkIRect origRect = SkIRect::MakeWH(64, 64); |
SkBitmap origBitmap; |
@@ -89,23 +87,18 @@ DEF_TEST(FontHostStream, reporter) { |
drawBG(&origCanvas); |
origCanvas.drawText("A", 1, point.fX, point.fY, paint); |
- SkTypeface* origTypeface = paint.getTypeface(); |
- SkAutoTUnref<SkTypeface> aur; |
- if (nullptr == origTypeface) { |
- aur.reset(SkTypeface::RefDefault()); |
- origTypeface = aur.get(); |
- } |
- |
+ sk_sp<SkTypeface> typeface(SkToBool(paint.getTypeface()) ? sk_ref_sp(paint.getTypeface()) |
+ : SkTypeface::MakeDefault()); |
int ttcIndex; |
- SkAutoTDelete<SkStreamAsset> fontData(origTypeface->openStream(&ttcIndex)); |
- SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData.release()); |
+ SkAutoTDelete<SkStreamAsset> fontData(typeface->openStream(&ttcIndex)); |
+ sk_sp<SkTypeface> streamTypeface(SkTypeface::MakeFromStream(fontData.release())); |
SkFontDescriptor desc; |
bool isLocalStream = false; |
streamTypeface->getFontDescriptor(&desc, &isLocalStream); |
REPORTER_ASSERT(reporter, isLocalStream); |
- SkSafeUnref(paint.setTypeface(streamTypeface)); |
+ paint.setTypeface(streamTypeface); |
drawBG(&streamCanvas); |
streamCanvas.drawPosText("A", 1, &point, paint); |