aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkFontDescriptor.cpp
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2015-04-17 11:00:06 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-17 11:00:06 -0700
commit9d911d5a9323bda1e4a77c46a0c28708dcc2ad38 (patch)
tree685c86620940f7813d11778defda1b293c576ca2 /src/core/SkFontDescriptor.cpp
parentfec19e1751d1a20748e9beaf0a948c01ffe89f04 (diff)
Remove filename from SkFontDescriptor.
No one actually uses it, so remove it. Keep the string id for backward compatibility. TBR=reed@google.com This doesn't change any public API. Review URL: https://codereview.chromium.org/1057413005
Diffstat (limited to 'src/core/SkFontDescriptor.cpp')
-rw-r--r--src/core/SkFontDescriptor.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp
index b2622d9300..4a6b5db837 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);
}