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

Unified Diff: src/utils/SkWhitelistTypefaces.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: src/utils/SkWhitelistTypefaces.cpp
diff --git a/src/utils/SkWhitelistTypefaces.cpp b/src/utils/SkWhitelistTypefaces.cpp
index 33681787694a92a8f0ce3c24efb625e77140642e..66d32188a023e69bfa9fc27fd8c47f933ad5eda6 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* );
-sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* );
+extern SkTypeface* WhitelistDeserializeTypeface(SkStream* );
extern bool CheckChecksums();
extern bool GenerateChecksums();
@@ -32,8 +32,8 @@
if (!strcmp(fontName, "DejaVu Sans")) {
return true;
}
- sk_sp<SkTypeface> defaultFace(SkTypeface::MakeFromName(nullptr, style));
- sk_sp<SkTypeface> foundFace(SkTypeface::MakeFromName(fontName, style));
+ SkTypeface* defaultFace = SkTypeface::CreateFromName(nullptr, style);
+ SkTypeface* foundFace = SkTypeface::CreateFromName(fontName, style);
return defaultFace != foundFace;
}
@@ -183,7 +183,7 @@
serialize_sub(fontName, tf->style(), wstream);
}
-sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* stream) {
+SkTypeface* WhitelistDeserializeTypeface(SkStream* stream) {
SkFontDescriptor desc;
if (!SkFontDescriptor::Deserialize(stream, &desc)) {
return nullptr;
@@ -191,7 +191,7 @@
SkFontData* data = desc.detachFontData();
if (data) {
- sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFontData(data));
+ SkTypeface* typeface = SkTypeface::CreateFromFontData(data);
if (typeface) {
return typeface;
}
@@ -200,14 +200,14 @@
if (!strncmp(SUBNAME_PREFIX, familyName, sizeof(SUBNAME_PREFIX) - 1)) {
familyName += sizeof(SUBNAME_PREFIX) - 1;
}
- return SkTypeface::MakeFromName(familyName, desc.getStyle());
+ return SkTypeface::CreateFromName(familyName, desc.getStyle());
}
bool CheckChecksums() {
for (int i = 0; i < whitelistCount; ++i) {
const char* fontName = whitelist[i].fFontName;
- sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkTypeface::kNormal));
- uint32_t checksum = compute_checksum(tf.get());
+ SkTypeface* tf = SkTypeface::CreateFromName(fontName, SkTypeface::kNormal);
+ uint32_t checksum = compute_checksum(tf);
if (whitelist[i].fChecksum != checksum) {
return false;
}
@@ -261,8 +261,8 @@
sk_fwrite(line.c_str(), line.size(), file);
for (int i = 0; i < whitelistCount; ++i) {
const char* fontName = whitelist[i].fFontName;
- sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkTypeface::kNormal));
- uint32_t checksum = compute_checksum(tf.get());
+ SkTypeface* tf = SkTypeface::CreateFromName(fontName, SkTypeface::kNormal);
+ uint32_t checksum = compute_checksum(tf);
line.printf(checksumEntry, fontName, checksum);
sk_fwrite(line.c_str(), line.size(), file);
}

Powered by Google App Engine
This is Rietveld 408576698