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

Unified Diff: src/utils/SkWhitelistTypefaces.cpp

Issue 2339273002: SkFontData to use smart pointers. (Closed)
Patch Set: Add trivial bodies to the trivial implementations. Created 4 years, 3 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
« no previous file with comments | « src/ports/SkFontMgr_win_dw.cpp ('k') | src/utils/mac/SkCreateCGImageRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkWhitelistTypefaces.cpp
diff --git a/src/utils/SkWhitelistTypefaces.cpp b/src/utils/SkWhitelistTypefaces.cpp
index 139e697ca08f4dd0eb540329ab446829dd3cbe64..007def6d8be7f55836db5c581d6e5215a6ee5902 100644
--- a/src/utils/SkWhitelistTypefaces.cpp
+++ b/src/utils/SkWhitelistTypefaces.cpp
@@ -63,7 +63,7 @@ static int whitelist_name_index(const SkTypeface* tf) {
}
static uint32_t compute_checksum(const SkTypeface* tf) {
- SkFontData* fontData = tf->createFontData();
+ std::unique_ptr<SkFontData> fontData = tf->makeFontData();
if (!fontData) {
return 0;
}
@@ -118,7 +118,7 @@ static void serialize_full(const SkTypeface* tf, SkWStream* wstream) {
// Embed font data if it's a local font.
if (isLocal && !desc.hasFontData()) {
- desc.setFontData(tf->createFontData());
+ desc.setFontData(tf->makeFontData());
}
desc.serialize(wstream);
}
@@ -190,9 +190,9 @@ sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* stream) {
return nullptr;
}
- SkFontData* data = desc.detachFontData();
+ std::unique_ptr<SkFontData> data = desc.detachFontData();
if (data) {
- sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFontData(data));
+ sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFontData(std::move(data)));
if (typeface) {
return typeface;
}
« no previous file with comments | « src/ports/SkFontMgr_win_dw.cpp ('k') | src/utils/mac/SkCreateCGImageRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698