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

Unified Diff: src/utils/SkWhitelistTypefaces.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. 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
« no previous file with comments | « src/utils/SkLua.cpp ('k') | tests/FontHostStreamTest.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 66d32188a023e69bfa9fc27fd8c47f933ad5eda6..33681787694a92a8f0ce3c24efb625e77140642e 100644
--- a/src/utils/SkWhitelistTypefaces.cpp
+++ b/src/utils/SkWhitelistTypefaces.cpp
@@ -18,7 +18,7 @@
#define WHITELIST_DEBUG 0
extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* );
-extern SkTypeface* WhitelistDeserializeTypeface(SkStream* );
+sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* );
extern bool CheckChecksums();
extern bool GenerateChecksums();
@@ -32,8 +32,8 @@ static bool font_name_is_local(const char* fontName, SkTypeface::Style style) {
if (!strcmp(fontName, "DejaVu Sans")) {
return true;
}
- SkTypeface* defaultFace = SkTypeface::CreateFromName(nullptr, style);
- SkTypeface* foundFace = SkTypeface::CreateFromName(fontName, style);
+ sk_sp<SkTypeface> defaultFace(SkTypeface::MakeFromName(nullptr, style));
+ sk_sp<SkTypeface> foundFace(SkTypeface::MakeFromName(fontName, style));
return defaultFace != foundFace;
}
@@ -183,7 +183,7 @@ void WhitelistSerializeTypeface(const SkTypeface* tf, SkWStream* wstream) {
serialize_sub(fontName, tf->style(), wstream);
}
-SkTypeface* WhitelistDeserializeTypeface(SkStream* stream) {
+sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* stream) {
SkFontDescriptor desc;
if (!SkFontDescriptor::Deserialize(stream, &desc)) {
return nullptr;
@@ -191,7 +191,7 @@ SkTypeface* WhitelistDeserializeTypeface(SkStream* stream) {
SkFontData* data = desc.detachFontData();
if (data) {
- SkTypeface* typeface = SkTypeface::CreateFromFontData(data);
+ sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFontData(data));
if (typeface) {
return typeface;
}
@@ -200,14 +200,14 @@ SkTypeface* WhitelistDeserializeTypeface(SkStream* stream) {
if (!strncmp(SUBNAME_PREFIX, familyName, sizeof(SUBNAME_PREFIX) - 1)) {
familyName += sizeof(SUBNAME_PREFIX) - 1;
}
- return SkTypeface::CreateFromName(familyName, desc.getStyle());
+ return SkTypeface::MakeFromName(familyName, desc.getStyle());
}
bool CheckChecksums() {
for (int i = 0; i < whitelistCount; ++i) {
const char* fontName = whitelist[i].fFontName;
- SkTypeface* tf = SkTypeface::CreateFromName(fontName, SkTypeface::kNormal);
- uint32_t checksum = compute_checksum(tf);
+ sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkTypeface::kNormal));
+ uint32_t checksum = compute_checksum(tf.get());
if (whitelist[i].fChecksum != checksum) {
return false;
}
@@ -261,8 +261,8 @@ bool GenerateChecksums() {
sk_fwrite(line.c_str(), line.size(), file);
for (int i = 0; i < whitelistCount; ++i) {
const char* fontName = whitelist[i].fFontName;
- SkTypeface* tf = SkTypeface::CreateFromName(fontName, SkTypeface::kNormal);
- uint32_t checksum = compute_checksum(tf);
+ sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkTypeface::kNormal));
+ uint32_t checksum = compute_checksum(tf.get());
line.printf(checksumEntry, fontName, checksum);
sk_fwrite(line.c_str(), line.size(), file);
}
« no previous file with comments | « src/utils/SkLua.cpp ('k') | tests/FontHostStreamTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698