Fix serialization crash for saved pages in the browser.
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
diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp
index 766c617..5b7eb24 100644
--- a/src/ports/SkFontHost_android.cpp
+++ b/src/ports/SkFontHost_android.cpp
@@ -554,7 +554,7 @@
// 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 @@
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 @@
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 @@
fontStream->unref();
-// SkDebugf("--- fonthost custom deserialize %d\n", face->style());
+// SkDebugf("--- fonthost custom deserialize %d %d\n", face->style(), len);
return face;
} else {