diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-10-14 11:44:57 -0400 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2011-10-14 12:57:53 -0700 |
commit | 6497ae7b2a3b8ff6e2832789b3927e03c800b585 (patch) | |
tree | d884d06dca1a6cd4558b2f21eac3bb6da4d3ea79 | |
parent | 40646971fb336f93951a6fc616f83c00e4de7add (diff) | |
download | skia-6497ae7b2a3b8ff6e2832789b3927e03c800b585.tar.gz |
Fix serialization crash for saved pages in the browser.android-4.0.2_r1ics-mr0-release
The uint packing optimization was producing incorrect results in
this case. Since it only saves us approx 1 byte per font there is
no need to try to keep it around.
bug: 5461283
Change-Id: Ic2b0154d433fa620e588b048c32064358aa94bc4
-rw-r--r-- | src/ports/SkFontHost_android.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp index 766c617a2f..5b7eb242c0 100644 --- a/src/ports/SkFontHost_android.cpp +++ b/src/ports/SkFontHost_android.cpp @@ -554,7 +554,7 @@ void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) { // store the length of the custom font uint32_t len = fontStream->getLength(); - stream->writePackedUInt(len); + stream->write32(len); // store the entire font in the serialized stream void* fontData = malloc(len); @@ -564,7 +564,7 @@ void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) { fontStream->unref(); free(fontData); -// SkDebugf("--- fonthost custom serialize %d\n", face->style()); +// SkDebugf("--- fonthost custom serialize %d %d\n", face->style(), len); } else { const char* name = ((FamilyTypeface*)face)->getUniqueString(); @@ -592,7 +592,7 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { if (isCustomFont) { // read the length of the custom font from the stream - int len = stream->readPackedUInt(); + uint32_t len = stream->readU32(); // generate a new stream to store the custom typeface SkMemoryStream* fontStream = new SkMemoryStream(len); @@ -602,7 +602,7 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { fontStream->unref(); -// SkDebugf("--- fonthost custom deserialize %d\n", face->style()); +// SkDebugf("--- fonthost custom deserialize %d %d\n", face->style(), len); return face; } else { |