Index: src/ports/SkFontHost_FreeType.cpp |
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp |
index 84a74af469b35b81f01d9fb168982065f478092b..0c5c2d9b150f984b05e0d01e9ea180429b9b6b03 100644 |
--- a/src/ports/SkFontHost_FreeType.cpp |
+++ b/src/ports/SkFontHost_FreeType.cpp |
@@ -234,12 +234,11 @@ struct SkFaceRec { |
SkFaceRec* fNext; |
FT_Face fFace; |
FT_StreamRec fFTStream; |
- SkAutoTDelete<SkStreamAsset> fSkStream; |
+ std::unique_ptr<SkStreamAsset> fSkStream; |
uint32_t fRefCnt; |
uint32_t fFontID; |
- // assumes ownership of the stream, will delete when its done |
- SkFaceRec(SkStreamAsset* strm, uint32_t fontID); |
+ SkFaceRec(std::unique_ptr<SkStreamAsset> stream, uint32_t fontID); |
}; |
extern "C" { |
@@ -262,12 +261,12 @@ extern "C" { |
static void sk_ft_stream_close(FT_Stream) {} |
} |
-SkFaceRec::SkFaceRec(SkStreamAsset* stream, uint32_t fontID) |
- : fNext(nullptr), fSkStream(stream), fRefCnt(1), fFontID(fontID) |
+SkFaceRec::SkFaceRec(std::unique_ptr<SkStreamAsset> stream, uint32_t fontID) |
+ : fNext(nullptr), fSkStream(std::move(stream)), fRefCnt(1), fFontID(fontID) |
{ |
sk_bzero(&fFTStream, sizeof(fFTStream)); |
fFTStream.size = fSkStream->getLength(); |
- fFTStream.descriptor.pointer = fSkStream; |
+ fFTStream.descriptor.pointer = fSkStream.get(); |
fFTStream.read = sk_ft_stream_io; |
fFTStream.close = sk_ft_stream_close; |
} |
@@ -319,12 +318,11 @@ static FT_Face ref_ft_face(const SkTypeface* typeface) { |
rec = rec->fNext; |
} |
- SkAutoTDelete<SkFontData> data(typeface->createFontData()); |
+ std::unique_ptr<SkFontData> data = typeface->makeFontData(); |
if (nullptr == data || !data->hasStream()) { |
return nullptr; |
} |
- // this passes ownership of stream to the rec |
rec = new SkFaceRec(data->detachStream(), fontID); |
FT_Open_Args args; |