diff options
author | mtklein <mtklein@google.com> | 2016-06-13 11:27:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-13 11:27:55 -0700 |
commit | f8f9c07c283a3204a38b4324c14597e644686428 (patch) | |
tree | 73effdf236fbef7655a5c8a18a88f1ffd8f63e4b /src/core/SkFontDescriptor.cpp | |
parent | be36d59e664513294c02ff9691a3c1817a712fee (diff) |
Revert of Update typeface serialization style. (patchset #3 id:40001 of https://codereview.chromium.org/2030683002/ )
Reason for revert:
serialize-8888 broken for typefacestyles on Mac. (Bold weighting goes missing.)
Original issue's description:
> Update typeface serialization style.
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2030683002
>
> Committed: https://skia.googlesource.com/skia/+/7ae1c72e593823e6e300e4199558555765bcec17
TBR=reed@google.com,bungeman@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review-Url: https://codereview.chromium.org/2067583002
Diffstat (limited to 'src/core/SkFontDescriptor.cpp')
-rw-r--r-- | src/core/SkFontDescriptor.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp index 85629efa7e..69fdc15432 100644 --- a/src/core/SkFontDescriptor.cpp +++ b/src/core/SkFontDescriptor.cpp @@ -23,7 +23,7 @@ enum { 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 @@ static void write_uint(SkWStream* stream, size_t n, uint32_t id) { } 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 @@ bool SkFontDescriptor::Deserialize(SkStream* stream, SkFontDescriptor* result) { } 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); |