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

Unified Diff: src/core/SkFontDescriptor.cpp

Issue 1057413005: Remove filename from SkFontDescriptor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add file name to assert. Created 5 years, 8 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/core/SkFontDescriptor.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFontDescriptor.cpp
diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp
index b2622d930007849b69782e003f5bec43d3c52d0d..4a6b5db837141b769e3130c5f76a6093d94e157e 100644
--- a/src/core/SkFontDescriptor.cpp
+++ b/src/core/SkFontDescriptor.cpp
@@ -18,7 +18,7 @@ enum {
// These count backwards from 0xFF, so as not to collide with the SFNT
// defines for names in its 'name' table.
kFontIndex = 0xFD,
- kFontFileName = 0xFE,
+ kFontFileName = 0xFE, // Remove when MIN_PICTURE_VERSION > 41
kSentinel = 0xFF,
};
@@ -32,6 +32,14 @@ static void read_string(SkStream* stream, SkString* string) {
}
}
+// Remove when MIN_PICTURE_VERSION > 41
+static void skip_string(SkStream* stream) {
+ const uint32_t length = SkToU32(stream->readPackedUInt());
+ if (length > 0) {
+ stream->skip(length);
+ }
+}
+
static void write_string(SkWStream* stream, const SkString& string,
uint32_t id) {
if (!string.isEmpty()) {
@@ -67,8 +75,8 @@ SkFontDescriptor::SkFontDescriptor(SkStream* stream) : fFontIndex(0) {
case kFontIndex:
fFontIndex = read_uint(stream);
break;
- case kFontFileName:
- read_string(stream, &fFontFileName);
+ case kFontFileName: // Remove when MIN_PICTURE_VERSION > 41
+ skip_string(stream);
break;
default:
SkDEBUGFAIL("Unknown id used by a font descriptor");
@@ -91,7 +99,6 @@ void SkFontDescriptor::serialize(SkWStream* stream) {
write_string(stream, fFamilyName, kFontFamilyName);
write_string(stream, fFullName, kFullName);
write_string(stream, fPostscriptName, kPostscriptName);
- write_string(stream, fFontFileName, kFontFileName);
if (fFontIndex) {
write_uint(stream, fFontIndex, kFontIndex);
}
« no previous file with comments | « src/core/SkFontDescriptor.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698