Chromium Code Reviews| Index: src/core/SkFontDescriptor.cpp |
| diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp |
| index 5088ed7687bcec8dae2954ca2c5d3cf4aaa5b43b..3e1a9578c4e749bafc28661eff13c08a41e498eb 100644 |
| --- a/src/core/SkFontDescriptor.cpp |
| +++ b/src/core/SkFontDescriptor.cpp |
| @@ -16,13 +16,12 @@ enum { |
| // These count backwards from 0xFF, so as not to collide with the SFNT |
| // defines for names in its 'name' table. |
| + kFontFileIndex = 0xFD, |
| kFontFileName = 0xFE, |
| kSentinel = 0xFF, |
| }; |
| -SkFontDescriptor::SkFontDescriptor(SkTypeface::Style style) { |
| - fStyle = style; |
| -} |
| +SkFontDescriptor::SkFontDescriptor(SkTypeface::Style style) : fFontFileIndex(0), fStyle(style) { } |
|
bungeman-skia
2014/09/15 15:52:07
So I took a look into an 'unknown' or 'isn't a col
|
| static void read_string(SkStream* stream, SkString* string) { |
| const uint32_t length = SkToU32(stream->readPackedUInt()); |
| @@ -41,7 +40,16 @@ static void write_string(SkWStream* stream, const SkString& string, |
| } |
| } |
| -SkFontDescriptor::SkFontDescriptor(SkStream* stream) { |
| +static size_t read_uint(SkStream* stream) { |
| + return stream->readPackedUInt(); |
| +} |
| + |
| +static void write_uint(SkWStream* stream, size_t n, uint32_t id) { |
| + stream->writePackedUInt(id); |
| + stream->writePackedUInt(n); |
| +} |
| + |
| +SkFontDescriptor::SkFontDescriptor(SkStream* stream) : fFontFileIndex(0) { |
| fStyle = (SkTypeface::Style)stream->readPackedUInt(); |
| for (;;) { |
| @@ -55,6 +63,9 @@ SkFontDescriptor::SkFontDescriptor(SkStream* stream) { |
| case kPostscriptName: |
| read_string(stream, &fPostscriptName); |
| break; |
| + case kFontFileIndex: |
| + fFontFileIndex = read_uint(stream); |
| + break; |
| case kFontFileName: |
| read_string(stream, &fFontFileName); |
| break; |
| @@ -74,6 +85,7 @@ void SkFontDescriptor::serialize(SkWStream* stream) { |
| write_string(stream, fFullName, kFullName); |
| write_string(stream, fPostscriptName, kPostscriptName); |
| write_string(stream, fFontFileName, kFontFileName); |
| + write_uint(stream, fFontFileIndex, kFontFileIndex); |
| stream->writePackedUInt(kSentinel); |
| } |