Index: src/core/SkFontDescriptor.cpp |
diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp |
index 85629efa7ec640bf53d5a6d9533b0916c8d3afd7..69fdc154326936a56d46b1b1dc00e78f9990d3de 100644 |
--- a/src/core/SkFontDescriptor.cpp |
+++ b/src/core/SkFontDescriptor.cpp |
@@ -23,7 +23,7 @@ |
kSentinel = 0xFF, |
}; |
-SkFontDescriptor::SkFontDescriptor() { } |
+SkFontDescriptor::SkFontDescriptor(SkTypeface::Style style) : fStyle(style) { } |
static void read_string(SkStream* stream, SkString* string) { |
const uint32_t length = SkToU32(stream->readPackedUInt()); |
@@ -59,15 +59,7 @@ |
} |
bool SkFontDescriptor::Deserialize(SkStream* stream, SkFontDescriptor* result) { |
- size_t styleBits = stream->readPackedUInt(); |
- if (styleBits <= 2) { |
- // Remove this branch when MIN_PICTURE_VERSION > 45 |
- result->fStyle = SkFontStyle::FromOldStyle(styleBits); |
- } else { |
- result->fStyle = SkFontStyle((styleBits >> 16) & 0xFFFF, |
- (styleBits >> 8 ) & 0xFF, |
- static_cast<SkFontStyle::Slant>(styleBits & 0xFF)); |
- } |
+ result->fStyle = (SkTypeface::Style)stream->readPackedUInt(); |
SkAutoSTMalloc<4, SkFixed> axis; |
size_t axisCount = 0; |
@@ -117,8 +109,7 @@ |
} |
void SkFontDescriptor::serialize(SkWStream* stream) { |
- uint32_t styleBits = (fStyle.weight() << 16) | (fStyle.width() << 8) | (fStyle.slant()); |
- stream->writePackedUInt(styleBits); |
+ stream->writePackedUInt(fStyle); |
write_string(stream, fFamilyName, kFontFamilyName); |
write_string(stream, fFullName, kFullName); |