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

Unified Diff: src/core/SkFontDescriptor.cpp

Issue 2067583002: Revert of Update typeface serialization style. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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/SkTypeface.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 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);
« no previous file with comments | « src/core/SkFontDescriptor.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698